From cadd2cfb222348e088c1be24f45c91b533ab9a07 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Wed, 24 Mar 2021 10:35:27 +0000 Subject: [PATCH 1/3] Fixed image formatting --- .../Documentation~/Motion-Vectors.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md index f7067d9f847..c8115a9f083 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md @@ -15,8 +15,7 @@ In the Inspector for your HDRP Asset, navigate to the **Rendering** section and HDRP calculates motion vectors in two stages: -1. HDRP first calculates object motion vectors. To make a Mesh Renderer write object motion vectors, in its Inspector, go to **Additional Settings** and select **Per Object Motion** from the **Motion Vectors** drop-down. HDRP now calculates object motion vectors for this Mesh Renderer, if you enable **Object Motion Vectors** in the Frame Settings. -![](Images/MotionVectors1.png) +1. HDRP first calculates object motion vectors. To make a Mesh Renderer write object motion vectors, in its Inspector, go to **Additional Settings** and select **Per Object Motion** from the **Motion Vectors** drop-down. HDRP now calculates object motion vectors for this Mesh Renderer, if you enable **Object Motion Vectors** in the Frame Settings.
![](Images/MotionVectors1.png) 2. HDRP then calculates Camera motion vectors, which are caused by the movement of the Camera. This is for pixels that did not write motion vectors during the first stage. To make HDRP calculate Camera motion vectors for a Mesh Renderer, in the Inspector for the Mesh Renderer, go to **Additional Settings** and select **Camera Motion Only** from the **Motion Vectors** drop-down. If you do not want HDRP to calculate motion vectors for a Mesh Renderer at all, in the Inspector for the Mesh Renderer, go to **Additional Settings** and select **Force No Motion** from the **Motion Vectors** drop-down. From fd2344a3712d770355078272963a9466719e6b33 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Wed, 24 Mar 2021 12:32:54 +0000 Subject: [PATCH 2/3] Attempted to reorder information to make it clearer --- .../Documentation~/Images/MotionVectors2.png | 3 -- .../Documentation~/Motion-Vectors.md | 35 +++++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Images/MotionVectors2.png diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/MotionVectors2.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/MotionVectors2.png deleted file mode 100644 index f09884a7516..00000000000 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/MotionVectors2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7042a3f31bec9f6665776ff8afb9ac8167eafc76bc16ed81cfffc1ad6db4b66c -size 36555 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md index c8115a9f083..111967125a5 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md @@ -4,32 +4,37 @@ Motion vectors capture the per-pixel, screen-space motion of GameObjects from on HDRP uses motion vectors for various effects such as [temporal anti-aliasing (TAA)](Glossary.md#TemporalAntiAliasing) and motion blur. -## Using motion vectors +HDRP calculates motion vectors in two stages: -To use motion vectors in HDRP, you must enable them: +1. HDRP first calculates object motion vectors. Object motion vectors are motion vectors that HDRP calculates based on the screen-space movement of GameObjects. +2. HDRP then calculates camera motion vectors. These are motion vectors caused by the movement of the Camera. HDRP calculates camera motion vectors for pixels that did not write motion vectors during the first stage. -1. In your Unity Project’s [HDRP Asset](HDRP-Asset.md) -2. In your [Frame Settings](Frame-Settings.md) +## Using motion vectors -In the Inspector for your HDRP Asset, navigate to the **Rendering** section and enable the **Motion Vectors** checkbox. You can then either enable motion vectors for all Cameras or on an individual, per-Camera level. To enable motion vectors for all Cameras, navigate to **Default Frame Settings For > Rendering** and enable the **Motion Vectors** checkbox. This enables Camera motion vectors. Now you can also enable the **Object Motion Vectors** checkbox. If you do this, HDRP calculates object motion vectors. If you keep this checkbox disabled, HDRP only calculates Camera motion vectors. +To use motion vectors in HDRP, you must first enable them: -HDRP calculates motion vectors in two stages: +1. In your Unity Project’s [HDRP Asset](HDRP-Asset.md): + 1. Select the HDRP Asset and view it in the Inspector window. + 2. Go to the **Rendering** section and enable **Motion Vectors**. +2. In [Frame Settings](Frame-Settings.md). You can either enable motion vectors for all Cameras or on an individual, per-Camera level. + 1. To enable motion vectors for all Cameras, open the [HDRP Default Settings](Default-Settings-Window.md) Project Settings tab (menu: **Edit** > **Project Settings** > **HDRP Default Settings**), then set **Default Frame Settings For** to **Camera**. To enable motion vectors for a particular Camera, select the Camera and, in the Inspector, enable **Custom Frame Settings**. + 3. In the **Rendering Section**, enable **Motion Vectors**. This enables camera motion vectors. + 3. To enable motion vectors for opaque GameObjects, enable **Opaque Object Motion**. To enable motion vectors for transparent GameObjects, enable **Transparent Object Motion**. -1. HDRP first calculates object motion vectors. To make a Mesh Renderer write object motion vectors, in its Inspector, go to **Additional Settings** and select **Per Object Motion** from the **Motion Vectors** drop-down. HDRP now calculates object motion vectors for this Mesh Renderer, if you enable **Object Motion Vectors** in the Frame Settings.
![](Images/MotionVectors1.png) -2. HDRP then calculates Camera motion vectors, which are caused by the movement of the Camera. This is for pixels that did not write motion vectors during the first stage. To make HDRP calculate Camera motion vectors for a Mesh Renderer, in the Inspector for the Mesh Renderer, go to **Additional Settings** and select **Camera Motion Only** from the **Motion Vectors** drop-down. -If you do not want HDRP to calculate motion vectors for a Mesh Renderer at all, in the Inspector for the Mesh Renderer, go to **Additional Settings** and select **Force No Motion** from the **Motion Vectors** drop-down. +HDRP can now render motion vectors. If you enabled object motion vectors, be aware that, by default, new Mesh Renderers write object motion vectors. To change this behavior, select the Mesh Renderer and, in the Inspector, change the value of the **Motion Vectors** property.
![](Images/MotionVectors1.png) +The options are: + +* **Camera Motion Only**: HDRP only calculates camera motion vectors for the area of the screen this GameObject fills. +* **Per Object Motion**: HDRP calculates object motion vectors for this GameObject. +* **Force No Motion**: HDRP does not calculate any motion vectors for the area of the screen this GameObject fills. ## Motion vectors for transparent objects By default, HDRP does not render motion vectors for transparent Materials. This is because motion vectors from transparent GameObjects overwrite motion vectors for GameObjects behind them. For example, a window would overwrite the motion vectors for a bird flying behind it. -To make HDRP render motion vectors for transparent Materials: - -1. In the Inspector for your HDRP Asset, go to **Default Frame Settings For > Rendering** and enable the **Transparent Writes Motion Vectors** checkbox. -2. In the Inspector for your transparent Material, go to **Surface Options** and enable the **Transparent Writes Motion Vectors** checkbox. - -![](Images/MotionVectors2.png) +To make HDRP render motion vectors for transparent Materials, see the steps in [Using motion vectors](#using-motion-vectors) and enable **Transparent Object Motion**. When transparent objects write motion vectors on a given pixel, they replace that pixel’s previous motion vectors. This is particularly useful for Materials that use alpha clipping, such as hair. + If you use motion blur in conjunction with transparent GameObjects, be aware that motion blur also uses depth information. This means that you should make the Material write depth information too. To do this, go to **Surface Options** and enable the **Transparent Depth Postpass** checkbox. From 8dbb40f2bde14cf9a64d8b50a76eea076c2558eb Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Wed, 24 Mar 2021 15:20:13 +0000 Subject: [PATCH 3/3] Added a more explicit note for object motion vectors --- .../Documentation~/Motion-Vectors.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md index 111967125a5..59b4d0f9032 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Motion-Vectors.md @@ -26,7 +26,10 @@ HDRP can now render motion vectors. If you enabled object motion vectors, be awa The options are: * **Camera Motion Only**: HDRP only calculates camera motion vectors for the area of the screen this GameObject fills. -* **Per Object Motion**: HDRP calculates object motion vectors for this GameObject. +* **Per Object Motion**: HDRP calculates motion vectors for this GameObject if: + * The GameObject moves and the camera does not. + * The camera moves and the GamaObject does not. + * Both the GameObject and the camera move. * **Force No Motion**: HDRP does not calculate any motion vectors for the area of the screen this GameObject fills. ## Motion vectors for transparent objects