Beginner Texture Problem

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))
  • 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):
        # 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.
        # 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! :smiley:

double-check if your model uses UV as mapping-input, and your model does have a valid UV-map (aka is unwrapped).
check your path-names for textures.
also check the terminal for any errors.
and also check the egg file’s first few lines if you can spot the texture-name anywhere. (dont use egg.pz for now since egg is human-readable and easy to debug)

if nothing helps. feel free to upload the model+texture somewhere so we can have a look at it. usualy it’s only a tiny detail you missed somewhere.

I checked everything over again, exported it as .egg this time and checked the paths; it all seems normal. I checked the console I used to acces pview, then, and it shows two :gobj(error):s. First, it says it cannot read the texture file, which is in .PNG format; second, it says it is “Unable to find texture … on model-path …”

Does this mean there is something wrong with the PNG file I have as a texture? I have triple-checked the file paths, and I am certain they are correct. The .PNG file I put in with other Panda textures in the Panda3D-1.7.0\models\maps directory, and this is the path specified in the .egg model, which is in the Panda3D-1.7.0\models directory. I did, however, move the model’s .egg file itself after exporting it.

I opened the original UV Face Layout, which was an .SVG file, in Inkscape, did some modifications to it entirely within that program (including filters), and then exported it as a .PNG file, which I then opened in Blender and fit to the Face Layout. Could that have caused some kind of problem along the way?

EDIT 2: I’ve uploading the model (.blend and .egg) and texture to Easy-Share. The model and texture are really ugly, but the point of them is to help me figure out the principles of making models in Blender and then using them in Panda. Here is the link; I hope it works. …

Thanks for taking the time to help me out!

Hello, I can see your model textured, it needed only a little correction. If you open your egg file you see:

<Texture> CavemanWorld_Texture. {

But in your zip file the texture is in the same folder, so substitute the previous code with:

<Texture> CavemanWorld_Texture. {

and you can see the model, correctly with textures (obviously if model and texture are still in the same folder), by:

pview CavemanWorld.egg

Maybe is better if you put your textures in a simpler place. For example, having your model in a specific path, you can put its textures in a textures subfolder, for example:

+ model.egg
+ textures/
  + texture.png

So you can reference your textures with simpler:

<Texture> CavemanWorld_Texture. {

And you don’t force your model-users to recreate more complex “./…/…/…/Panda3D-1.7.0/models/maps/CavemanWorld” structure.

Ah, it works! Thanks; I put the texture in the same folder as the model, and then removed all the prefixing to the texture name, leaving just the file name itself. That worked; now the world’s all diagonal, but I can fix that, I think. The important thing is the texture is there. I guess I’ll just have to keep the texture file-paths simple.

Thanks for the help!

Just wanted to add my two pennies for the organized folder system of asset management.

Use of folders for models, textures, sounds, level data… And so on is essential, especially when your projects inevitably expand and become huge with hundreds if not thousands of assets to manage.

This system keeps things clean useable and makes it colaberation friendly, Even to the point of being able to load a whole new level just by changing the path of the level assets…

( this comment is not intended to tech the old-timers to suck eggs, just a helpful (hopefully) hint to all our asspiering devs to help them avoid the mess that is known in our office as “data vomit” that comes from chucking everything into one folder…)


Whilst I’m at is I would also like to give a strong nod to establishing a clear and concise naming convention early…