Missing textures in environment (Lesson 2)
Closed this issue · 10 comments
Hmm, I see!
Well, first things first: are you seeing any errors in the console? That might point us in the direction of the issue.
That said, my first guess would be that the texture-files aren't located where the model-file indicates them to be. Do you have the "tex" directory inside the "Models/Misc/" directory, and if so, does it contain the various textures used by the environment (e.g. "bricks.png")?
the following is my only console output:
C:\Python38\python.exe C:/Users/HopFlash/PycharmProjects/Panda3dTutorial/Main.py
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
Process finished with exit code 0
The following screenshot shows my file structure:
PS: the environment.blend was a test of mine to import it into blender and export it again or something...but I'm not good enough with blender to do anything good.
Hmm... Very odd: it looks like the textures are present in the expected location, and there's no error output.
You say that you tried importing the model into Blender and then re-exporting it--I don't suppose that you might have overwritten the original, perhaps?
I tried the code and assets for Lesson 2 on my own machine a little earlier, and the textures appeared there as expected. I am using a slightly different version of Python (3.6.9) and Panda (1.10.6.post2). Still, I wouldn't expect so large a difference in behaviour.
Would you try something for me, please? At the end of your "__init__" method, please add the following lines and tell me what the resulting console output is:
render.analyze()
print ("~~~")
for tex in render.findAllTextures():
print (tex)
to be sure I overwrote the files again and tried...all the same.
I doesn't mentioned it yet but I'm on Windows 10.
I'm now in Lesson 7 with the code but I think that doesn't interrupt with your console output request ;)
C:\Python38\python.exe C:/Users/HopFlash/PycharmProjects/Panda3dTutorial/Main.py
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
33 total nodes (including 0 instances); 0 LODNodes.
19 transforms; 3% of nodes have some render attribute.
18 Geoms, with 18 GeomVertexDatas and 2 GeomVertexFormats, appear on 18 GeomNodes.
42126 vertices, 42126 normals, 25901 colors, 42126 texture coordinates.
GeomVertexData arrays occupy 2962K memory.
GeomPrimitive arrays occupy 391K memory.
66813 triangles:
584 of these are on 126 tristrips (4.63492 average tris per strip).
66229 of these are independent triangles.
2 textures, estimated minimum 28672K texture memory required.
~~~
2d_texture panda_chan_c (from /c/Users/HopFlash/PycharmProjects/Panda3dTutorial/Models/PandaChan/texture/panda_chan_c.png)
2-d, 2048 x 2048 pixels, each 3 bytes, rgb
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=0) lod(min=-1000, max=1000, bias=0) 12582912 bytes in ram, compression off
simple image: 16 x 16, 1024 bytes
2d_texture panda_chan_ng (from /c/Users/HopFlash/PycharmProjects/Panda3dTutorial/Models/PandaChan/texture/panda_chan_ng.png)
2-d, 2048 x 2048 pixels, each 4 bytes, rgba
sampler wrap(u=repeat, v=repeat, w=repeat, border=0 0 0 1) filter(min=linear_mipmap_linear, mag=linear, aniso=0) lod(min=-1000, max=1000, bias=0) 16777216 bytes in ram, compression off
simple image: 1 x 1, 4 bytes
Process finished with exit code 0
Interesting that it doesn't find the other textures.
btw. thx for your support. I was so happy to find your tutorial because it is exactly what I searched for. (well written, orientied at a real little game and you mention parts outside the scope of this tutorial so I know a little what other to expect)
That is very strange indeed... o_0
All right, another test then:
Open a terminal (... I think that I recall that Windows calls it "cmd"; it's been a while ^^; ), and point it to the "Models/Misc" folder. (I know that in Ubuntu one can open a terminal pointing to a given directory from the file manager; perhaps you can do similarly in Windows.)
From there, run the following command:
pview environment.egg
That should open up PView and have it display the model. (If called for, press "C" to centre the view on the model.)
Presuming that doing so works, do the textures show up in PView? And does this change if you activate lighting (by pressing "L") or per-pixel shading (by pressing "P")?
Another thing that might be worth checking, just in case, is whether your egg file references the textures in question. To do this, just open the egg-file in a text-editor and look for entries that start with "<Texture>". You could also search the file for the "brickColour" texture-name, looking to see whether it's used in any of the polygon entries.
I'm not sure of how the references might have become lost, but it seems worth checking!
btw. thx for your support.
It's my pleasure! ^_^
I was so happy to find your tutorial because it is exactly what I searched for. (well written, orientied at a real little game and you mention parts outside the scope of this tutorial so I know a little what other to expect)
Ah, I'm really glad to read that it is proving useful to you! And thank you for your kind words regarding the tutorial! :D
ok...I tried something...
I redownloaded the zip from "ArsThaumaturgis/PandaSampleModels" and put it into a different directory on my harddrive.
Then I used "cmd" and the "pview"-call and there it is...all textures as aspected.
Then I copied the files into my project directory. Tried "pview" on them ... no textures.
I renamed my "Misc" and made a new one and copied the files into it...no textures.
I moved the egg/blend files and tex-directory one directory up and tried "pview" again... all textures as aspected.
I thought of some path-length issues but the file path to bricks.png is less then 80 chars long.
So I think your files are fine but there must be some other effect why it doesn't work in my project directory :|
and now I throw another strange behavior into this thing...
if I try pview on my renamed old "Misc" directory that is now called "Misc_old" then it works fine and I see the textures. I tried different directories but only found that "Misc" has this odd behavior.
I really don't see what is special about it.
And only the environment.egg has this problem. "simpleEnemy" and "act_p3d_chan" are working fine.
I'm not sure but I think it's no issue with your tutorial project and we can close it here?
Nothing less I would really know why this problem exists and if there is a systematic bias.
Ah, sorry for leaving this so! Some personal stuff drove it from my mind, I fear! ^^;;
But yeah, I honestly don't know why this is happening, but it doesn't seem to be related to the tutorial itself. I suggest taking the issue to the forum--someone there might have an idea of what's wrong!
(Why the behaviour of the model should depend on the directory so I really don't know. It's possible that I made some error in exporting, I suppose...)
I'll close this for now, then.