2
$\begingroup$

I am writing a script for compositing, which requires that the Render Layers node has the Shadow Catcher output (see image below).

enter image description here

This can be done with the GUI by going into the View Layer and toggling on the Shadow Catcher Pass, as such: enter image description here

Unfortunately, I cannot find a way to do this using script. In fact, the ViewLayer class doesn't seem to have a property for this, but does have it for other passes (e.g. use_pass_combined).

Any help would be appreciated!

$\endgroup$

1 Answer 1

3
$\begingroup$

This parameter is actually contained in the bpy.types.ViewLayer.cycles property.

If you enable python tooltips and hover over the field you'll see this.

enter image description here

Notice the second line which states CyclesRenderLayerSettings.use_pass_shadow_catcher. A quick search in the docs gives us the only place where this class is used.

The docs don't explain what's inside it but you can always try print(dir(bpy.context.view_layer.cycles)) to get an insight into what you can call exactly from this object.

['__annotations__', '__dict__', '__doc__', '__module__', '__weakref__', 'bl_rna', 'denoising_store_passes', 'name', 'pass_debug_sample_count', 'register', 'rna_type', 'unregister', 'use_denoising', 'use_pass_shadow_catcher', 'use_pass_volume_direct', 'use_pass_volume_indirect']

This gives us :

import bpy

bpy.context.view_layer.cycles.use_pass_shadow_catcher = True
$\endgroup$
1
  • $\begingroup$ Perfect! Thanks for the detailed answer. $\endgroup$
    – Tal Taiber
    Jun 2, 2022 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .