Skip to content

[HDRP] Backprot various PRs to 10.x.X/release #7229

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 11 commits into from
Mar 2, 2022
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
12 changes: 11 additions & 1 deletion com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed
- Render Graph object pools are now cleared with render graph cleanup to avoid stale pass data.

- Fixed sky jittering when TAA is enabled.
- Fixed Normal Map assiignation when importing FBX Materials.
- Fixed the default custom pass buffer format from R8G8B8A8_SNorm to R8G8B8A8_UNorm. Additionally, an option in the custom pass buffer format settings is available to use the old format.
- Fixed an issue where sometimes full screen debug would cause render graph errors.
- Fixed a nullref exception when creating a new scene while LightExplorer is open.
- Fixed issue at edge of screen on some platforms when SSAO is on.
- Fixed vertex color mode Add name whicgh was misleading, renamed to AddSubstract.
- Fixed screen space shadow when multiple lights cast shadows.
- Fixed issue with dynamic resolution and low res transparency sampling garbage outside of the render target.
- Fixed issue with Final Image Histogram displaying a flat histogram on certain GPUs and APIs.

## [10.8.0] - 2021-09-20

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ However, not all materials are supported by every injection point in a draw rend

When Unity renders a material that is not supported by the current injection point, it results in an undefined behavior. For example, rendering GameObjects with lit shaders in the **After Opaque Depth And Normal** injection point produces unexpected results.

Note: HDRP does not support decals on GameObjects rendered in the DrawRenderers pass.

<a name="Custom-Renderers-Pass-shader"></a>

## Custom Renderers Pass shader
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions com.unity.render-pipelines.high-definition/Documentation~/MatCap.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# MatCap mode

In MatCap mode, the High Definition Render Pipeline (HDRP) replaces the functionality of the Scene window's Lighting button with a material capture (MatCap) view. MatCap mode uses an image that completely captures a Material, including baked-in lighting. When using MatCap mode, HDRP replaces all of the Materials and lighting in the Scene with what is in the MatCap.
In MatCap mode, the High Definition Render Pipeline (HDRP) replaces the functionality of the Scene view's Lighting button with a material capture (MatCap) view. MatCap mode uses an image that completely captures a Material, including baked-in lighting. When using MatCap mode, HDRP replaces all the Materials and lighting in the Scene with what's in the MatCap.

MatCap mode is particularly useful to navigate and get a sense of the Scene without setting up the Scene lighting. For example, if you were to edit a dark area, like the inside of a cave, it would be difficult to navigate with low lighting MatCap mode makes it much easier to navigate in such dark areas.
MatCap mode is useful to navigate and get a sense of the Scene without setting up the Scene lighting. For example, if you were to edit a dark area, like the inside of a cave, MatCap mode makes it much easier to navigate in this low lighting.

## Using MatCap

To activate MatCap mode, disable the Lighting toggle in the Scene window.
To activate MatCap mode, disable the Lighting toggle in the Scene view.

![](Images/MatCap1.png)

MatCap mode preserves the normal maps and you can use the original Material albedo. To configure MatCap mode, go to **Edit > Preferences > HD Render Pipeline** and use the following properties.
MatCap mode preserves the normal maps and you can use the original Material albedo. To configure MatCap mode, go to **Edit** > **Preferences** > **HD Render Pipeline** and use the following properties.

## Properties

| **Property** | **Description** |
| ----------------------------- | ------------------------------------------------------------ |
| **Mix Albedo in MatCap Mode** | Enable the checkbox to make HDRP mix the albedo of the Material with its material capture. |
| **MatCap Intensity Scale** | Set the intensity of the material capture. This increases the brightness of the Scene. This is especially useful if the albedo darkens the Scene considerably. |
| **Mix Albedo in MatCap Mode** | Enable to make HDRP mix the albedo of the Material with its material capture. |
| **MatCap Intensity Scale** | Set the intensity of the material capture. This increases the brightness of the Scene. This is useful if the albedo darkens the Scene considerably. |

## Default material captures

