Compositor
Compositor node groups for post-processing renders: outlines, illustrative shading and masks from AOV passes
Composite Depth Fog
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
Illustrate’s atmospheric perspective: the Image is blended towards Fog Color by a factor that runs from Front Fog at Near to Back Fog at Far (1 keeps the colour, 0 is fully fogged). Expects straight alpha and keeps the image alpha. Place it after Illustrate for fogged, flat-shaded renders.
Inputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
Image to fog, with straight alpha |
| Depth | Float |
Depth pass from the Render Layers node, in world units |
| Near | Float |
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 |
| Far | Float |
Depth, in world units, of the back of the structure where the fog factor is Back Fog |
| Front Fog | Float |
Fog factor at Near: 1 keeps the image colour, 0 is fully fogged |
| Back Fog | Float |
Fog factor at Far: 1 keeps the image colour, 0 is fully fogged |
| Fog Color | Color |
Colour the image fades towards |
Outputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
API Reference: nodes.compositor.CompositeDepthFog
Cone Shadow
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
Illustrate’s screen-space ambient occlusion from the Depth pass alone. 32 samples (8 directions on 4 rings up to Pixel Radius pixels) each cast shadow on the pixel when they are closer to the camera by more than the larger of Threshold and their screen distance times Angle (with Pixel Size relating pixels to depth); the output Shadow starts at 1, drops with every occluding sample and never goes below Shadow Max. Feed it to the Shadow input of Illustrate; canvas.compositor.illustrate(shading="cone") does this and sets Pixel Size from the camera.
Inputs
| Name | Type | Description |
|---|---|---|
| Depth | Float |
Depth pass from the Render Layers node, in world units |
| Pixel Radius | Float |
Radius of the sampled neighbourhood in pixels; the four rings of samples sit at a quarter, half, three quarters and the full radius |
| Pixel Size | Float |
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 |
| Angle | Float |
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 |
| Threshold | Float |
Smallest depth gap, in Nanometres, that casts a shadow; removes speckle in tight crevices |
| Shadow Strength | Float |
Darkening when every sample occludes the pixel; the shadow per sample is this divided by the 32 samples |
| Shadow Max | Float |
The shadow factor never drops below this value, so occluded pixels keep some of their colour instead of going black |
Outputs
| Name | Type | Description |
|---|---|---|
| Shadow | Float |
API Reference: nodes.compositor.ConeShadow
Depth Outline
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
Line mask from the Depth pass by one of two methods, picked with Method. Sobel draws hard lines wherever the Sobel gradient of the depth passes Threshold. Goodsell follows Illustrate: each of the eight neighbours contributes how much farther it is than the centre, clamped to [Min Diff, Max Diff] and weighted 1.0 on the edges and 0.8 on the corners, and the sum is ramped from Low to High into a soft opacity, optionally smoothed (Smooth), so lines land on the nearer side of each depth step and their weight follows its size. Distances are in world units, like the depth pass. The Normals panel adds lines from the Normals Pass to catch creases between surfaces at the same depth; either way the lines are anti-aliased and thickened to Size pixels. Unlike the shader Outline Mask, lines are drawn between separate objects and over transparent backgrounds; draw them with Outline.
Inputs
| Name | Type | Description |
|---|---|---|
| Depth | Float |
Depth pass from the Render Layers node, in world units |
| Method | Menu |
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 |
| Size | Int |
Line thickness in pixels |
| Threshold | Float |
Depth gradient, in world units like the depth pass, above which a line is drawn, for the Sobel method |
| Low | Float |
Weighted sum of the clamped depth steps, in world units, at which a line starts to appear |
| High | Float |
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 |
| Min Diff | Float |
Smallest depth step between neighbouring pixels, in world units, that contributes to a line |
| Max Diff | Float |
Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features |
| Smooth | Bool |
Average the opacity over the 3x3 neighbourhood where at least six of its nine pixels carry line signal, softening jagged lines |
| Normals | Bool |
Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth |
| Normals Pass | Vector |
Normal pass from the Render Layers node |
| Normals Threshold | Float |
Change in normal between neighbouring pixels above which a line is drawn, when Normals is enabled |
Outputs
| Name | Type | Description |
|---|---|---|
| Mask | Float |
API Reference: nodes.compositor.DepthOutline
ID Outline
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
Illustrate’s chain and residue outlines: 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("chain_id"), mn.material.add_aov(material, "chain_id", offset=1.0)) and draw it with Outline.
Inputs
| Name | Type | Description |
|---|---|---|
| ID | Float |
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 |
| Min Difference | Float |
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 |
| Low | Float |
Number of differing neighbours, of 24, at which the line starts to appear |
| High | Float |
Number of differing neighbours, of 24, at which the line is fully opaque |
Outputs
| Name | Type | Description |
|---|---|---|
| Opacity | Float |
API Reference: nodes.compositor.IDOutline
Illustrate
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
Flat, illustrative composite of the render passes, wired straight from the Render Layers node. The Shading panel darkens the Image by the smoothed Shadow input (Kuwahara for a painterly look, Blur for a soft one), which takes the Ambient Occlusion or Shadow pass, or the output of Cone Shadow for shading from the depth pass alone; the Outline panel draws lines from Depth Outline with Outline, by its Sobel or Goodsell method; the Background panel composites over a flat colour. From Python, canvas.compositor.illustrate() enables the passes, adds the shading source and inserts the node in one call.
Inputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
Combined pass from the Render Layers node |
| Alpha | Float |
Alpha pass from the Render Layers node |
| Depth | Float |
Depth pass from the Render Layers node, in world units |
| Normal | Vector |
Normal pass from the Render Layers node |
| Shading | Bool |
Darken the base colour by the ambient occlusion or shadow pass |
| Shadow | Color |
Shadow pass from the Render Layers node |
| Shading Intensity | Float |
How dark the fully occluded or shadowed pixels become |
| Shading Smoothing | Menu |
Filter applied to the shading pass before it is used. Kuwahara gives a painterly, flat result; Blur a soft one |
| Smoothing Size | Float |
Size of the smoothing filter in pixels |
| Kuwahara Type | Menu |
|
| Outline | Bool |
Draw lines where the depth or normal changes sharply |
| Outline Color | Color |
Colour of the lines |
| Outline Size | Int |
Line thickness in pixels |
| Outline Method | Menu |
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 |
| Depth Threshold | Float |
Depth gradient, in world units, above which a line is drawn, for the Sobel method |
| Outline Low | Float |
Weighted sum of the clamped depth steps, in world units, at which a line starts to appear |
| Outline High | Float |
Weighted sum of the clamped depth steps, in world units, at which a line is fully opaque |
| Outline Max Diff | Float |
Depth steps larger than this, in world units, count as this much; a wider range emphasises larger features |
| Outline Smooth | Bool |
Average the outline over the 3x3 neighbourhood where most pixels carry line signal |
| Outline Normals | Bool |
Also draw lines where the surface normal changes sharply, catching creases between surfaces at the same depth |
| Outline Normal Threshold | Float |
Change in normal between neighbouring pixels above which a line is drawn, when Outline Normals is enabled |
| ID Outline | Bool |
Draw lines between the regions of an ID pass, such as chains, in the outline colour |
| ID | Float |
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 |
| ID Min Difference | Float |
Difference in ID above which two pixels belong to different regions |
| ID Low | Float |
Number of differing neighbours, of 24, at which a line starts to appear |
| ID High | Float |
Number of differing neighbours, of 24, at which a line is fully opaque |
| Background | Bool |
Composite the result over a flat background colour |
| Background Color | Color |
Flat colour behind the structure |
Outputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
API Reference: nodes.compositor.Illustrate
Mask Pixels
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
Splits an Image by a Mask into the pixels inside it (Masked) and outside it (Inverse), each with the rest made transparent, so the two can be filtered separately and recombined with an Alpha Over node.
Inputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
Image to split |
| Mask | Float |
Pixels to keep in the Masked output, such as from Value to Mask |
Outputs
| Name | Type | Description |
|---|---|---|
| Masked | Color |
|
| Inverse | Color |
API Reference: nodes.compositor.MaskPixels
Outline
Draw a line mask over an image in a flat colour, keeping the lines visible over a transparent background
Draws a Mask over an Image in Color. The alpha is set once, deliberately, to the larger of the line coverage and the image alpha, so lines survive on transparent backgrounds.
Inputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
Image to draw the lines over |
| Mask | Float |
Where to draw lines, such as the output of Composite Outline Mask |
| Color | Color |
Colour of the lines |
Outputs
| Name | Type | Description |
|---|---|---|
| Image | Color |
API Reference: nodes.compositor.Outline
Value to Mask
Mask of the pixels where a float pass, such as an AOV written by a material, matches a value within a tolerance
Compares a float pass against Target within Epsilon and outputs the matching pixels as Mask and the rest as Inverse. Meant for AOV passes written by a material from an attribute such as chain_id (canvas.add_aov("chain_id") and mn.material.add_aov(material, "chain_id")), so one chain can be recoloured, outlined or left untouched in the compositor.
Inputs
| Name | Type | Description |
|---|---|---|
| Value | Float |
A float pass, such as an AOV written by a material from an attribute like chain_id |
| Target | Float |
The value to select from the pass |
| Epsilon | Float |
Tolerance around Target that still counts as a match |
Outputs
| Name | Type | Description |
|---|---|---|
| Mask | Float |
|
| Inverse | Float |
API Reference: nodes.compositor.ValueToMask