Skip to content

Rename Compositor to Graphics Compositor #950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compositor (Preview)
# Graphics Compositor (Preview)

The Compositor allows for real-time compositing operations between Unity's High Definition Render Pipeline (HDRP) and external media sources, such as videos or images. Depending on the requirements for your application, the Compositor provides multiple composition techniques. You can use each technique independently or use more than one at the same time to create a combination of different types of composition operations. The techniques that the Compositor includes are:
The Graphics Compositor allows for real-time compositing operations between Unity's High Definition Render Pipeline (HDRP) and external media sources, such as videos or images. Depending on the requirements for your application, the Graphics Compositor provides multiple composition techniques. You can use each technique independently or use more than one at the same time to create a combination of different types of composition operations. The techniques that the Graphics Compositor includes are:
- **Camera Stacking:** Allows you to render multiple [HDRP Cameras](HDRP-Camera.md) to the same render target.
- **Graph-Based Composition:** Allows you to use arbitrary mathematical operations to combine multiple Composition Layers to generate the final frame.
- **3D Composition:** Allows you to use Composition Layers as 3D surfaces in a Unity Scene. This means that, for example, Unity can calculate reflections and refractions between different Composition Layers and GameObjects.
Expand All @@ -15,13 +15,13 @@ The following table provides a high level overview of the advantages and disadva

[*] *Feature Coverage* indicates whether features such as [screen-space reflections](Override-Screen-Space-Reflection.md), transparencies or refractions can work between layers.

Furthermore, the Compositor includes functionality such as *"localized post-processing"*, where a Post-Processing Volume only affects certain GameObjects in the Scene.
Furthermore, the Graphics Compositor includes functionality such as *"localized post-processing"*, where a Post-Processing Volume only affects certain GameObjects in the Scene.

For a high level overview of the Compositor's functionality please refer to the [User Guide](Compositor-User-Guide) section. For a description on specific options in the user interface, please refer to the [User Options](Compositor-User-Options) section.
For a high level overview of the Graphics Compositor's functionality please refer to the [User Guide](Compositor-User-Guide) section. For a description on specific options in the user interface, please refer to the [User Options](Compositor-User-Options) section.

## Composition example

The following example uses the Compositor to render a watermark on top of a Unity Scene.
The following example uses the Graphics Compositor to render a watermark on top of a Unity Scene.
![](Images/Compositor-HDRPTemplateWithLogo.png)

*The result.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Using the Compositor
To open the Compositor window in the Unity Editor, select **Window > Render Pipeline > HD Render Pipeline Compositor** from the menu. From this window, you can control the Compositor configuration. The first time you open the Compositor window, it automatically uses a default *"pass-through"* composition profile that forwards the output of the main [Camera](HDRP-Camera.md) to the final composed frame. You can edit this profile or you can load another one from disk. For information on the properties in the Compositor window, see [Compositor window](Compositor-User-Options.md).
# Using the Graphics Compositor
To open the Graphics Compositor window in the Unity Editor, select **Window > Render Pipeline > Graphics Compositor** from the menu. From this window, you can control the Graphics Compositor configuration. The first time you open the Graphics Compositor window, it automatically uses a default *"pass-through"* composition profile that forwards the output of the main [Camera](HDRP-Camera.md) to the final composed frame. You can edit this profile or you can load another one from disk. For information on the properties in the Compositor window, see [Compositor window](Compositor-User-Options.md).


