DLR-RM / BlenderProc

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

If possible for BlenderProc to use blender4? #1128

Open YZHUA opened 1 month ago

YZHUA commented 1 month ago

Describe the issue

Thanks for the work of this great project first. When I was trying to use Blender, I found that the rendering nodes of Blender are not unified. Sometimes there is 'Principled BSDF', and sometimes there isn't. However, in Blender 4, this node appeared uniformly after testing several cases. Therefore, there is a demand to call Blender 4 using BlenderProc. But I couldn't find relevant information. So, I would like to ask, can this demand be fulfilled now? image image

Minimal code example

for ob in bpy.data.objects:
    if ob.type != 'MESH': continue
    if len(ob.data.materials) == 0: continue
    for material in ob.data.materials:
        key = 'Principled BSDF'
        for node in material.node_tree.nodes:
            if node.name==key:
                roughness_exist = True
            if not roughness_exist: continue
            principled_bsdf=material.node_tree.nodes[key]
            ob["cp_roughness"] = principled_bsdf.inputs['Roughness'].default_value

Files required to run the code

No response

Expected behavior

'Principled BSDF' always exist

BlenderProc version

v2.7.1

Griperis commented 1 month ago

We are currently interested and are starting to work on porting Blenderproc to Blender 4.1 as we need it for other features.

However IMO the Principled BSDF doesn't have to exist in Blender 4.1 either, as you can have node setup without it. For example my super arbitrary node setup:

image

Your script will fail on the second to last line anyway.