Compositor

Compositor node groups for post-processing renders: outlines, illustrative shading and masks from AOV passes

Composite Depth Fog

nodes.compositor.CompositeDepthFog(
    image=None,
    depth=0.0,
    near=0.0,
    far=100.0,
    front_fog=1.0,
    back_fog=1.0,
    fog_color=None,
)

Linear depth fog after Goodsell’s Illustrate: the image is blended towards Fog Color by a factor that runs from Front Fog at Near to Back Fog at Far (1 is no fog, 0 is fully fogged). Expects straight alpha and keeps the image alpha

GUI reference: Composite Depth Fog.

Parameters

Name Type Description Default
image InputColor Image to fog, with straight alpha None
depth InputFloat Depth pass from the Render Layers node, in world units 0.0
near InputFloat Depth, in world units, of the front of the structure where the fog factor is Front Fog. canvas.compositor.illustrate() sets it from the scene bounds 0.0
far InputFloat Depth, in world units, of the back of the structure where the fog factor is Back Fog 100.0
front_fog InputFloat Fog factor at Near: 1 keeps the image colour, 0 is fully fogged 1.0
back_fog InputFloat Fog factor at Far: 1 keeps the image colour, 0 is fully fogged 1.0
fog_color InputColor Colour the image fades towards None

Inputs

Name Type Description
i.image ColorSocket Image to fog, with straight alpha
i.depth FloatSocket Depth pass from the Render Layers node, in world units
i.near FloatSocket Depth, in world units, of the front of the structure where the fog factor is Front Fog. canvas.compositor.illustrate() sets it from the scene bounds
i.far FloatSocket Depth, in world units, of the back of the structure where the fog factor is Back Fog
i.front_fog FloatSocket Fog factor at Near: 1 keeps the image colour, 0 is fully fogged
i.back_fog FloatSocket Fog factor at Far: 1 keeps the image colour, 0 is fully fogged
i.fog_color ColorSocket Colour the image fades towards

Outputs

Name Type Description
o.image ColorSocket Image

Cone Shadow

nodes.compositor.ConeShadow(
    depth=0.0,
    pixel_radius=50.0,
    pixel_size=0.1,
    angle=0.4363323,
    threshold=2.0,
    shadow_strength=1.0,
    shadow_max=0.3,
)

Conical soft shadow from the Depth pass alone, after David Goodsell’s Illustrate: each pixel is darkened by the surrounding pixels that are closer to the camera by more than a gap that grows with their distance, so form comes from occlusion rather than lighting. 32 samples: 8 directions on 4 rings up to Radius

GUI reference: Cone Shadow.

Parameters

Name Type Description Default
depth InputFloat Depth pass from the Render Layers node, in world units 0.0
pixel_radius InputFloat Radius of the sampled neighbourhood in pixels; the four rings of samples sit at a quarter, half, three quarters and the full radius 50.0
pixel_size InputFloat Width of one pixel in world units at the structure, like the depth pass, which relates screen distance to depth for the cone test. canvas.compositor.illustrate() sets it from the camera 0.1
angle InputFloat Tightness of the shadow cone: a sample casts shadow only when it is closer to the camera by more than its screen distance times this slope. Higher values keep shadows local to crevices 0.4363323
threshold InputFloat Smallest depth gap, in Nanometres, that casts a shadow; removes speckle in tight crevices 2.0
shadow_strength InputFloat Darkening when every sample occludes the pixel; the shadow per sample is this divided by the 32 samples 1.0
shadow_max InputFloat The shadow factor never drops below this value, so occluded pixels keep some of their colour instead of going black 0.3

Inputs

Name Type Description
i.depth FloatSocket Depth pass from the Render Layers node, in world units
i.pixel_radius FloatSocket Radius of the sampled neighbourhood in pixels; the four rings of samples sit at a quarter, half, three quarters and the full radius
i.pixel_size FloatSocket Width of one pixel in world units at the structure, like the depth pass, which relates screen distance to depth for the cone test. canvas.compositor.illustrate() sets it from the camera
i.angle FloatSocket Tightness of the shadow cone: a sample casts shadow only when it is closer to the camera by more than its screen distance times this slope. Higher values keep shadows local to crevices
i.threshold FloatSocket Smallest depth gap, in Nanometres, that casts a shadow; removes speckle in tight crevices
i.shadow_strength FloatSocket Darkening when every sample occludes the pixel; the shadow per sample is this divided by the 32 samples
i.shadow_max FloatSocket The shadow factor never drops below this value, so occluded pixels keep some of their colour instead of going black

Outputs

Name Type Description
o.shadow FloatSocket Shadow

Depth Outline

nodes.compositor.DepthOutline(
    depth=0.0,
    method='Sobel',
    size=1,
    threshold=6.0,
    low=0.3,
    high=1.0,
    min_diff=0.0,
    max_diff=0.5,
    smooth=True,
    normals=False,
    normals_pass=None,
    normals_threshold=3.0,
)

Line mask from the Depth pass, by one of two methods: Sobel, a thresholded Sobel edge detector on depth, or Goodsell, Illustrate’s 3x3 Laplacian with each neighbour’s step clamped to [Min Diff, Max Diff] and ramped from Low to High into a soft opacity. Optionally adds lines where the normal changes sharply; the lines are anti-aliased and thickened to Size pixels

GUI reference: Depth Outline.

Parameters

Name Type Description Default
depth InputFloat Depth pass from the Render Layers node, in world units 0.0
method InputMenu | Literal['Sobel', 'Goodsell'] Sobel draws hard lines wherever the depth gradient passes Threshold; Goodsell draws soft lines on the nearer side of each depth step, weighted by the size of the step, as in Illustrate 'Sobel'
size InputInteger Line thickness in pixels 1
threshold InputFloat Depth gradient, in world units like the depth pass, above which a line is drawn, for the Sobel method 6.0
low InputFloat Weighted sum of the clamped depth steps, in world units, at which a line starts to appear 0.3
high InputFloat Weighted sum of the clamped depth steps, in world units, at which a line is fully opaque. A narrower range from Low gives harder lines 1.0
min_diff InputFloat Smallest depth step between neighbouring pixels, in world units, that contributes to a line 0.0
max_diff InputFloat Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features 0.5
smooth InputBoolean Average the opacity over the 3x3 neighbourhood where at least six of its nine pixels carry line signal, softening jagged lines True
normals InputBoolean Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth False
normals_pass InputVector Normal pass from the Render Layers node None
normals_threshold InputFloat Change in normal between neighbouring pixels above which a line is drawn, when Normals is enabled 3.0

Inputs

Name Type Description
i.depth FloatSocket Depth pass from the Render Layers node, in world units
i.method MenuSocket Sobel draws hard lines wherever the depth gradient passes Threshold; Goodsell draws soft lines on the nearer side of each depth step, weighted by the size of the step, as in Illustrate
i.size IntegerSocket Line thickness in pixels
i.threshold FloatSocket Depth gradient, in world units like the depth pass, above which a line is drawn, for the Sobel method
i.low FloatSocket Weighted sum of the clamped depth steps, in world units, at which a line starts to appear
i.high FloatSocket Weighted sum of the clamped depth steps, in world units, at which a line is fully opaque. A narrower range from Low gives harder lines
i.min_diff FloatSocket Smallest depth step between neighbouring pixels, in world units, that contributes to a line
i.max_diff FloatSocket Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features
i.smooth BooleanSocket Average the opacity over the 3x3 neighbourhood where at least six of its nine pixels carry line signal, softening jagged lines
i.normals BooleanSocket Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth
i.normals_pass VectorSocket Normal pass from the Render Layers node
i.normals_threshold FloatSocket Change in normal between neighbouring pixels above which a line is drawn, when Normals is enabled

Outputs

Name Type Description
o.mask FloatSocket Mask

ID Outline

nodes.compositor.IDOutline(id=0.0, min_difference=0.5, low=3.0, high=10.0)

Outline opacity between regions of an ID pass after Goodsell’s Illustrate: counts, over the 5x5 neighbourhood, the pixels whose ID differs from the centre by more than Min Difference and ramps the count from Low to High into an opacity. Feed it a float AOV such as chain_id or res_id (canvas.add_aov and mn.material.add_aov) for chain or residue outlines

GUI reference: ID Outline.

Parameters

Name Type Description Default
id InputFloat A float pass identifying regions, such as a chain_id or res_id AOV from the Render Layers node. Use small IDs: the render’s pixel filter blends IDs along edges, so a large gap between neighbours draws a heavier line 0.0
min_difference InputFloat Difference in ID above which two pixels belong to different regions. 0.5 separates integer IDs; raise it to outline every few residues of a res_id pass instead of each one 0.5
low InputFloat Number of differing neighbours, of 24, at which the line starts to appear 3.0
high InputFloat Number of differing neighbours, of 24, at which the line is fully opaque 10.0

Inputs

