SetTexture() replacement not opaque (SOLVED)

Hello all,
First, thanks to everyone who contributes to Panda3D. The marriage of my love for Python and interest in 3D modeling has found Panda3D to be everything I could ask for!

I like to try and solve these issues myself, but I cannot figure out what id going on, the code is so simple and I have not found anyone else having similar issues. I cannot find a reference to a method that might fix this.

I have a simple cube poly that I have UV-mapped a textured with a PNG file. I attempted to play with replacing textures at runtime using setTexture() with another PNG file. When I do this the new texture is overlaid atop the default texture, but is slightly transparent. It also does the same thing with a BMP texture as the overlay.

I have created lights, removed any alpha channels before exporting texture, double checked my materials in Blender, and I have recreated the poly from scratch. I cannot figure out what might be the issue.

import direct.directbase.DirectStart
from pandac.PandaModules import PointLight
from pandac.PandaModules import VBase4

x = loader.loadModel('cube')
x.setScale(3, 3, 3)
x.reparentTo(render)
x.setPos(0,0,-5)

light = PointLight('pointlight')
light.setColor(VBase4(1, 1, 1, 1))
light_node = render.attachNewNode(light)
light_node.setPos(10, 0, 0)
render.setLight(light_node)

base.trackball.node().setPos(0, 60, 0)

tex = loader.loadTexture('tex/wood_log_128.png')
x.setTexture(tex, 1)


run()

Anyone have some word of advice?

I’m maybe wrong but there can be something funky about the egg model. You can try setTexture with a given texture stage.
ts=x.findTextureStage(‘default’)
x.setTexture(ts, myTexture, 1)

If the exporter named the stages in some way, you’d need to call them by their name (e.g. the 3ds max exporter names them Tex1, Tex2, etc). You can check that in the egg file, this should be at the top, or list the texture stages in code with findAllTextureStages (check the reference, not sure if it is called the way I wrote it).

Ah, what you posted didn’t solve the issue but it sent me down the right path. I overlooked one of the settings on the EGG exporter for Blender. I thought it was acting as if I had baked the textures onto the model but decided to turn off ‘UV as texture’ and then set the texture explicitly via code. That fixed it and is doing as I expected. Thank you.