Expand All @@ -32,11 +32,11 @@ You can also activate MatCap view as a **Lighting Debug Mode** in the [Render Pi

## MatCap examples

MatCap off:
![](Images/MatCap2.png)
MatCap off

MatCap on:
![](Images/MatCap3.png)
MatCap on

MatCap on with albedo:
![](Images/MatCap4.png)
![](Images/MatCap4.png)
MatCap on with albedo
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,21 @@ The default values in either mode make it so the planet's surface is at **0** on

## Warmup cost

This sky type requires heavy precomputation to be rendered. Because of this, the first few frames (depending on the *Number of bounces* parameter) are going to take much longer. This needs to be taken into consideration when switching from another sky type to the Physically Based Sky for example as it might produce a noticeable drop in framerate.
When you switch to or from a Physically Based Sky, it might cause a noticeable drop in framerate. This is because HDRP performs a large amount of precomputations to render a Physically Based Sky, so the first few frames (depending on the Number of bounces parameter) takes more time to render than other HDRP sky types.
This also applies when HDRP uses the volume system to interpolate between two different Physically Based Skies with different sets of parameters. To do this, HDRP restarts the precomputation every frame in which it performs interpolation. This causes a noticeable drop in framerate. To avoid this, use a single set of Physically Based Sky parameters for a scene and change the sun light direction and intensity to achieve the result you want.

HDRP restarts precomputation when you change the following parameters:
- Type
- Planetary Radius
- Ground Tint
- Air Maximum Altitude
- Air Density
- Air Tint
- Aerosol Maximum Altitude
- Aerosol Density
- Aerosol Tint
- Aerosol Anisotropy
- Number of Bounces

### Reference list

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ From 2019.3, HDRP provides lookup Textures that you can use to customize this ef
2. In the **Packages** window, select **High Definition RP**.
3. In the **High Definition RP** section, navigate to **Additional Post-processing Data** and click **Import into Project** next to it.
4. The Textures that are relevant to Bloom are in the **Lens Dirt** folder, so if you only want the lookup Textures for Bloom, only import the contents of the **Lens Dirt** folder.


Care is needed when using the Bloom effect with [Chromatic Abberation](Post-Processing-Chromatic-Aberration.md). For performance reasons, Chromatic Aberation is computed after the Bloom computation. This results in Bloom overpowering the Chromatic Aberration effect when the Bloom Intensity is set to a very high value. However, in a typical Bloom configuration, the Intensity should never need to be set high enough for this to be an issue.
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ From 2019.3, HDRP provides lookup Textures that you can use to customize this ef
2. In the **Packages** window, select **High Definition RP**.
3. In the **High Definition RP** section, navigate to **Additional Post-processing Data** and click **Import into Project** next to it.
4. The Textures that are relevant to Chromatic Aberration are in the **Spectral LUTs** folder, so if you only want the lookup Textures for Chromatic Aberration, only import the contents of the **Spectral LUTs** folder.

Care is needed when using the [Bloom](Post-Processing-Bloom.md) effect with Chromatic Abberation. For performance reasons, Chromatic Aberation is computed after the Bloom computation. This results in Bloom overpowering the Chromatic Aberration effect when the Bloom Intensity is set to a very high value. However, in a typical Bloom configuration, the Intensity should never need to be set high enough for this to be an issue.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Please refer to [Unity XR](https://docs.unity3d.com/Manual/XR.html) documentatio

## Recommended Settings

HDRP has been designed to fully support Single-Pass Instanced mode. This mode gives you the best performance on all platforms.
HDRP also supports multi-pass but this is slower on the CPU and some features, like Auto-Exposure, can cause issues.
Unity has designed HDRP to fully support Single-Pass Instanced mode. This mode gives you the best performance on all platforms.
HDRP also supports multi-pass but this is slower on the CPU and some features, like Auto Exposure, can cause issues.
If you encounter a problem with a specific feature, you can disable it in your Project’s [HDRP Asset](HDRP-Asset.md).

You can also watch the presentation from Unite Copenhagen (October 2019) to learn more tips: [Maximizing visual fidelity in VR: HDRP support](https://youtu.be/_WkSAn55EBM)
Expand All @@ -21,19 +21,20 @@ You can also watch the presentation from Unite Copenhagen (October 2019) to lear
* PlayStationVR
* Open VR*

Note: Valve is currently developing their OpenVR Unity XR plugin for 2019.3 and beyond.
**Note**: Valve is currently developing their OpenVR Unity XR plugin for 2019.3 and beyond.
For more information, see [Unity XR platform updates](https://blogs.unity3d.com/2020/01/24/unity-xr-platform-updates/) on the Unity blog, and [XR Plugin Architecture](https://docs.unity3d.com/Manual/XRPluginArchitecture.html) in the Unity Manual.
The XR Plugin architecture links to the OpenVR desktop package and has further info and recommendations.

## Resolution Control
There are multiple methods that you can use to control the resolution of your render targets in HDRP, but be aware that HDRP does not support every method available in standard Unity using the built-in render pipeline. [XRSettings.renderViewportScale](https://docs.unity3d.com/ScriptReference/XR.XRSettings-renderViewportScale.html) has no effect in HDRP and generates a warning if you use it. Use one of the following methods instead:
There are multiple methods that you can use to control the resolution of your render targets in HDRP, but be aware that HDRP doesn't support every method available in standard Unity using the built-in render pipeline. [XRSettings.renderViewportScale](https://docs.unity3d.com/ScriptReference/XR.XRSettings-renderViewportScale.html) has no effect in HDRP and generates a warning if you use it. Use one of the following methods instead:
* **Dynamic Resolution**: You can use the [dynamic resolution system](Dynamic-Resolution.md) to change the resolution at runtime. This is the best method to use if you want to change the resolution at runtime.
* **Eye Texture**: You can set the device back-buffer resolution by changing [XRSettings.eyeTextureResolutionScale](https://docs.unity3d.com/ScriptReference/XR.XRSettings-eyeTextureResolutionScale.html). This is a resource intensive operation that reallocates all render targets.

Be aware that SteamVR will apply a default 150% supersampling value. You can change this value in the settings of SteamVR.?
Be aware that SteamVR will apply a default 150% supersampling value. You can change this value in the settings of SteamVR.

## Enable VR single-pass after startup

Due to some technical limitations that will be resolved in later versions, you need the following code in your script if your app does not boot directly in VR mode:
**Note**: Due to some technical limitations that Unity will resolve in later versions of HDRP, you need the following code in your script if your app doesn't boot directly in VR mode:

```csharp
private void Awake()
Expand All @@ -46,6 +47,6 @@ private void Awake()

You can use the following defines to include or exclude code from your scripts.

* ENABLE_VR: The C++ side of the engine sets this define to indicate if the platform supports VR.
* ENABLE_VR: The C++ side of the engine sets this define to specify if the platform supports VR.
* ENABLE_VR_MODULE: Unity sets this define if your Project includes the [built-in VR module com.unity.modules.vr](https://docs.unity3d.com/Manual/upm-ui-disable.html).
* ENABLE_XR_MODULE: Unity sets this define if your Project includes the [built-in XR module com.unity.modules.xr](https://docs.unity3d.com/Manual/upm-ui-disable.html).
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| **World Scale** | Set the world-space size of the Texture in meters. If you set this to **1**, then HDRP maps the Texture to 1 meter in world space.If you set this to **2**, then HDRP maps the Texture to 0.5 meters in world space.This property only appears when you select **Planar** or **Triplanar** from the **BlendMask UV Mapping** drop-down. |
| **Tiling** | Set an **X** and **Y** tile rate for the **Layer Mask** UV. HDRP uses the **X** and **Y** values to tile the Texture assigned to the **Layer Mask** across the Material’s surface, in object space. |
| **Offset** | Set an **X** and **Y** offset for the **Layer Mask** UV. HDRP uses the **X** and **Y** values to offset the Texture assigned to the **Layer Mask** from the Material’s surface, in object space. |
| **Vertex Color Mode** | Use the drop-down to select the method HDRP uses to combine the **Layer Mask** to manager layer visibility.<br/>&#8226; **None**: Only the **Layer Mask** affects visibility. HDRP does not combine it with vertex colors.<br/>&#8226; **Multiply**: Multiplies the vertex colors from a layer with the corresponding values from the channel in the **Layer Mask** that represents that layer. The default value for a pixel in the mask is 1. Multiplying the vertex colors of a layer by the **Layer Mask** reduces the intensity of that layer, unless the value in the **Layer Mask** is 1.<br/>&#8226; **Add**: Remaps vertex color values to between -1 and 1, and then adds them to the corresponding values from the channel in the **Layer Mask** that represents that layer. Vertex color values between 0 and 0.5 reduce the effect of that layer, values between 0.5 and 1 increase the effect of that layer. |
| **Vertex Color Mode** | Use the drop-down to select the method HDRP uses to combine the **Layer Mask** to manager layer visibility.<br/>&#8226; **None**: Only the **Layer Mask** affects visibility. HDRP does not combine it with vertex colors.<br/>&#8226; **Multiply**: Multiplies the vertex colors from a layer with the corresponding values from the channel in the **Layer Mask** that represents that layer. The default value for a pixel in the mask is 1. Multiplying the vertex colors of a layer by the **Layer Mask** reduces the intensity of that layer, unless the value in the **Layer Mask** is 1.<br/>&#8226; **AddSubstract**: Remaps vertex color values to between -1 and 1, and then adds them to the corresponding values from the channel in the **Layer Mask** that represents that layer. Vertex color values between 0 and 0.5 reduce the effect of that layer, values between 0.5 and 1 increase the effect of that layer. |
| **Main Layer Influence** | Enable the checkbox to allow the **Main Layer** to influence the albedo, normal, and height of **Layer 1**, **Layer 2**, and **Layer 3**. You can change the strength of the influence for each layer. |
| **Use Height Based Blend** | Enable the checkbox to blend the layers with a heightmap. HDRP then evaluates the height of each layer to check whether to display that layer or the layer above. |
| **Height Transition** | Use the slider to set the transition blend size between the Materials in each layer. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ public void OnPreprocessMaterialDescription(MaterialDescription description, Mat

if (description.TryGetProperty("Bump", out textureProperty) && textureProperty.texture != null)
{
SetMaterialTextureProperty("_BumpMap", material, textureProperty);
SetMaterialTextureProperty("_NormalMap", material, textureProperty);

if (description.TryGetProperty("BumpFactor", out floatProperty))
material.SetFloat("_BumpScale", floatProperty);
material.SetFloat("_NormalScale", floatProperty);
}
else if (description.TryGetProperty("NormalMap", out textureProperty) && textureProperty.texture != null)
{
SetMaterialTextureProperty("_BumpMap", material, textureProperty);
SetMaterialTextureProperty("_NormalMap", material, textureProperty);

if (description.TryGetProperty("BumpFactor", out floatProperty))
material.SetFloat("_BumpScale", floatProperty);
material.SetFloat("_NormalScale", floatProperty);
}

if (description.TryGetProperty("EmissiveColor", out textureProperty))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns()
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.ColorTemperatureMode, "m_UseColorTemperature", 150), // 6: Color Temperature Mode
new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, HDStyles.ColorTemperature, "m_ColorTemperature", 120, (r, prop, dep) => // 7: Color Temperature
{
using(new EditorGUI.DisabledScope(!prop.serializedObject.FindProperty("m_UseColorTemperature").boolValue))
// Sometimes during scene transition, the target object can be null, causing exceptions.
using (new EditorGUI.DisabledScope(prop.serializedObject.targetObject == null || !prop.serializedObject.FindProperty("m_UseColorTemperature").boolValue))
{
EditorGUI.PropertyField(r, prop, GUIContent.none);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Shader "Hidden/Debug/PlanarReflectionProbePreview"
HLSLPROGRAM

#pragma editor_sync_compilation
#pragma target 4.5
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch

#pragma vertex vert
#pragma fragment frag
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Pass
{
Tags { "LightMode"="DepthForwardOnly" }

ZWrite On
Blend Off

HLSLPROGRAM
#define VFX_PASSDEPTH VFX_PASSDEPTH_ACTUAL
#pragma multi_compile _ WRITE_NORMAL_BUFFER
#pragma multi_compile _ WRITE_DECAL_BUFFER
#pragma multi_compile _ WRITE_MSAA_DEPTH
${VFXIncludeRP("Templates/Mesh/PassDepthOrMV.template")}


ENDHLSL
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pass
{
Tags { "LightMode"="DepthForwardOnly" }

ZWrite On
Blend Off

HLSLPROGRAM
#define VFX_PASSDEPTH VFX_PASSDEPTH_ACTUAL
#pragma multi_compile _ WRITE_NORMAL_BUFFER
#pragma multi_compile _ WRITE_MSAA_DEPTH
${VFXIncludeRP("Templates/PlanarPrimitive/PassDepthOrMV.template")}

ENDHLSL
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading