Help with opacity maps

Hey everyone

I’m currently playing around with textures and I’ve come across a problem. I want to make an on screen HUD and I’ve found some temporary graphics from Doom that I’d like to use for these tests. I have made an opacity map for the image (see below for the original image and opacity map), but I have trouble getting it working. I get no transparency from using the opacity map.

I use the following code to load the texture and apply it to a CardMaker:

self.doomTexture = loader.loadTexture("models/doom/DoomWeaponsPC.png", "models/doom/DoomWeaponsPC-opacity.png")
cm = CardMaker("weaponHUD")
self.weaponHUD = render2d.attachNewNode(cm.generate())

This ends up looking like this:

Does anyone know what my problem is?

Thanks in advance,

Have you set UV coordinates correctly?
You can try this, to see if its a power-of-two scaling issue:


Also you can try putting “textures-auto-power-2 #t” in your Config.prc file.

Hey, thanks for taking the time.

I tried both suggestions but nothing changed. I still don’t get any transparency. Do you know what else could be wrong? If you want, I could upload the project somewhere so you could try and see for yourself?

EDIT: I’ve uploaded it here:

Oh, that. You need to call setTransparency(TransparencyAttrib.MAlpha) on the model to enable transparency for it.

Worked, thanks. :slight_smile: