Visual Compositor User Documentation
Introduction
Visual Compositor provides a node based graph editor to
combine multiple sources into a single output image.
The graph is used to construct rendering sources and flow, in order to output layers,
which are then stacked together using blending options to produce the final image.
Dependencies
Selection Groups
Used to group GameObjects and render particular groups.
This allows for more flexibility than the
layer system, which is limited to 31 unique layers.
Please see the
user documentation)
for more details on Selection Groups.
Streaming Image Sequence
Used to play sequential image sequences in order to apply post-processing on them.
Timeline
Used to animate the parameters of Visual Compositor nodes.
Supported Unity Versions
Unity 2019.4 or higher.
Quick Start
This figure shows the scene that we will use for this guide.
Note the Selection Groups window, and the created groups for the shapes, ground and lights.Create a Compositor Graph asset, by right clicking in the project window and choosing Create > VisualCompositor > Compositor Graph. This creates an asset in our project which stores the graph that we will construct in the following steps.
Create an empty GameObject, and add the VisualCompositor component.
A camera component to display the final output image will be automatically added to the GameObject.Drag the asset we created in step 2 to the Compositor Graph Asset slot on the VisualCompositor created in step 3.
Open Window > Rendering > Visual Compositor.
As this window uses a lot of screen area, we recommend to dock this window behind the scene view.By default, the output of VisualCompositor will be displayed in Display 8.
We can set the existing Game view to show Display 8, or add a new Game view in the Editor to view the output.When we select the VisualCompositor GameObject created in step 3, the Visual Compositor window will load the graph in that component, and will automatically create default nodes for newly created graphs.
See the Visual Compositor window documentation for more details on using this window.Make sure that the graph is built as shown in the following figure.
Using Selection Group nodes in combination with Render nodes allow us to render specific objects with specific lights.
In the next figure, there are three Selection Group nodes, with a Union node being used to combine two groups into one group.Add a Drawn Edges node for extracting edges from the Render node, and a Layer node for compositing over the first layer.
Please refer to the next figure for node setting details.- Connect the outputs of the Render node to the corresponding inputs of the Drawn Edges node.
- Connect the output of the Drawn Edges node to the input of the new Layer node, and set the blend mode is multiply.
The final image is now a composite of the two layers.