Skip to content

How to render a object with roughness/metallic textures and output roughness/metallic images? #1131

@bbbbubble

Description

@bbbbubble

Describe your feature request

As dicussed in #1105 , with this piece of code, we can output roughness/metallic images with default values of roughness/metallic.

# some objects' normals are affected by textures
mesh_objects = convert_to_meshes([obj for obj in scene_meshes()])
for obj in mesh_objects:
    print("removing invalid normals")
    for mat in obj.get_materials():
        mat.set_principled_shader_value("Normal", [1,1,1])
        principled_bsdf = mat.get_the_one_node_with_type("BsdfPrincipled")
        for key in ["Roughness", "Metallic", "Specular"]:
            obj.set_cp("cp_"+ key.lower(),  principled_bsdf.inputs[key].default_value)

...

bproc.renderer.enable_segmentation_output(map_by=["cp_roughness", "cp_metallic", "cp_specular", 'instance'],default_values={'cp_roughness': None, 'cp_metallic': None, 'cp_specular': None} )

However, if we have objects with roughness/metallic textures, the results are wrong:
image
Any solutions? Thanks!

Describe a possible solution

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions