So I’ve got a problem with seeing the textures of my models in a Panda program or in PView - the models have no textures, and stay grey. I made my models in Blender, and exported them as .egg.pz files. I think this is a common problem among beginners, so I fumbled around for a while trying to correct various issues that others have said they had, which means:
- I have lighting in the scene, using code copied from the Roaming Ralph tutorial program:
# Create some lighting ambientLight = AmbientLight("ambientLight") ambientLight.setColor(Vec4(.3, .3, .3, 1)) directionalLight = DirectionalLight("directionalLight") directionalLight.setDirection(Vec3(-5, -5, -5)) directionalLight.setColor(Vec4(1, 1, 1, 1)) directionalLight.setSpecularColor(Vec4(1, 1, 1, 1)) render.setLight(render.attachNewNode(ambientLight)) render.setLight(render.attachNewNode(directionalLight))
- I have made sure my model is using UV map input, and not Orco
- I have made sure that the model has a material that displays the texture, by toggling the TexFace on in the Materials section of Blender.
I should note that the object is a dome with a floor and flipped normals, so it’s meant to be seen from the inside. When I render the object in Blender (F12 key; there might be others ways I don’t know about), the floor of the dome displays the texture fine, but the walls are black. Within the Blender file, I also have a light (a sun) inside the dome, so it should be lit.
The code I use to summon the object into my Panda program is taken from the tutorial at the start of the manual:
class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) # Load the environment model. self.environ = self.loader.loadModel("models/CavemanWorld") self.environ_tex = loader.loadTexture("models/maps/CavemanWorld_Texture.png") # Reparent the model to render. self.environ.reparentTo(self.render) # Apply scale and position transforms on the model. self.environ.setScale(1.5, 1.5, 1.5) self.environ.setPos(0, 0, 10)
I have tried it without loading a texture directly, too, but that doesn’t work either. I think it’s something to do with the model itself, though, since pview also shows me only a white blob, or a grey, textureless model if I press L. Then again, Blender renders the floor of the dome textured, at least (not sure about the walls, since they are black). Can anyone give me any hints or suggestions as to what might be the problem? Thanks a lot!