Name Type Description
i.id FloatSocket A float pass identifying regions, such as a chain_id or res_id AOV from the Render Layers node. Use small IDs: the render’s pixel filter blends IDs along edges, so a large gap between neighbours draws a heavier line
i.min_difference FloatSocket Difference in ID above which two pixels belong to different regions. 0.5 separates integer IDs; raise it to outline every few residues of a res_id pass instead of each one
i.low FloatSocket Number of differing neighbours, of 24, at which the line starts to appear
i.high FloatSocket Number of differing neighbours, of 24, at which the line is fully opaque

Outputs

Name Type Description
o.opacity FloatSocket Opacity

Illustrate

nodes.compositor.Illustrate(
    image=None,
    alpha=1.0,
    depth=0.0,
    normal=None,
    shading=True,
    shadow=None,
    shading_intensity=1.0,
    shading_smoothing='Kuwahara',
    smoothing_size=10.0,
    kuwahara_type='Classic',
    outline=True,
    outline_color=None,
    outline_size=1,
    outline_method='Sobel',
    depth_threshold=1.0,
    outline_low=0.3,
    outline_high=1.0,
    outline_max_diff=0.5,
    outline_smooth=True,
    outline_normals=False,
    outline_normal_threshold=3.0,
    id_outline=False,
    id=0.0,
    id_min_difference=0.5,
    id_low=3.0,
    id_high=10.0,
    background=False,
    background_color=None,
)

Illustrative, flat-shaded composite of the render passes: a base colour shaded by the ambient occlusion or shadow pass, outlines from depth and normals, an optional flat background and a depth fade of the alpha

GUI reference: Illustrate.

Parameters

Name Type Description Default
image InputColor Combined pass from the Render Layers node None
alpha InputFloat Alpha pass from the Render Layers node 1.0
depth InputFloat Depth pass from the Render Layers node, in world units 0.0
normal InputVector Normal pass from the Render Layers node None
shading InputBoolean Darken the base colour by the ambient occlusion or shadow pass True
shadow InputColor Shadow pass from the Render Layers node None
shading_intensity InputFloat How dark the fully occluded or shadowed pixels become 1.0
shading_smoothing InputMenu | Literal['None', 'Kuwahara', 'Blur'] Filter applied to the shading pass before it is used. Kuwahara gives a painterly, flat result; Blur a soft one 'Kuwahara'
smoothing_size InputFloat Size of the smoothing filter in pixels 10.0
kuwahara_type InputMenu | Literal['Classic', 'Anisotropic'] Kuwahara Type 'Classic'
outline InputBoolean Draw lines where the depth or normal changes sharply True
outline_color InputColor Colour of the lines None
outline_size InputInteger Line thickness in pixels 1
outline_method InputMenu | Literal['Sobel', 'Goodsell'] Sobel draws hard lines wherever the depth gradient passes Depth Threshold; Goodsell draws soft lines on the nearer side of each depth step, as in Illustrate 'Sobel'
depth_threshold InputFloat Depth gradient, in world units, above which a line is drawn, for the Sobel method 1.0
outline_low InputFloat Weighted sum of the clamped depth steps, in world units, at which a line starts to appear 0.3
outline_high InputFloat Weighted sum of the clamped depth steps, in world units, at which a line is fully opaque 1.0
outline_max_diff InputFloat Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features 0.5
outline_smooth InputBoolean Average the outline over the 3x3 neighbourhood where most pixels carry line signal True
outline_normals InputBoolean Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth False
outline_normal_threshold InputFloat Change in normal between neighbouring pixels above which a line is drawn, when Outline Normals is enabled 3.0
id_outline InputBoolean Draw lines between the regions of an ID pass, such as chains, in the outline colour False
id InputFloat A float pass identifying regions, such as a chain_id AOV from the Render Layers node. Use small IDs: the render’s pixel filter blends IDs along edges, so a large gap between neighbours draws a heavier line 0.0
id_min_difference InputFloat Difference in ID above which two pixels belong to different regions 0.5
id_low InputFloat Number of differing neighbours, of 24, at which a line starts to appear 3.0
id_high InputFloat Number of differing neighbours, of 24, at which a line is fully opaque 10.0
background InputBoolean Composite the result over a flat background colour False
background_color InputColor Flat colour behind the structure None

Inputs

