I’m working through this tutorial. Seems like I’ve downloaded all the correct resources, but when I get to the second lesson, things come out plain white with no textures showing. True even if I directly download and run his reference code. Here’s my directory structure, what am I doing wrong?
bricks.png, sand.png, tileColour.png etc and their normals
act_p3d_chan.egg.pz and other .egg.pz files
Here’s the run log - no error reports:
% cd /Users/ken/Programs/Panda/ArsThaumaturgis ; /usr/bin/env /Users/ken/Programs/Panda/ArsThaumaturgis/.venv/bin/python /Users/ken/.vscode/extensions/ms-python.python-2023.21.13331008/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 63887 -- /Users/ken/Programs/Panda/ArsThaumaturgis/GameDownloaded.py
Known pipe types:
(all display modules loaded.)
These are not built-in models, you need to upload them to the game folder first.
The fact that the models are showing up as white suggests to me that the textures aren’t located in the expected directory relative to the model-files. And indeed, I can replicate the issue by moving the texture-files.
(Although, if that is the issue, then I’m surprised that you aren’t seeing errors to that effect.)
Specifically, if I’m not much mistaken the texture-files are expected to be in a folder named “tex”, which is located in the same directory as the related model-file.
So, if the file “environment.egg” is in the directory “MyProject/Cat/Mew/”, then the texture-files should be in the directory “MyProject/Cat/Mew/tex/”.
Now, it looks like the forum-software may have eaten the formatting of the directory-structure given in your first post, so it’s hard to confirm whether the above is indeed the issue, but that’s my current guess.
(Note: In order to preserve text-spacing, I recommend the use of code-tags. You can access those via the menu-bar at the top of the post-editing text-box, and specifically via the button that has an icon that looks like something this:
Well, I didn’t realize this bbs was flattening my indentation, thereby making my thereby making my file in structure display useless. But here’s my file structure, properly displayed, improved to match your suggestion. Still white background.
Hmm, that helps a lot!
And indeed, it looks like it is as I suspected: the folder “tex” is in the same parent-folder as the folder “Environment”–but not, therefore, in the same parent-folder as the file “environment.egg”.
Put another way:
Your path to “environment.egg” looks something like this:
Your path to the texture-files looks something like this:
However, your path to the texture-files (for that model) is expected to look something like this:
That is, the texture-files should be in a folder named “tex”–as you have–that is within the same directory as the model-file–which isn’t currently the case.
No actually, look closer, I moved both tex and environment.egg OUT of the Environment folder and into the Misc folder above because that was the way I found it in your reference code. And unless I can’t see straight, they are siblings. Reference code line 27:
self.environment = loader.loadModel(“Models/Misc/environment”)
I wonder if something else is going on…
Ah, you are quite right, with my apologies!
Hum… I really don’t know, then. It looks like the engine is failing to find the textures–but the fact that you’re not seeing any errors, and the fact that the textures are indeed present, argues against that.
At a stab in the dark, do the texture-files open successfully in a basic viewer?
Oh, and what happens if you attempt to open the “environment” model in PView? (i.e. by opening a terminal/command-prompt at the location of “environment.egg”, then in that terminal/prompt running the command:
I guess you need to clear the model cache. This should fix the texture situation, as it is possible that the model was cached earlier than you placed the textures in the correct path.
Ah, that’s actually a good thought! Clearing the cache seems well worth trying!