Gltf Textures Not showing in game, but work in gltf-viewer

When I look at my model in viewer by doing;
pip install panda3d-gltf, and running gltf-viewer $nameOfModel
or when I view my model online at;
https://gltf-viewer.donmccurdy.com/
I can see my texture on the model. when I used to use .egg it showed the textures

My question I guess is, do we need to do something different to display textures
on our gltf models or is it just being glitchy?
I am just loading it in and reparent to render, (I do see it but no texture applied).

P.S I have been working super hard on www.shenko.org, panda3d and blender is a big part of my project. The last peice of my puzzle in testing is making the new gltf texture. any suggestions are apreciated.

gltf-viewer is making use of simplepbr to handle the PBR materials and textures coming out of Blender’s glTF exporter. However, I am surprised that you’re not seeing any texture as opposed to the color being off. Are you using Panda’s auto shader? Maybe give simplepbr a shot to see if that helps us narrow down the problem?

I’m looking into it now, my pip install threw up a error. I’m going to try the other manual install method. Just thought you should be aware.

$ pip install panda3d-simplepbr
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at Release process - pip documentation v24.0.dev0
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement panda3d-simplepbr (from versions: none)
ERROR: No matching distribution found for panda3d-simplepbr

I’ll let you know how it goes, thanx

Installed fine using the manual method, but when I added ‘import simplepbr’ to my script I got this error;

Traceback (most recent call last):
File “./main.py”, line 6, in
import simplepbr
File “/home/shenko/.local/lib/python2.7/site-packages/simplepbr/init.py”, line 30
f’#define {define} {value}’
^
SyntaxError: invalid syntax

I’m done working for today so I can’t dive into it right now. but I’ll take a look again tmrw.

Ah, simplepbr does not support Python 2. It’s tested on 3.7+, but I believe 3.6 would also work.

Of course, this is not the best place to talk about it, but when I was editing examples for the GUI, I started thinking about Python versions and code that would work for everyone. I came to the conclusion that we need to use .format () for strings. But I would like to say this: we need to develop programming rules for Addons and for the code in the documentation. This should combine the community’s work into a single programming standard for Panda3D.

@serega-kkz, just getting into this whole programming thing and I completely agree with you, it is so frustrating sometimes. I had the same idea to make a ‘standard’ and post it on my website www.shenko.org, but just getting the thing to work locally is a problem. We’ll get there eventually.

@Moguri, My stock code black background, the viewer shows textured block/asset, but when I added your code (import simplepbr and simplepbr.init()) I do see a change but no texture (NOTE; I didn’t add the line super.init() I don’t know if that is why?)

I still have to run some more tests, like maybe different blender outputs or I dunno if throwing my computer against the wall solves it?

And yes running it as ‘python3 $nameOfMyFile.py’ got it going.

Moguri’s link here;
SimplePBR github page

You’re not calling the ShowBase constructor? If not, yes, you should be calling either super().__init__() or ShowBase.__init__() from your ShowBase subclass. ShowBase does a lot of its magic in its constructor (the __init__() function).

yup just checked ShowBase.init() is called at the beginning of my class, I swapped it out for super.init it runs with no errors but still no joy with the whole texture situation. Maybe its blender and the way I applied the texture? (we do see it in the viewer but i dunno).
I could leave it in wireframe for now, as I build up the rest of the project, come back to texturing later on.

The gltf-viewer really doesn’t do much special, and you can see it’s code here.

Oh, a thought just occurred to me! Perhaps Assimp is being picked to load the glTF file instead of panda3d-gltf? Could you try adding the following line in your ShowBase subclass prior to loading the model: gltf.patch_loader(self.loader)

no joy :frowning:
If I could maybe just get something like toon shader to work in the meantime, at least to
see the ‘blocks’ outline

It’s hard to tell what is the problem without the code or the actual model, but a common error is that you are not creating any lights in your scene.

gltf-viewer is creating a default light (or apply the lights from the model if any) that would explain why you see it correctly in the viewer and not in your app.