DLR-RM / BlenderProc

A procedural Blender pipeline for photorealistic training image generation
GNU General Public License v3.0
2.78k stars 449 forks source link

[QUESTION] Manually Setting Roughness Value for a Model with Only Mesh and Base Color #1132

Closed zzg-zzg closed 2 months ago

zzg-zzg commented 2 months ago

Describe your feature request

Hello Community,

I have a question regarding the manual setting of the roughness value for a 3D model that I'm working on. My model currently consists only of a mesh and a base color texture, and I'm having trouble figuring out how to adjust the roughness.I found the roughness function in the documentation, but it seems not to meet my need to manually set a value. [(https://dlr-rm.github.io/BlenderProc/blenderproc.api.material.html#blenderproc.material.add_roughness)]

blenderproc.material.add_roughness(nodes, links, roughness_image_path, principled_bsdf)
Adds roughness to the principled bsdf node.

Parameters
:
nodes (Nodes) – Nodes from the current material

links (NodeLinks) – Links from the current material

roughness_image_path (str) – Path to the metal image

principled_bsdf (Node) – Principled BSDF node of the current material

Returns
:
bpy.types.Node: The newly constructed texture node

In the Blender's GUI, I can manually set this value, but I'm not quite clear on how to do the same thing in my BlenderProc rendering script. I would be very grateful if anyone could provide a solution.

Describe a possible solution

No response

zzg-zzg commented 2 months ago

I found a solution by simply use the code: for obj in objs: for mat in obj.get_materials(): mat.set_principled_shader_value("Roughness", 0.9)