0
$\begingroup$

I am trying to render few specific frames through python, both depth and colour images. Script is given below. Output images of depth are correct but rgb images are black and white. What could be the reason, how can I fix it?

enter image description here .

render_layers = nodes.new('CompositorNodeRLayers')
output_file_rgb = nodes.new("CompositorNodeOutputFile")
output_file_depth= nodes.new("CompositorNodeOutputFile")
normalizer=nodes.new("CompositorNodeNormalize")
viewer = nodes.new('CompositorNodeViewer')   

scene.node_tree.links.new(  
    render_layers.outputs['Image'],
    output_file_rgb.inputs['Image']
    )
scene.node_tree.links.new(
    render_layers.outputs['Z'],
    normalizer.inputs['Value']
    )
scene.node_tree.links.new(
    normalizer.outputs['Value'],
    output_file_depth.inputs['Image']
    )
scene.node_tree.links.new(  
    normalizer.outputs['Value'],
    viewer.inputs['Image']
    )

.
.
.

for f in frame_numbers:
     scene.frame_set( f )
     scene.update()
     output_file_depth.base_path = "D:/dep/"
     output_file_depth.file_slots[0].path="Imagede"
     output_file_rgb.base_path = "D:/rgb/"
     output_file_rgb.file_slots[0].path="Imagergb"     
     bpy.ops.render.render(write_still=True)
$\endgroup$
1
$\begingroup$

It was because the textures are not imported. If you are importing models, make sure that textures are also imported before rendering

$\endgroup$
-1
$\begingroup$

Try this

bpy.ops.render.render(write_still=True) -> bpy.ops.render.opengl(write_still=True)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.