I’m placing a cubemap on a model that was painted in Blender.
I want the two blended together.
The following code works beautifully:
tex = loader.loadCubeMap('files#.png')
self.ts = TextureStage('ts')
self.ts.setMode(TextureStage.MDecal)
self.model = loader.loadModel("model.egg")
self.model.setTexGen(self.ts, TexGenAttrib.MWorldNormal)
self.model.setTexture(self.ts, tex)
self.model.reparentTo(render)
But when the ts lines and the model loading line are interchanged it loads the cubemap but overrides the painted texture from Blender.
tex = loader.loadCubeMap('files#.png')
self.model = loader.loadModel("model.egg")
self.ts = TextureStage('ts')
self.ts.setMode(TextureStage.MDecal)
self.model.setTexGen(self.ts, TexGenAttrib.MWorldNormal)
self.model.setTexture(self.ts, tex)
self.model.reparentTo(render)
Since I got it to work in a small test program I wanted to incorporate it into my project. The project loads in models dynamically based on other things happening- even so, I added the ts lines ahead of the model loading line but in the program the result I get is the cubemap overriding the Blender textures. I have it in a class that loads up the model character which is called many times during the course of the program- I don’t know if this would make any difference but then again I wouldn’t have guessed that changing the above lines would have such an effect.
Is there something I’m missing?
I’d really like to have this work right.