Name Type Description
i.image ColorSocket Combined pass from the Render Layers node
i.alpha FloatSocket Alpha pass from the Render Layers node
i.depth FloatSocket Depth pass from the Render Layers node, in world units
i.normal VectorSocket Normal pass from the Render Layers node
i.shading BooleanSocket Darken the base colour by the ambient occlusion or shadow pass
i.shadow ColorSocket Shadow pass from the Render Layers node
i.shading_intensity FloatSocket How dark the fully occluded or shadowed pixels become
i.shading_smoothing MenuSocket Filter applied to the shading pass before it is used. Kuwahara gives a painterly, flat result; Blur a soft one
i.smoothing_size FloatSocket Size of the smoothing filter in pixels
i.kuwahara_type MenuSocket Kuwahara Type
i.outline BooleanSocket Draw lines where the depth or normal changes sharply
i.outline_color ColorSocket Colour of the lines
i.outline_size IntegerSocket Line thickness in pixels
i.outline_method MenuSocket Sobel draws hard lines wherever the depth gradient passes Depth Threshold; Goodsell draws soft lines on the nearer side of each depth step, as in Illustrate
i.depth_threshold FloatSocket Depth gradient, in world units, above which a line is drawn, for the Sobel method
i.outline_low FloatSocket Weighted sum of the clamped depth steps, in world units, at which a line starts to appear
i.outline_high FloatSocket Weighted sum of the clamped depth steps, in world units, at which a line is fully opaque
i.outline_max_diff FloatSocket Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features
i.outline_smooth BooleanSocket Average the outline over the 3x3 neighbourhood where most pixels carry line signal
i.outline_normals BooleanSocket Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth
i.outline_normal_threshold FloatSocket Change in normal between neighbouring pixels above which a line is drawn, when Outline Normals is enabled
i.id_outline BooleanSocket Draw lines between the regions of an ID pass, such as chains, in the outline colour
i.id FloatSocket A float pass identifying regions, such as a chain_id AOV from the Render Layers node. Use small IDs: the render’s pixel filter blends IDs along edges, so a large gap between neighbours draws a heavier line
i.id_min_difference FloatSocket Difference in ID above which two pixels belong to different regions
i.id_low FloatSocket Number of differing neighbours, of 24, at which a line starts to appear
i.id_high FloatSocket Number of differing neighbours, of 24, at which a line is fully opaque
i.background BooleanSocket Composite the result over a flat background colour
i.background_color ColorSocket Flat colour behind the structure

Outputs

Name Type Description
o.image ColorSocket Image

Mask Pixels

nodes.compositor.MaskPixels(image=None, mask=1.0)

Split an image by a mask into the pixels inside it and the pixels outside it, each with the rest made transparent, so the two can be processed separately and recombined with Alpha Over

GUI reference: Mask Pixels.

Parameters

Name Type Description Default
image InputColor Image to split None
mask InputFloat Pixels to keep in the Masked output, such as from Value to Mask 1.0

Inputs

Name Type Description
i.image ColorSocket Image to split
i.mask FloatSocket Pixels to keep in the Masked output, such as from Value to Mask

Outputs

Name Type Description
o.masked ColorSocket Masked
o.inverse ColorSocket Inverse

Outline

nodes.compositor.Outline(image=None, mask=0.0, color=None)

Draw a line mask over an image in a flat colour, keeping the lines visible over a transparent background

GUI reference: Outline.

Parameters

Name Type Description Default
image InputColor Image to draw the lines over None
mask InputFloat Where to draw lines, such as the output of Composite Outline Mask 0.0
color InputColor Colour of the lines None

Inputs

Name Type Description
i.image ColorSocket Image to draw the lines over
i.mask FloatSocket Where to draw lines, such as the output of Composite Outline Mask
i.color ColorSocket Colour of the lines

Outputs

Name Type Description
o.image ColorSocket Image

Value to Mask

nodes.compositor.ValueToMask(value=0.0, target=0.0, epsilon=0.01)

Mask of the pixels where a float pass, such as an AOV written by a material, matches a value within a tolerance

GUI reference: Value to Mask.

Parameters

Name Type Description Default
value InputFloat A float pass, such as an AOV written by a material from an attribute like chain_id 0.0
target InputFloat The value to select from the pass 0.0
epsilon InputFloat Tolerance around Target that still counts as a match 0.01

Inputs

Name Type Description
i.value FloatSocket A float pass, such as an AOV written by a material from an attribute like chain_id
i.target FloatSocket The value to select from the pass
i.epsilon FloatSocket Tolerance around Target that still counts as a match

Outputs

Name Type Description
o.mask FloatSocket Mask
o.inverse FloatSocket Inverse