## Layer Types
The HDRP Compositor tool typically handles two types of layers:
The Graphics Compositor tool typically handles two types of layers:
- **Composition Layers**: Which you define in the [Composition Graph](#composition-graph). The Composition Graph defines the number of layers and how to combine them but does not define each layer's content.
- **Sub-layers**: Which you define in the Compositor window, in the [Render Schedule](#render-schedule) section. You use stack Sub-layers to define the content of a Composition Layer.
- **Sub-layers**: Which you define in the Graphics Compositor window, in the [Render Schedule](#render-schedule) section. You use stack Sub-layers to define the content of a Composition Layer.


## Composition Graph
To specify the output image, the Compositor uses a graph of compositing operations. Specifically, the Compositor uses the [Shader Graph](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html) with an [Unlit Master Node](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Unlit-Master-Node.html) as its target. To specify the output image, the Compositor uses the value you connect to the **Color** port. You do not need to connect any other ports on the Master Node.
To specify the output image, the Graphics Compositor uses a graph of compositing operations. Specifically, the Graphics Compositor uses the [Shader Graph](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html) with an [Unlit Master Node](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Unlit-Master-Node.html) as its target. To specify the output image, the Compositor uses the value you connect to the **Color** port. You do not need to connect any other ports on the Master Node.

**Note**: When the output of the composition is to a render target, the Material you create from the Master Node must be double-sided.

When you create a Composition Graph, there are two main types of input property you can expose:
- **Composition Layer**: Any **Texture2D** properties act as Composition Layers which correspond to a layer the graph composites to generate the final frame. These properties appear automatically as Composition Layers in the [Render Schedule](#render-schedule) section of the Compositor window. The **Mode** option for them in Shader Graph corresponds to the default value the Shader uses when you toggle off the visibility of the layer in the Render Schedule list.<br/> **Note**: By default, this value is set to white, but for many compositing operations and behaviors, you may want to set this to black instead.
- **Composition Parameters**: This refers to any exposed property that is not a Texture2D. Composition Parameters can control various aspects of the composition. Examples of Composition Parameters include a Vector1 input to control the overall brightness or a Color input to tint a Texture2D. These properties appear automatically in the [Composition Parameters](#composition-parameters) section of the Compositor window.
- **Composition Layer**: Any **Texture2D** properties act as Composition Layers which correspond to a layer the graph composites to generate the final frame. These properties appear automatically as Composition Layers in the [Render Schedule](#render-schedule) section of the Graphics Compositor window. The **Mode** option for them in Shader Graph corresponds to the default value the Shader uses when you toggle off the visibility of the layer in the Render Schedule list.<br/> **Note**: By default, this value is set to white, but for many compositing operations and behaviors, you may want to set this to black instead.
- **Composition Parameters**: This refers to any exposed property that is not a Texture2D. Composition Parameters can control various aspects of the composition. Examples of Composition Parameters include a Vector1 input to control the overall brightness or a Color input to tint a Texture2D. These properties appear automatically in the [Composition Parameters](#composition-parameters) section of the Graphics Compositor window.

The following graph contains examples of the property types described above. The **Logo** property is an example of a Composition Layer and the **Opacity** property is an example of an input property to control an aspect of the composition:

![](Images/Compositor-CompositorSimpleGraph.png)

Unity saves the Compositor settings in a .asset file with the same name as the Composition Graph. When the Compositor loads a Composition Graph, it also loads the settings from the corresponding Asset file if one exists, otherwise, it creates a new Asset with default settings.
Unity saves the Graphics Compositor properties in a .asset file with the same name as the Composition Graph. When the Graphics Compositor loads a Composition Graph, it also loads the properties from the corresponding Asset file if one exists, otherwise, it creates a new Asset with default settings.

## Adding and removing Composition Layer
To add a new Composition Layer, create a new Texture2D input property in the [Composition Graph](#composition-graph). When you next save the Composition Graph, the new layer appears automatically in the [Render Schedule](#render-schedule) section of the Compositor window. From there, you can control the [layer properties](Compositor-User-Options.md#composition-layer-properties) and specify how to [fill the layer with content](#Sub-layers:-adding-content-to-composition-layers).
To add a new Composition Layer, create a new Texture2D input property in the [Composition Graph](#composition-graph). When you next save the Composition Graph, the new layer appears automatically in the [Render Schedule](#render-schedule) section of the Graphics Compositor window. From there, you can control the [layer properties](Compositor-User-Options.md#composition-layer-properties) and specify how to [fill the layer with content](#Sub-layers:-adding-content-to-composition-layers).

Similarly, to delete a Composition Layer, remove the corresponding Texture 2D property from the [Composition Graph](#composition-graph).

Expand All @@ -39,13 +39,13 @@ To add a Sub-layer to a Composition Layer, select the Composition Layer and clic
To remove a Sub-layer, select the Sub-layer and click the **Delete** button.<br/>**Note**: You can only delete Sub-layers this way and not Composition Layers. Instead, to delete a Composition Layer, remove the corresponding Texture2D property from the Composition Graph.

## Camera Stacking
When you use more than one Sub-layer to specify the content of a Composition Layer, this "stacks" the Sub-layers on top of the same render target. To specify the size and format of the composition, you use the properties of the parent Composition Layer. The Sub-layers inherit the size and format from their parent Composition Layer and you cannot change these properties independently for a particular Sub-layer. This means every stacked Camera/Sub-layer has the same size and format. To change the stacking order, re-arrange the Sub-layers in the [Render Schedule](#render-schedule) section of the Compositor window.
When you use more than one Sub-layer to specify the content of a Composition Layer, this "stacks" the Sub-layers on top of the same render target. To specify the size and format of the composition, you use the properties of the parent Composition Layer. The Sub-layers inherit the size and format from their parent Composition Layer and you cannot change these properties independently for a particular Sub-layer. This means every stacked Camera/Sub-layer has the same size and format. To change the stacking order, re-arrange the Sub-layers in the [Render Schedule](#render-schedule) section of the Graphics Compositor window.

The [Sub-layer Properties](Compositor-User-Options.md#Sub-layer-properties) section controls the type of stacking operation.

## Render Schedule
The Render Schedule is a re-orderable list of Composition Layers and Sub-layers. Sub-layers appear indented below their corresponding parent Composition Layer, which makes it easier to see the hierarchical relationship. When multiple Sub-layers appear below a parent layer, they form a camera stack. Unity renders layers at the top first. To re-order the list, you can click and move both Composition Layers and Sub-layers. You can use this to change the rendering order in a camera stack or move a Sub-layer from one parent Composition Layer to another.

## Composition Parameters
This section shows every exposed property that is not an input Composition Layer (for example, a Vector1 to control the brightness of the final composition or a Color to tint a Texture2D). In this section, the window allows you to edit each property value outside of the Composition Graph. It is good practice to expose properties from the graph to the Compositor window, instead of hard-coding their values. This helps you to share composition profiles between Projects because those you do not need to open the Composition Graph to edit any values.
This section shows every exposed property that is not an input Composition Layer (for example, a Vector1 to control the brightness of the final composition or a Color to tint a Texture2D). In this section, the window allows you to edit each property value outside of the Composition Graph. It is good practice to expose properties from the graph to the Graphics Compositor window, instead of hard-coding their values. This helps you to share composition profiles between Projects because those you do not need to open the Composition Graph to edit any values.

Loading