Model's normal texture missing when using RenderPipeline

Hi, community

I am trying the RenderPipeline now and would like to integrate it into my project. It is awesome and I almost made it. But I run into a model problem that no normal texture is applied to my models.

Below shows the model preview in Blender:

But in Renderpipeline, no gloss is applied, making it a bit ugly :disappointed_relieved:

If I am using simplepbr, it looks great
image

I checked a lot of posts and the RenderPipeline wiki before. I think it is probably caused by the texture order problem. I checked the texture stage order with the following code provided by @serega-kkz :

 for node_path in model.find_all_matches('**/+GeomNode'):
            geom_states = node_path.node().get_geom_states()
            print(node_path.name)
            for geom_state in geom_states:
                if geom_state.has_attrib(MaterialAttrib):
                    print(geom_state.get_attrib(MaterialAttrib).get_material())

                if geom_state.has_attrib(TextureAttrib):
                    texture_stages = geom_state.get_attrib(TextureAttrib).get_on_stages()
                    for k, texture_stage in enumerate(texture_stages):
                        print(texture_stage, geom_state.get_attrib(TextureAttrib).get_on_texture(texture_stage))

It told me that the texture order of the car’s main body is 1. basecolor 2. roughness 3. normal 4. emission, which is not in the proper order suggested by @tobspr. I tried to modify the texture stage order by the following code, but failed to do it.

 for node_path in model.find_all_matches('**/+GeomNode'):
            geom_states = node_path.node().get_geom_states()
            print(node_path.name)
            for geom_state in geom_states:
                if geom_state.has_attrib(MaterialAttrib):
                    print(geom_state.get_attrib(MaterialAttrib).get_material())

                if geom_state.has_attrib(TextureAttrib):
                    texture_stages = geom_state.get_attrib(TextureAttrib).get_on_stages()
                    texture_orders = []
                    for k, texture_stage in enumerate(texture_stages):
                        print(texture_stage, geom_state.get_attrib(TextureAttrib).get_on_texture(texture_stage))
                        texture_stage = geom_state.get_attrib(TextureAttrib).get_on_texture(texture_stage).get_name()
                        texture_orders.append([texture_stage, priority(texture_stage)])
                    texture_orders.sort(key=lambda x: x[1])
                    textattr: TextureAttrib = TextureAttrib.make()
                    for texture_stage, pri in texture_orders:
                        texture_stage.setSort(pri)
                        texture_stage.setPriority(pri)
                        texture_stage.setName(str(pri))
                        textattr.addOnStage(texture_stage, geom_state.get_attrib(TextureAttrib).get_on_texture(texture_stage))
                    geom_state.setAttrib(textattr, 1)
                    geom_state.set_attrib(TextureAttrib)

Can anybody help me with it? Is my speculation about this missing normal issue right? I would be really appreciated if someone can help me work it out. Thank you guys in advance!

There are others here who are more familiar with the RP model pipeline than I am, but I will say that, to my knowledge, RP was not designed to handle contemporary IE BSDF model files.

Feel free to check out my module complexpbr, which offers IBL among other things in an easy to use package. Complexpbr -- A Module for PBR IBL, SSAO, SSR, AA, Vertex Displacement and More in Panda3D

Wow, I will definitely try it. I checked the code. Though the name is complexpbr, but the code is quite concise :wink:

1 Like

Very impressive work!Now we get a new render again😀.
But there are questions if we want to make games.
Does it compatible with panda3d’s built-in particle system?I didn’t find the information from your github page.
How to export models and animations to it by using blender?Are there any tools?
What kind of render path you use?

I am a newbie to RP too.
But I think you can try to check those blend files that RP offered.
Maybe this can help you resolve the required materials.

Thanks for the nice comments.

  1. Yes, it is compatible with the Panda3D built-in particle system.
  2. You can export .gltf models straight from Blender and use them with complexpbr. For distribution, I would suggest running gltf2bam for packaging them into .bam files.
  3. For animated models, you can probably use .gltf, and blend2bam is an option there as well.

The render path is the standard GLSL shader support offered by Panda3D. You can set complexpbr.apply_shader() on base.render or any model node. You can also access any shader input in complexpbr on the model level, IE model.set_shader_input(‘ao’,0.1) after apply_shader() has been called.

This all might seem obvious to me, so if there’s anything you’d like to see on the complexpbr page, let me know and I’ll try to get it on there. I also implemented Bloom based on a Feature Request issue I received yesterday.

2 Likes

Brilliant work,thanks.
So it still use Forward rendering.
I think maybe you can add deferred rendering to it.You know,almost all games nowadays support deferred rendering.

I’m definitely open to suggestions, but “add deferred rendering” isn’t really specific enough. Are there any effects specifically you’re thinking of here?

My first impression of the screenshot is that the roughness is too high. Check the roughness texture. You may also consider using the clear coat model that RenderPipeline offers (see the RP car demo) to get good results on car bodies.

I want to use lights.Plenty of lights.

At some point I plan to revisit a Forward+ technique where the lighting is tiled via compute shader. So instead of looping over every dynamic light in the scene, the current pixel’s screenspace position is used to reference the light list in the precomputed tile grid. I would probably also want to do something clampy with the light attenuation such that there is a really steep and finite falloff per light, so that the lights don’t overlap too much.

I made a CPU-side tiled implementation once, but it was too slow. As of now I would suggest using emissive materials + Bloom in conjunction with your lights if you want to have a ton of lights in the scene.

That said if we want to continue discussing complexpbr we should probably do it on the Showcase post, not in an RP issue post.

1 Like