-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render Roughness Metallic or others #1105
Comments
Hey @zsy1987, could you please provide the error message you get when using the code?
|
About the code you gave at #282 , Where should this part of the code be modified? Is it in the SegMapRendererUtility.py file? Or is it simply a matter of incorporating this code into the main rendering code and utilizing it for rendering?
|
Yes that should be the way to go. Does it work? |
@cornerfarmer It doesn't work. for key in ["Roughness", "Metallic", "Specular"]:
obj.set_cp("cp_"+ key, principled_bsdf.inputs[key].default_value) bproc.renderer.enable_segmentation_output(map_by=["cp_Roughness", "cp_Metallic", "cp_Specular", 'instance'],default_values={'roughness': None, 'metallic': None, 'specular': None}) It shows error:
If I change the code to 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} ) It does't show any error, but after render, the result
|
I have tried, but it didn't work. I have rewritten the code using origin bpy to create ShaderNodeOutputAOV, and it works now. Thank you for your help. If possible, I will submit a PR in the future. |
I've been struggling with this issue for a week now and would very much look forward to your PR. ^v^ |
Hey @bbbbubble, how do your material nodes look like? So could you please print |
@cornerfarmer Thank you for your reply! # some objects' normals are affected by textures
mesh_objects = convert_to_meshes([obj for obj in scene_meshes()])
for obj in mesh_objects:
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")
import pdb; pdb.set_trace()
for key in ["Roughness", "Metallic", "Specular"]:
obj.set_cp("cp_"+ key, principled_bsdf.inputs[key].default_value) The first object:
The second object:
|
Hey @bbbbubble, thanks for the detailed infos. I think I found the reason why it is not working. The segmentation renderer maps all keys to lower case internally (see https://github.com/DLR-RM/BlenderProc/blame/main/blenderproc/python/postprocessing/PostProcessingUtility.py#L352), I dont know why yet. But to make it working for you, you just need to make every custom property lowercase:
and
Then everything should work. |
Hey cornerfarmer, I have a question. For models with roughness and metallic textures, can this method still be used? I tried it, but it seems to only return default values.
|
No, as I mentioned above, this code only cares about the default values. If you want to render the textures, you need to change the materials and the rendering parameters, it gets more complex. Please open another issue if you want to discuss that. |
Yes, I can confirm that this code only cares about the default values. Here is the roughness / metallic rendering result of the first object I mentioned above, which isn't what I expected: @cornerfarmer @adkAurora I opened a new issue #1131 , look forward to some discussions with you. Thank you! |
Could you please share the ShaderNodeOutputAOV and related code with us here? Thank you! |
No one can answer this question? It seems like a very basic problem... |
Describe the issue
Hey,
I want to render roughness, I see the code you gave at #282 but I can't render it, can you help me with this? Thank you very much!
I noticed that the code you gave is different from the one in SegMapRender. the first one use
get_all_mesh_objects()
but the second one use "get_all_blender_mesh_objects()". It seems that one returns a MeshObject, while the second returns an Object.Minimal code example
Files required to run the code
Nothing
Expected behavior
render segmap such as roughness.
BlenderProc version
2.7
The text was updated successfully, but these errors were encountered: