Skybox doesnt render with simplepbr, but, does with out it

Hey Team,

Im sure this is is simple for you and just something im unaware of. Without simplepbr.init(),

this code works fine:

  def _load_skybox(self):
        self.skybox = self.loader.loadModel("models/inverted_sphere.glb")
        self.cubemap = self.loader.loadCubeMap("skyboxes/nebula/#.jpg")
        self.skybox.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition)
        self.skybox.setTexProjector(TextureStage.getDefault(), self.render, self.skybox)

However, It doesnt if i initialize simplepbr. Any guidance?

Its just black btw.

You may have forgotten to perform an operation to flip polygons in the 3D editor? It is actually required to flip the normals, so they determine which side will interact with the lighting. Although you have turned off the lighting, however, it is not known how simplepbr reacts to this.

The normals are facing inward. The skybox works in the base renderer. Just not with simple pbr.

Potentially, the following happens, simplepbr does not know how to process this geometry, since pipeline does need maps and, accordingly, outputs for the shader.

Try it, self.skybox.setShaderOff()

1 Like

yup, that works.

Instead of no shader, you can also use the autoshader for the Node that isn’t working in simplepbr. I’ll need to do some digging but I suspect the TexGenAttrib is not currently recognized/supported by simplepbr. Hopefully custom shaders have access to it.

Could you please file an issue on GitHub with a sample that demonstrates the issue?

Yeah, no problem at all. Thanks for looking into it.

Another thing I just thought of is that the you might not be setting the TexGenAttrib for the right texture stage(s). You can use NodePath.findAllTextureStages() to get a list of stages and then set the TexGen for each.

This is my weakest area of knowledge at the moment, so you just spoke gibberish to me :). I meed to read the texuring/rendering stuff more deeply.

Something like this (untested, on mobile, etc):

for stage in self.skybox.findAllTextureStages():
    self.skybox.setTexGen(stage, TexGenAttrib.MWorldPosition)
    self.skybox.setTexProjector(stage, self.render, self.skybox)

No go on this one, skybox is still black. Sorry I have not opened a issue on github yet. Its not priority because i dont plan on using simplepbr, so normal rendering is fine.