diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 977f830bb91..177c8b961b4 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -81,6 +81,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed using the wrong coordinate to compute the sampling direction for the screen space global illumination. - Fixed an issue where forced sky update (like PBR sky amortized updated) would not update ambient probe. - Fixed static lighting sky update when using an HDRI sky with a render texture in parameter. +- Fixed sky jittering when TAA is enabled. +- Fixed Normal Map assiignation when importing FBX Materials. +- Fixed issue with HDRI Sky and shadow filtering quality set to high. +- 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 cached directional light shadows disappearing without reappearing when the going outside of the range of shadow validity. +- 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 that caused the uber post process to run even if nothing is to be done, leading to different results when disabling every post process manually vs disabling the whole post-processing pipeline. +- Fixed issue that placed an OnDemand shadow in the atlas before it was ever rendered. +- Fixed issue at edge of screen on some platforms when SSAO is on. ## [14.0.0] - 2021-11-17 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Creating.md b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Creating.md index a8d55ca4ce4..a1677b9392b 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Creating.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Creating.md @@ -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. + ## Object ID Custom Pass @@ -475,6 +477,7 @@ To change the buffer format of the Custom Pass component in your HDRP asset, go | **Format** | **Bits Per Pixel** | **Description** | | ------------ | ------------------ | ------------------------------------------------------------ | | R8G8B8A8 | 32 | This format is the most resource efficient, but it might cause banding issues. HDRP uses this format by default. | +| Signed R8G8B8A8 | 32 | This format is similar to R8G8B8A8 but you can store unsigned data. | | R11G11B10 | 32 | This format has a higher precision than R8G8B8A8 but does not support alpha channels. | | R16G16B16A16 | 64 | This format has the highest precision but uses twice as much memory as R8G8B8A8 and R11G11B10. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/Matcap1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/Matcap1.png index 58545a4612f..5d6dfabe4d8 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/Matcap1.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/Matcap1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa4540fdedc5b37c4e1fa730ecdc4d4fbaa6ac772884f944ea2ab25ab637df46 -size 4757 +oid sha256:ccdabff17ba7be61f90bafe91f8fa6956faff94bbde381123347c0d3ab728a59 +size 633937 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/MatCap.md b/com.unity.render-pipelines.high-definition/Documentation~/MatCap.md index c48a5909ec6..efe67eb25e1 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/MatCap.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/MatCap.md @@ -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 @@ -32,11 +32,11 @@ You can also activate MatCap view as a **Lighting Debug Mode** in the [Rendering ## MatCap examples -MatCap off: ![](Images/MatCap2.png) +MatCap off -MatCap on: ![](Images/MatCap3.png) +MatCap on -MatCap on with albedo: ![](Images/MatCap4.png) +MatCap on with albedo diff --git a/com.unity.render-pipelines.high-definition/Documentation~/VR-Overview.md b/com.unity.render-pipelines.high-definition/Documentation~/VR-Overview.md index ff94ec36f9c..19b06553734 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/VR-Overview.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/VR-Overview.md @@ -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) @@ -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() @@ -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). diff --git a/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/FBXMaterialDescriptionPostprocessor.cs b/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/FBXMaterialDescriptionPostprocessor.cs index 2b2d5033cd8..0b2ab4e42d1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/FBXMaterialDescriptionPostprocessor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/FBXMaterialDescriptionPostprocessor.cs @@ -110,17 +110,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)) diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs index 39aeb3b5336..94c2fe7f265 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs @@ -241,7 +241,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); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index 1aa91e6db26..8200bb4fefe 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -1051,7 +1051,8 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner) { HDLightEditor editor = owner as HDLightEditor; var additionalLightData = editor.GetAdditionalDataForTargetIndex(0); - if (!HDCachedShadowManager.instance.LightHasBeenPlacedInAtlas(additionalLightData)) + // If the light was registered, but not placed it means it doesn't fit. + if (additionalLightData.lightIdxForCachedShadows >= 0 && !HDCachedShadowManager.instance.LightHasBeenPlacedInAtlas(additionalLightData)) { string warningMessage = "The shadow for this light doesn't fit the cached shadow atlas and therefore won't be rendered. Please ensure you have enough space in the cached shadow atlas. You can use the light explorer (Window->Rendering->Light Explorer) to see which lights fit and which don't.\nConsult HDRP Shadow documentation for more information about cached shadow management."; // Loop backward in "tile" size to check diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template new file mode 100644 index 00000000000..e86c721a0ea --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template @@ -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 +} diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template.meta b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template.meta new file mode 100644 index 00000000000..7c8bde8ebf1 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/Mesh/PassDepthForwardOnly.template.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 251722a6d90822e4db4f5cc082ae48c8 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template new file mode 100644 index 00000000000..7f02f127278 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template @@ -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 +} diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template.meta b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template.meta new file mode 100644 index 00000000000..4ddf46f2937 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/PlanarPrimitive/PassDepthForwardOnly.template.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 782f19a04d88d9f4aaf1c889cea63180 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitMesh.template b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitMesh.template index 3cc4082b655..0c8a6c431df 100644 --- a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitMesh.template +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitMesh.template @@ -4,7 +4,8 @@ Tags{ "RenderPipeline" = "HDRenderPipeline" } ${VFXInclude("Shaders/VFXParticleHeader.template")} ${VFXIncludeRP("Templates/Mesh/PassSelection.template")} - ${VFXIncludeRP("Templates/Mesh/PassDepth.template"),IS_OPAQUE_PARTICLE} + ${VFXIncludeRP("Templates/Mesh/PassDepth.template"),IS_OPAQUE_NOT_SIMPLE_LIT_PARTICLE} + ${VFXIncludeRP("Templates/Mesh/PassDepthForwardOnly.template"),HDRP_MATERIAL_TYPE_SIMPLELIT} ${VFXIncludeRP("Templates/Mesh/PassVelocity.template"),USE_MOTION_VECTORS_PASS} ${VFXIncludeRP("Templates/Mesh/PassGBuffer.template"),IS_OPAQUE_NOT_SIMPLE_LIT_PARTICLE} ${VFXIncludeRP("Templates/Mesh/PassForward.template")} diff --git a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitPlanarPrimitive.template b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitPlanarPrimitive.template index c1ec8d659e0..c565abd909e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitPlanarPrimitive.template +++ b/com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/Templates/VFXParticleLitPlanarPrimitive.template @@ -6,7 +6,8 @@ ${VFXInclude("Shaders/VFXParticleHeader.template")} ${VFXIncludeRP("Templates/PlanarPrimitive/PassSelection.template")} - ${VFXIncludeRP("Templates/PlanarPrimitive/PassDepth.template"),IS_OPAQUE_PARTICLE} + ${VFXIncludeRP("Templates/PlanarPrimitive/PassDepth.template"),IS_OPAQUE_NOT_SIMPLE_LIT_PARTICLE} + ${VFXIncludeRP("Templates/PlanarPrimitive/PassDepthForwardOnly.template"),HDRP_MATERIAL_TYPE_SIMPLELIT} ${VFXIncludeRP("Templates/PlanarPrimitive/PassVelocity.template"),USE_MOTION_VECTORS_PASS} ${VFXIncludeRP("Templates/PlanarPrimitive/PassGBuffer.template"),IS_OPAQUE_NOT_SIMPLE_LIT_PARTICLE} ${VFXIncludeRP("Templates/PlanarPrimitive/PassForward.template")} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs index de876adb268..a5ae5e3dfba 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs @@ -1549,7 +1549,9 @@ public ShadowUpdateMode shadowUpdateMode } else if (legacyLight.shadows != LightShadows.None && m_ShadowUpdateMode == ShadowUpdateMode.EveryFrame && value != ShadowUpdateMode.EveryFrame) { - HDShadowManager.cachedShadowManager.RegisterLight(this); + // If we are OnDemand not rendered on placement, we defer the registering of the light until the rendering is requested. + if (!(shadowUpdateMode == ShadowUpdateMode.OnDemand && !onDemandShadowRenderOnPlacement)) + HDShadowManager.cachedShadowManager.RegisterLight(this); } m_ShadowUpdateMode = value; @@ -3239,7 +3241,9 @@ internal void RefreshCachedShadow() if (!ShadowIsUpdatedEveryFrame() && legacyLight.shadows != LightShadows.None) { - HDShadowManager.cachedShadowManager.RegisterLight(this); + // If we are OnDemand not rendered on placement, we defer the registering of the light until the rendering is requested. + if (!(shadowUpdateMode == ShadowUpdateMode.OnDemand && !onDemandShadowRenderOnPlacement)) + HDShadowManager.cachedShadowManager.RegisterLight(this); } } @@ -3664,9 +3668,11 @@ internal void CreateHDLightRenderEntity(bool autoDestroy = false) void OnEnable() { - if (shadowUpdateMode != ShadowUpdateMode.EveryFrame && legacyLight.shadows != LightShadows.None) + if (!ShadowIsUpdatedEveryFrame() && legacyLight.shadows != LightShadows.None) { - HDShadowManager.cachedShadowManager.RegisterLight(this); + // If we are OnDemand not rendered on placement, we defer the registering of the light until the rendering is requested. + if (!(shadowUpdateMode == ShadowUpdateMode.OnDemand && !onDemandShadowRenderOnPlacement)) + HDShadowManager.cachedShadowManager.RegisterLight(this); } SetEmissiveMeshRendererEnabled(true); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs index d5fe7abf8d1..b749dbdfc4a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs @@ -557,7 +557,6 @@ internal void ScheduleShadowUpdate(HDAdditionalLightData lightData) if (!lightData.isActiveAndEnabled) return; int lightIdx = lightData.lightIdxForCachedShadows; - Debug.Assert(lightIdx >= 0); if (!m_PlacedShadows.ContainsKey(lightIdx)) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs index 8332db2b832..23b4637c73c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs @@ -192,6 +192,13 @@ public TextureHandle GetOutputTexture(RenderGraph renderGraph) if (m_UseSharedTexture) { Debug.Assert(m_Output.IsValid()); + var requestedDesc = GetAtlasDesc(); + // We check if we need to refresh the desc. It is needed for directional lights. + if (renderGraph.GetTextureDesc(m_Output).width != requestedDesc.width) + { + renderGraph.RefreshSharedTextureDesc(m_Output, requestedDesc); + } + return m_Output; // Should always be valid. } else diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs index 634456a99f7..3de9c87f5d1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs @@ -358,7 +358,7 @@ public void InitShadowManager(HDRenderPipelineRuntimeResources renderPipelineRes HDShadowAtlas.BlurAlgorithm cascadeBlur = GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS ? HDShadowAtlas.BlurAlgorithm.IM : HDShadowAtlas.BlurAlgorithm.None; HDShadowAtlas.HDShadowAtlasInitParameters dirAtlasInitParams = punctualAtlasInitParams; - dirAtlasInitParams.useSharedTexture = false; + dirAtlasInitParams.useSharedTexture = true; dirAtlasInitParams.width = 1; dirAtlasInitParams.height = 1; dirAtlasInitParams.atlasShaderID = HDShaderIDs._ShadowmapCascadeAtlas; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/SimpleLit.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/SimpleLit.hlsl index 0748c7e8119..aa9cfcdbade 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/SimpleLit.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/SimpleLit.hlsl @@ -235,6 +235,14 @@ PreLightData GetPreLightData(float3 V, PositionInputs posInput, inout BSDFData b return preLightData; } +NormalData ConvertSurfaceDataToNormalData(SurfaceData surfaceData) +{ + NormalData normalData; + normalData.normalWS = surfaceData.normalWS; + normalData.perceptualRoughness = PerceptualSmoothnessToPerceptualRoughness(surfaceData.perceptualSmoothness); + return normalData; +} + #ifdef HAS_LIGHTLOOP bool IsNonZeroBSDF(float3 V, float3 L, PreLightData preLightData, BSDFData bsdfData) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index ef817e9b126..43480d54574 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -1182,6 +1182,9 @@ unsafe internal void UpdateShaderVariablesGlobalCB(ref ShaderVariablesGlobal cb, cb._DeExposureMultiplier = m_AdditionalCameraData == null ? 1.0f : m_AdditionalCameraData.deExposureMultiplier; + // IMPORTANT NOTE: This checks if we have Movec and not Transparent Motion Vectors because in that case we need to write camera motion vectors + // for transparent objects, otherwise the transparent objects will look completely broken upon motion if Transparent Motion Vectors is off. + // If TransparentsWriteMotionVector the camera motion vectors are baked into the per object motion vectors. cb._TransparentCameraOnlyMotionVectors = (frameSettings.IsEnabled(FrameSettingsField.MotionVectors) && !frameSettings.IsEnabled(FrameSettingsField.TransparentsWriteMotionVector)) ? 1 : 0; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 2e6137c8a3c..0144ef475ce 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -4614,6 +4614,14 @@ class UberPostPassData TextureHandle UberPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle logLut, TextureHandle bloomTexture, TextureHandle source) { bool isSceneView = hdCamera.camera.cameraType == CameraType.SceneView; + var featureFlags = GetUberFeatureFlags(isSceneView); + // If we have nothing to do in Uber post we just skip it. + if (featureFlags == UberPostFeatureFlags.None && !m_ColorGradingFS && !m_BloomFS && + m_CurrentDebugDisplaySettings.data.fullScreenDebugMode != FullScreenDebugMode.ColorLog) + { + return source; + } + using (var builder = renderGraph.AddRenderPass("Uber Post", out var passData, ProfilingSampler.Get(HDProfileId.UberPost))) { TextureHandle dest = GetPostprocessOutputHandle(renderGraph, "Uber Post Destination"); @@ -4622,7 +4630,7 @@ TextureHandle UberPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle // if they are used or not so they can set default values if needed passData.uberPostCS = defaultResources.shaders.uberPostCS; passData.uberPostCS.shaderKeywords = null; - var featureFlags = GetUberFeatureFlags(isSceneView); + passData.uberPostKernel = passData.uberPostCS.FindKernel("Uber"); if (PostProcessEnableAlpha()) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index f37382c73e2..b5f37cc6919 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -2070,6 +2070,8 @@ AOVRequestData aovRequest var decalCullingResults = renderRequest.cullingResults.decalCullResults; var target = renderRequest.target; + m_FullScreenDebugPushed = false; + // Updates RTHandle hdCamera.BeginRender(cmd); @@ -2688,7 +2690,9 @@ public Texture2D ExportSkyToTexture(Camera camera) static bool NeedMotionVectorForTransparent(FrameSettings frameSettings) { - return frameSettings.IsEnabled(FrameSettingsField.TransparentsWriteMotionVector); + // IMPORTANT NOTE: This is not checking for Transparent Motion Vectors because we need to explicitly write camera motion vectors + // for transparent objects too, otherwise the transparent objects will look completely broken upon motion if Transparent Motion Vectors is off. + return frameSettings.IsEnabled(FrameSettingsField.MotionVectors); } /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs index 2f4262203fe..7c6c05de623 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs @@ -53,7 +53,10 @@ public enum ColorBufferFormat public enum CustomBufferFormat { /// Regular R8G8B8A8 format. - R8G8B8A8 = GraphicsFormat.R8G8B8A8_SNorm, + [InspectorName("Signed R8G8B8A8")] + SignedR8G8B8A8 = GraphicsFormat.R8G8B8A8_SNorm, + /// Regular R8G8B8A8 format. + R8G8B8A8 = GraphicsFormat.R8G8B8A8_UNorm, /// R16G16B16A16 high quality HDR format. R16G16B16A16 = GraphicsFormat.R16G16B16A16_SFloat, /// R11G11B10 medium quality HDR format. diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader index e6c8dc51fab..207db215b64 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/DownsampleDepth.shader @@ -70,7 +70,7 @@ Shader "Hidden/HDRP/DownsampleDepth" float4 depths = GATHER_RED_TEXTURE2D_X(_CameraDepthTexture, s_linear_clamp_sampler, input.texcoord * _ScaleBias.xy + _ScaleBias.zw); outputDepth = MinDepth(depths); #else - uint2 fullResUpperCorner = uint2(input.positionCS.xy * 2.0); + uint2 fullResUpperCorner = uint2((((float2)input.positionCS.xy - 0.5f) * 2.0) + 0.5f); float4 depths; depths.x = LoadCameraDepth(fullResUpperCorner); depths.y = LoadCameraDepth(fullResUpperCorner + uint2(0, 1)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 83363eaab31..00e3cac3be1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -14,7 +14,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" #pragma multi_compile_local_fragment _ USE_FLOWMAP #pragma multi_compile_fragment _ DEBUG_DISPLAY - #pragma multi_compile_local_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH + #pragma multi_compile_fragment SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH SHADOW_VERY_HIGH #pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index 86f45268c11..7bd22553d30 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -13,7 +13,7 @@ float4x4 _PixelCoordToViewDirWS; // Generates a world-space view direction for sky and atmospheric effects float3 GetSkyViewDirWS(float2 positionCS) { - float4 viewDirWS = mul(float4(positionCS.xy + _TaaJitterStrength.xy, 1.0f, 1.0f), _PixelCoordToViewDirWS); + float4 viewDirWS = mul(float4(positionCS.xy, 1.0f, 1.0f), _PixelCoordToViewDirWS); return normalize(viewDirWS.xyz); }