TextureStage mode question

Hi, I am attempting to animate a texture on a model. The texture itself is a gradient with alpha transparency.

I am able to animate the texture correctly, however, The texture animates over the texture of the exported model, and there is no transparency. I attempted to set the textureStage mode to TexturStage.MAdd, but it did not work. Here is how I have the model and texture set up:

self.ts0 = TextureStage('texstage0')
self.ts0.setTexcoordName("0")
self.ts0.setMode(TextureStage.MReplace)
self.ts0.setSort(0)
tex = loader.loadTexture('../models/tex/transgradiet.png')
self.slash1trail = loader.loadModel('../models/kiktrailtex.glb')
self.slash1trail.setTexture(self.ts0, tex,1)

Hmm… It might be better to find and replace the texture itself, via the “replaceTexture” method. (See this API entry for more.)

That does call for having access the texture to be replaced, I imagine, but that might be found via NodePath’s “findTexture” (if you know the name of the texture in question) or “findAllTextures” methods, perhaps.

This might perhaps be fixed via a call to NodePath’s “setTransparency” method–once the above issue of texture-replacement has been fixed, at least.

Something like this:

myNodePath.setTransparency(True)
1 Like

setTransparency seemed to do the trick, thanks!

1 Like