Transparency in Textures

I have the following code:

self.tree1 = loader.loadModel(MYDIR+"/models/trees/palm1")
self.tree1.setTransparency(TransparencyAttrib.MAlpha)
self.tree1.setAlphaScale(0.5)
self.tree1.setHpr(Vec3(0,0,0))
self.tree1.setPos(Vec3(0,0,0))
self.treeCol = CollisionNode('tree')
self.treeCol.addSolid(CollisionTube(0,0,0,0,0,10, 1))
self.treeColNp = self.tree1.attachNewNode(self.treeCol)

I have tried both TGA and PNG files and verified that the images have Alpha that is visible in Photoshop, but in Panda, the cutouts around the leaves show as white.

Again, Im sure its something stupid and I allow at least 2 hours of digging through the docs and the forums before I ask.

Wow, that’s weird.
What is this actually for :

self.tree1.setAlphaScale(0.5)

Did you try to set your leaves semi transparent, or just for debugging the transparency ?
Do you know that the default transparency mode is MAlpha ? So try change it to be MDual :

self.tree1.setTransparency(TransparencyAttrib.MDual)

Have you read this :
http://www.panda3d.org/manual/index.php/Transparency_and_Blending

Yes I have read that section 3 times.

I have been involved in computers and programming for 20 years, but am a stark novice at Panda… How much of that section do you think I understood?

BTW…

Doesn’t sound like it applies to my case.

I will try the MDaul

The self.tree1.setAlphaScale(0.5) WAS just for debugging because I dont know what the hell im doing.

Setting to MDual appeared to work, thanks!

I don’t know why MDual should work when MAlpha does not, unless you have nested transparency in your model: transparent parts viewed behind other transparent parts. Is this the case?

David

Can you put screenshot here, and your original texture ?
I’m curious, seems that it’s the first time happened around here.

After further investigation, I found they both work.

My problem was quite a bit simpler…

“tree1” was using “texture2” :blush: