Replacing loaded normal texture

In my model I have a default texture loaded and a normal texture, both display correctly. (binormals and tangents have been calculated for model)

I want to switch the default texture and switch the normal. The default texture change works, but the normal doesn’t switch and the original normal isn’t visible either.

#default texture swap
ts = myNode.findTextureStage('default')  
myNode.setTexture(ts,textureMedium, 1)   

#normal texture swap
tsNRM = myNode.findTextureStage('normalTextureStage') 


This line:


is causing you problems, I think. First, you don’t need it, because replacing the texture in the next line is the action that actually makes the texture change. Second, this is setting your TextureStage to the wrong mode. MReplace means to replace all lighting effects on the node, including the effect of the normal map, so you are telling Panda to stop rendering the normal map.

There’s no need to set any particular mode on your TextureStage. It’s already got the right mode, because it was rendering the previous texture correctly. The same goes for the tsNRM, you shouldn’t try to change that mode either (it should already be in the right mode).


Thanks David, that worked!