Skip to content

[Backport 21.2][HDRP] More backport PRs #6559

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 36 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f7f3d44
[HDRP] Fixed taa jitter for after post process materials #6320
adrien-de-tocqueville Nov 26, 2021
7eaa631
[HDRP][Path Tracing] Cleaned up dirtiness handling when using multip…
eturquin Nov 26, 2021
a60fd64
[HDRP] Fix flickering / edge aliasing issue when DoF and TAAU or DLSS…
pmavridis Nov 25, 2021
fb4c126
Update Surface-Type.md (#6384)
sebastienlagarde Nov 24, 2021
1a15c50
[HDRP] Merge HD/bugfix #6387
sebastienlagarde Nov 27, 2021
e5aaf65
Formatting
sebastienlagarde Dec 9, 2021
c7690ec
Update PathTracing.cs
sebastienlagarde Dec 9, 2021
7f9856b
Update PathTracing.cs
sebastienlagarde Dec 9, 2021
d9cb1ee
Fix normal/albedo in AOVs list (#6394)
RemyUnity Nov 26, 2021
02de5c5
Fixed shader graph errors when disabling the bias on texture samplers…
anisunity Nov 25, 2021
20bfe01
Fixed a shader warning in the volumetric clouds combine file. #6410
anisunity Nov 26, 2021
a9123b8
[HDRP] Fix Layer lit shader UI #6441
adrien-de-tocqueville Dec 1, 2021
d766f4f
fixed link to master stack hair (#6446)
emilybrown1 Dec 2, 2021
6b52efc
Fixed error thrown when layered lit material has an invalid material …
adrien-de-tocqueville Dec 3, 2021
e3789ef
Decal docs improvement (#6448)
Vic-Cooper Dec 2, 2021
c3697bd
Small formatting fix for dynamic resolution doc (#6452)
0lento Dec 2, 2021
808ca10
Fixed a null texture error caused by lens flare pass #6454
JulienIgnace-Unity Dec 3, 2021
eefb458
Fixed a nullref when enabling raycount without ray tracing. (#6455)
JulienIgnace-Unity Dec 3, 2021
64fa315
Fixed a render graph error when creating a shader graph (introduced b…
JulienIgnace-Unity Dec 6, 2021
83fc47b
Fix bug #1342803 (#6471)
Vic-Cooper Dec 6, 2021
11b3e63
Distortion Blur from 1 to 0 according to the doc #6478
skhiat Dec 6, 2021
bbb5a1c
Add missing references to area lights in shadow docs (#6482)
FrancescoC-unity Dec 6, 2021
762e216
Fix physical camera UI (#6484)
adrien-de-tocqueville Dec 8, 2021
c27cd6f
Fixed spot light shadows near plane (#6493)
adrien-de-tocqueville Dec 8, 2021
5785277
Enable Transparent Depth Pre/Post Pass for HDRP Hair Shader Graph #6496
johnpars Dec 6, 2021
007b31b
[HDRP] Fix build warnings (#6524)
alelievr Dec 8, 2021
bfa8660
Remove options that are not available with low res transparent. #6481
FrancescoC-unity Dec 9, 2021
ba18a3c
Fix gamma error path (#6527)
alelievr Dec 9, 2021
4fe0e67
Hdrp/rt ps fixes (#6545)
peterjohnlong Dec 9, 2021
a5a3180
[HDRP][Path Tracing] Fixed auto-exposure mistmatch between sky backgr…
eturquin Dec 9, 2021
f8c7b2f
Formatting
sebastienlagarde Dec 9, 2021
9e4976f
fixed typo 'GamaObject' -> 'GameObject' (#6544)
emilybrown1 Dec 9, 2021
3626106
fixed typo 'render' -> 'renders' (#6548)
emilybrown1 Dec 9, 2021
58d5c12
updated how you enable motion blur to mention that it is enabled by d…
emilybrown1 Dec 9, 2021
15701fd
Merge branch '2021.2/staging' into HDRP/more-backport-21.2
sebastienlagarde Dec 9, 2021
24f1fe9
update shots
sebastienlagarde Dec 10, 2021
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ static void DrawerPerspectiveType(ISerializedCamera p, Editor owner)
EditorGUI.BeginChangeCheck();
isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
if (EditorGUI.EndChangeCheck())
{
p.projectionMatrixMode.intValue = isPhysicalCamera ? (int)ProjectionMatrixMode.PhysicalPropertiesBased : (int)ProjectionMatrixMode.Implicit;
s_FovChanged = true;
}
EditorGUILayout.EndHorizontal();
EditorGUI.EndProperty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,15 @@ internal RTHandle GetTexture(in TextureHandle handle)
if (!handle.IsValid())
return null;

var resource = GetTextureResource(handle.handle).graphicsResource;
if (resource == null && handle.fallBackResource != TextureHandle.nullHandle.handle)
return GetTextureResource(handle.fallBackResource).graphicsResource;
var texResource = GetTextureResource(handle.handle);
var resource = texResource.graphicsResource;
if (resource == null)
{
if (handle.fallBackResource != TextureHandle.nullHandle.handle)
return GetTextureResource(handle.fallBackResource).graphicsResource;
else if (!texResource.imported)
throw new InvalidOperationException("Trying to use a texture that was already released or not yet created. Make sure you declare it for reading in your pass or you don't read it before it's been written to at least once.");
}

return resource;
}
Expand All @@ -132,7 +138,11 @@ internal ComputeBuffer GetComputeBuffer(in ComputeBufferHandle handle)
if (!handle.IsValid())
return null;

return GetComputeBufferResource(handle.handle).graphicsResource;
var resource = GetComputeBufferResource(handle.handle);
if (resource == null)
throw new InvalidOperationException("Trying to use a compute buffer that was already released or not yet created. Make sure you declare it for reading in your pass or you don't read it before it's been written to at least once.");

return resource.graphicsResource;
}

private RenderGraphResourceRegistry()
Expand Down
13 changes: 13 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed camera bridge action in release build (case 1367866).
- Fixed contact shadow disappearing when shadowmask is used and no non-static object is available.
- Fixed atmospheric scattering being incorrectly enabled when scene lighting is disabled.
- Fixed shader graph errors when disabling the bias on texture samplers.
- Fixed a shader warning in the volumetric clouds combine file.
- Fixed layer lit shader UI.
- Fixed error thrown when layered lit material has an invalid material type.
- Fixed a warning because of a null texture in the lens flare pass.
- Fixed a nullref when enabling raycount without ray tracing.
- Fixed default value of "Distortion Blur" from 1 to 0 according to the doc.
- Fixed FOV change when enabling physical camera.
- Fixed spot light shadows near plane
- Fixed Transparent Depth Pre/Post pass by default for the built-in HDRP Hair shader graph.
- Fixed build warnings due to the exception in burst code (case 1382827).
- Fixed unsupported material properties show when rendering pass is Low Resolution.
- Fixed auto-exposure mismatch between sky background and scene objects in path tracing (case 1385131).

## [12.1.2] - 2021-10-22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Here is the list of Material properties that you can access with the AOV API.

| Material property | Description |
|-------------------|---------------------------|
| **Normal** | Outputs the surface albedo. |
| **Albedo** | Outputs the surface normal. |
| **Albedo** | Outputs the surface albedo. |
| **Normal** | Outputs the surface normal. |
| **Smoothness** | Outputs the surface smoothness. |
| **Ambient Occlusion** | Outputs the ambient occlusion (N/A for AxF). **Note**: the ambient occlusion this outputs does not include ray-traced/screen-space ambient occlusion from the [Ambient Occlusion override](Override-Ambient-Occlusion.md). It only includes ambient occlusion from materials in the Scene. |
| **Specular** | Outputs the surface specularity. |
Expand Down
84 changes: 59 additions & 25 deletions com.unity.render-pipelines.high-definition/Documentation~/Decal.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,57 @@
# Decal

The High Definition Render Pipeline (HDRP) includes two ways to create decals in a Scene. You can either use a decal Mesh and manually position the decal or use the [Decal Projector](Decal-Projector.md) component to project the decal. Both of these methods require that you create a decal Material, which is a Material that uses either the [Decal Shader](Decal-Shader.md) or [Decal Master Stack](master-stack-decal.md). You can use either to create decal Materials that you can place or project into a Scene.
The High Definition Render Pipeline (HDRP) includes the following ways to create decals in a Scene.

![](Images/HDRPFeatures-DecalShader.png)
- Use a Decal Mesh and manually position the decal.

- Use the [Decal Projector](Decal-Projector.md) component to project the decal.

**Limitation and compatibility**
To use these methods, you need to create a decal Material. A decal Material is a Material that uses the [Decal Shader](Decal-Shader.md) or [Decal Master Stack](master-stack-decal.md). You can then place or project your decal Material into a Scene.

The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md). It does not support emissive on Transparent Materials and does support Decal Layers.
Decal Meshes can only affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). They also do not support Decal Layers.
![](Images/HDRPFeatures-DecalShader.png)

## Decal Layers

HDRP includes Decal Layers that you can use to specify which Materials a decal affects based on which layer you assign it to.

### Enabling Decal Layers

To use Decal Layers, first enable them in your Project’s [HDRP Asset](HDRP-Asset.md). You can then enable Decal Layers in your [Frame Settings](Frame-Settings.md) to set your Cameras to process Decal Layers.
1. Select the HDRP Asset in the Project window and, in the Inspector, go to **Decal > Layers** and enable the checkbox.
2. To enable Decal Layers for all Cameras, open the [HDRP Global Settings](Default-Settings-Window.md), go to the **Frame Settings (Default Values) > Camera** section and, in the **Rendering** section, enable the **Decal Layers** checkbox.
To use Decal Layers, enable them in your Project’s [HDRP Asset](HDRP-Asset.md). To do this:
1. Navigate to the **Project** window and open your HDRP Asset.
2. In the Inspector, open the **Decals** dropdown.
3. Enable the **Layers** checkbox.

You can then enable Decal Layers in your [Frame Settings](Frame-Settings.md) to enable Decal Layers for all Cameras. To do this:

To override the Frame Settings for a specific Camera and set Decal Layers on an individual basis:
1. Go to **Edit** > **Project Settings** open the **Graphics** section and select [HDRP Global Settings](Default-Settings-Window.md).
2. Go to the **Frame Settings (Default Values**) > **Camera** section.
3. Open the **Rendering** section.
4. Enable the **Decal Layers** checkbox.

To control the Frame Settings and set Decal Layers for a specific Camera:

1. Click on a Camera in the Scene view or Hierarchy window to view its properties in the Inspector.
2. Go to the **General** section and enable the **Custom Frame Settings** checkbox. This exposes the **Frame Settings Overrides,** which you can use to customize this Camera only.
3. In the **Rendering** section, enable the **Decal Layers** checkbox to make this Camera use Decal Layers.
2. Go to the **Rendering** section and enable the **Custom Frame Settings** checkbox. This opens a new **Frame Settings Overrides** section, which you can use to customize this Camera.
3. In the **Frame Settings Overrides** section open the **Rendering** section.
4. Enable the **Decal Layers** checkbox.

### Using Decal Layers

After you enable Decal Layers, you can then use them to decouple Meshes from certain Decal Projectors in your Scene. To do this:
When you enable Decal Layers, a Decal only affects a Mesh Renderer or Terrain if they both use a matching Decal Layer. You can use Decal Layers to separate Meshes from specific [Decal Projectors](Decal-Projector.md) in your Scene. To do this:

1. Click on a Decal Projector in the Hierarchy or the Scene view to view it in the Inspector.
2. Use the **Decal Layer** property drop-down to select which Decal Layers this Decal Projector affects.
4. Click on a Mesh Renderer or Terrain in the Hierarchy or the Scene view to view it in the Inspector.
5. Use the **Rendering Layer Mask** drop-down (See [MeshRenderer](https://docs.unity3d.com/Manual/class-MeshRenderer.html) for GameObjects or [OtherSettings](https://docs.unity3d.com/Manual/terrain-OtherSettings.html) for Terrain) to select which Decal Layers affect this Mesh Renderer or Terrain. When you enable Decal Layers, a Decal only affects a Mesh Renderer or Terrain if they both use a matching Decal Layer.
5. Use the **Rendering Layer Mask** drop-down (See [MeshRenderer](https://docs.unity3d.com/Manual/class-MeshRenderer.html) for GameObjects or [OtherSettings](https://docs.unity3d.com/Manual/terrain-OtherSettings.html) for Terrain) to select which Decal Layers affect this Mesh Renderer or Terrain.

### Renaming Decal Layers

By default, in the UI for Decal Projectors, Mesh Renderers, or Terrain, Decal Layers are named **Decal Layer 1-7**. To more easily differentiate between them, you can give each Decal Layer a specific name. To do this, open the [HDRP Global Settings](Default-Settings-Window.md), and go to **Decal Layer Names**. Here you can set the name of each Decal Layer individually.
By default, in the UI for Decal Projectors, Mesh Renderers, or Terrain, Decal Layers are named **Decal Layer 1-7**. You can give each Decal Layer a specific name. To do this:

1. Open the [HDRP Global Settings](Default-Settings-Window.md).
2. Expand the **Decal Layer Names** section.

Here you can set the name of each Decal Layer individually.

### How Decal Layers affect performance

Expand All @@ -44,28 +61,45 @@ When you enable Decal Layers, it increases the build time of your project. This
* Increases GPU performance cost.
* Generates more [Shader Variants](https://docs.unity3d.com/Manual/shader-variants.html).

If you use the Decal Layer system to disable a decal, via the **Rendering Layer Mask** of a Mesh Renderer or Terrain, it doesn't save on any performance. Instead, to save performance, you need to disable the **Receive Decals** property for the Mesh Renderer or Terrain's Material.
HDRP renders Material depth in a Depth Prepass to apply decals to opaque Materials. This increases resource use on the CPU. Only Materials that have the **Receive Decals** property enabled render in the Depth Prepass, unless you force a full Depth Prepass. To prevent HDRP from rendering a Material which shouldn't receive Decals in the Depth Prepass:

Implementation detail: To allow HDRP to apply decals to opaque Materials, it must render depth in a Depth Prepass, which adds to the CPU resource intensity of the operation. Only Materials with **Receive Decals** enabled render in the Depth Prepass, unless you force a full Depth Prepass. If you disable a decal with the Decal Layers system, HDRP still renders it in the Depth Prepass. This is why you need to disable the **Receive Decals** property on Materials to save performance.
1. Open the Material assigned to a Mesh Renderer or Terrain that you do not want to display decals on.

### Migration of data previous to Unity 2020.2
2. Disable the **Receive Decals** property.

Before Unity 2020.2, the default value for the **Rendering Layer Mask** for new Mesh Renderers and Terrain doesn't include any of the Decal Layer flags. This means that, when you enable Decal Layers, these Mesh Renderers and Terrain default to not receive any Decals. Later versions use **Decal Layer Default** by default.
If you use the Decal Layer system to change the **Rendering Layer Mask** of a Mesh Renderer or Terrain to disable decal, it doesn't have an effect on your application's performance.

## Additive Normal Blending

Additive normal blending is a method that can be enabled per project to allow decal normals to be additively blended with the underlying object normal.
The screenshot on the left below do not use additive normal blending, whereas the screenshot on the right does.
You can use Additive normal blending to blend decal normals with the normals of a specific GameObject.
In the following image examples, the screenshot on the left does not use additive normal blending, and the screenshot on the right uses additive normal blending.:

![](Images/HDRPFeatures-SurfGrad.png)

To use Additive Normal Blending:
1. Select your Project’s [HDRP Asset](HDRP-Asset.md).
2. In the Inspector, go to **Rendering > Decals** and enable the **Additive Normal Blending** checkbox.
1. Open your Project’s [HDRP Asset](HDRP-Asset.md).
2. In the Inspector, go to **Rendering** >**Decals** and enable the **Additive Normal Blending** checkbox.

### High Precision Normal Buffer

When using additive normal blending, HDRP will constrain the decal displacement to a cone of 45° around the object normal to reduce banding artifacts.
To remove the angle constraint on the normal at the cost of a higher memory usage, you can tell HDRP to use a High Precision Normal Buffer:
When you use additive normal blending, HDRP constrains the decal displacement to a cone of 45° around the object normal to reduce banding artifacts.
To remove this angle constraint on the normal at the cost of a higher memory usage, enable the High Precision Normal Buffer setting. To do this:

1. Select your Project’s [HDRP Asset](HDRP-Asset.md).
2. In the Inspector, go to **Rendering > Decals** and enable the **High Precision Normal Buffer** checkbox.
2. In the Inspector, go to **Rendering** > **Decals** and enable the **High Precision Normal Buffer** checkbox.

## Limitations

- A Decal Projector can only affect transparent Materials when you use the [Decal Shader](Decal-Shader.md).

- The Decal Shader does not support emissive on Transparent Materials and does support Decal Layers.

- Decal Meshes can only affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md).

- Decal Meshes do not support Decal Layers.

### Migration of data previous to Unity 2020.2

When you convert a project from 2020.2, Mesh renderers and Terrain do not receive any decals by default.

This is because, before Unity 2020.2, the default value for the **Rendering Layer Mask** for new Mesh Renderers and Terrain doesn't include Decal Layer flags.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The High Definition Render Pipeline (HDRP) adds the HDRP Settings tab to Unity's
- Set up default [Frame Setting](Frame-Settings.md) values for [Cameras](HDRP-Camera.md) to use.
- Assign and edit a default [Volume Profile](Volume-Profile.md).

The HDRP Settings tab is part of the Graphics Settings window. To get to this tab, select **Edit > Project Settings > Graphics** and then, in the sidebar, click **HDRP Settings**.
The HDRP Settings tab is part of the Graphics Settings window. To get to this tab, select **Edit > Project Settings > Graphics** and then, in the sidebar, click **HDRP Global Settings**.

## Volume Profiles

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ HDRP provides the following upscale filter methods:

## Overriding upscale options with code

You can also override the upscale options in the HDRP Asset for each Camera in your scene using code. To do this, call DynamicResolutionHandler.SetUpscaleFilter(Camera camera, DynamicResUpscaleFilter filter), to make HDRP ignore the value in the HDRP Asset for a given Camera.
You can also override the upscale options in the HDRP Asset for each Camera in your scene using code. To do this, call `DynamicResolutionHandler.SetUpscaleFilter(Camera camera, DynamicResUpscaleFilter filter)`, to make HDRP ignore the value in the HDRP Asset for a given Camera.

<a name="TAA_Notes"></a>

Expand Down
Loading