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
If I am using simplepbr, it looks great
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!