I have a problem with native (non blender-exported) geometry showing up pitch black. When transporting my blender models to Panda3D, I would like to avoid egg-files in favor of the more native export of glTF files.
After import of the simplepbr module, the glTF models CAN be loaded (without error), and after calling it’s .init method in the Base subclass constructor, the textures even look correct.
The problem is that if I call the .init method, the geometry generated by panda3d shows up as pitch black. No texture, no basic shading (although there is a directional light from above).
I have created a dedicated small program to show the issue.
from panda3d.core import loadPrcFileData, DirectionalLight from direct.showbase.ShowBase import ShowBase from panda3d.core import GeoMipTerrain, Filename import simplepbr loadPrcFileData("", """ win-size 1280 720 window-title My Game """) class MyGame(ShowBase): def __init__(self): super().__init__() #simplepbr.init() ## <== Here lies the problem! Commented out, it shows the texture. FILENAME = r"d:\python38\work\panda3d\01_start\textures\height129.png" dlight = DirectionalLight("sun") dlnp = self.render.attachNewNode(dlight) dlnp.setHpr(0, -90, 0) self.render.setLight(dlnp) tex = self.tex = self.loader.loadTexture(Filename.fromOsSpecific(FILENAME)) self.terrain = GeoMipTerrain("mySimpleTerrain") self.terrain.setHeightfield(Filename.fromOsSpecific(FILENAME)) self.terrain.getRoot().reparentTo(self.render) self.terrain.getRoot().setScale(1, 1, 30) self.terrain.getRoot().setPos(-60, 30, 0) self.terrain.getRoot().setTexture(tex) self.terrain.generate() self.cam.setPos(0, -100, 120) self.cam.setHpr(0, -30, 0) game = MyGame() game.run()
Here’s the referenced heightmap “height129.png”:
With the .init commented out, it looks like this:
WITH .init(), it looks like this:
I’m sorry, I didn’t find the simplepbr documentation and maybe it is a simple flag-setting issue. But I wonder, why the simplepbr works so exclusively against panda’s native geometry generation and texturing and I don’t find it mentioned, anywhere. I feel like I will smash my table with my forehead at the first answer to this question.
Many thanks if you could tell me how to get blender exported glTF models and panda generated geometry to coexist peacefully next to each other.