diff --git a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs index 6548aa12bef..589ea1e56a8 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/LookDev.cs @@ -237,7 +237,12 @@ static void LinkViewDisplayer() static void LinkEnvironmentDisplayer() { - s_EnvironmentDisplayer.OnChangingEnvironmentLibrary += currentContext.UpdateEnvironmentLibrary; + s_EnvironmentDisplayer.OnChangingEnvironmentLibrary += UpdateEnvironmentLibrary; + } + + static void UpdateEnvironmentLibrary(EnvironmentLibrary library) + { + LookDev.currentContext.UpdateEnvironmentLibrary(library); } static void ReloadStage(bool reloadWithTemporaryID) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 9b84a8293ba..289fbde8821 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -33,6 +33,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issues with compositor's undo (cases 1305633, 1307170). - Fixed wrong shader / properties assignement to materials created from 3DsMax 2021 Physical Material. (case 1293576) - Fixed Emissive color property from Autodesk Interactive materials not editable in Inspector. (case 1307234) +- Fixed exception when changing the current render pipeline to from HDRP to universal (case 1306291). +- Fixed an issue in shadergraph when switch from a RenderingPass (case 1307653) +- Fixed LookDev environment library assignement after leaving playmode. +- Fixed a locale issue with the diffusion profile property values in ShaderGraph on PC where comma is the decimal separator. +- Fixed error in the RTHandle scale of Depth Of Field when TAA is enabled. +- Fixed Quality Level set to the last one of the list after a Build (case 1307450) ### Changed - Change the source value for the ray tracing frame index iterator from m_FrameCount to the camera frame count (case 1301356). diff --git a/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md b/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md index cf1840c1227..9dd8da0cd65 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/hair-shader.md @@ -49,10 +49,10 @@ New Materials in HDRP use the [Lit shader](Lit-Shader.md) by default. To create | **Smoothness UV Scale Transform** | Sets the tiling rate (xy) and offsets (zw) for the Smoothness Mask Map. | | **Smoothness Min** | Set the minimum smoothness for this Material. | | **Smoothness Max** | Set the maximum smoothness for this Material. | -| **Specular Color** | Set the color of the primary specular highlight. | -| **Specular Multiplier** | Modifies the **Specular Color** by this multiplier. | +| **Specular Color** | Set the representative color of the highlight that Unity uses to drive both the primary specular highlight color, which is mainly monochrome, and the secondary specular highlight color, which is chromatic.| +| **Specular Multiplier** | Modifies the primary specular highlight by this multiplier. | | **Specular Shift** | Modifies the position of the primary specular highlight. | -| **Secondary Specular Multiplier** | Modifies the **Secondary Specular Color** by this multiplier. | +| **Secondary Specular Multiplier** | Modifies the secondary specular highlight by this multiplier. | | **Secondary Specular Shift** | Modifies the position of the secondary specular highlight | | **Transmission Color** | Set the fraction of specular lighting that penetrates the hair from behind. This is on a per-color channel basis so you can use this property to set the color of penetrating light. Set this to (0, 0, 0) to stop any light from penetrating through the hair. Set this to (1, 1, 1) to have a strong effect with a lot of white light transmitting through the hair. | | **Transmission Rim** | Set the intensity of back lit hair around the edge of the hair. Set this to 0 to completely remove the transmission effect. | diff --git a/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs b/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs index d430005fc9d..2b4d80abbd9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs +++ b/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessBuild.cs @@ -59,6 +59,7 @@ public void OnPreprocessBuild(BuildReport report) // Update all quality levels with the right max lod so that meshes can be stripped. // We don't take lod bias into account because it can be overridden per camera. + int currentQualityLevel = QualitySettings.GetQualityLevel(); int qualityLevelCount = QualitySettings.names.Length; for (int i = 0; i < qualityLevelCount; ++i) { @@ -73,6 +74,7 @@ public void OnPreprocessBuild(BuildReport report) QualitySettings.maximumLODLevel = GetMinimumMaxLoDValue(hdPipelineAsset); } } + QualitySettings.SetQualityLevel(currentQualityLevel, false); } } } 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 a2cf3026925..8a09eaecb62 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -28,7 +28,7 @@ public static IntScalableSetting ShadowResolution(HDLightType lightType, HDRende enum ShadowmaskMode { - ShadowMask, + Shadowmask, DistanceShadowmask } @@ -1086,14 +1086,14 @@ static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner) EditorGUI.BeginProperty(nonLightmappedOnlyRect, s_Styles.nonLightmappedOnly, serialized.nonLightmappedOnly); { EditorGUI.BeginChangeCheck(); - ShadowmaskMode shadowmask = serialized.nonLightmappedOnly.boolValue ? ShadowmaskMode.ShadowMask : ShadowmaskMode.DistanceShadowmask; + ShadowmaskMode shadowmask = serialized.nonLightmappedOnly.boolValue ? ShadowmaskMode.Shadowmask : ShadowmaskMode.DistanceShadowmask; shadowmask = (ShadowmaskMode)EditorGUI.EnumPopup(nonLightmappedOnlyRect, s_Styles.nonLightmappedOnly, shadowmask); if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(owner.targets, "Light Update Shadowmask Mode"); - serialized.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.ShadowMask; + serialized.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.Shadowmask; foreach (Light target in owner.targets) - target.lightShadowCasterMode = shadowmask == ShadowmaskMode.ShadowMask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything; + target.lightShadowCasterMode = shadowmask == ShadowmaskMode.Shadowmask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything; } } EditorGUI.EndProperty(); diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs index cdf11e64587..0e183a0ea23 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileShaderProperty.cs @@ -40,7 +40,7 @@ internal override string GetPropertyBlockString() } /// Float to string convertion function without any loss of precision - string f2s(float f) => System.Convert.ToDouble(f).ToString("0." + new string('#', 339)); + string f2s(float f) => System.Convert.ToDouble(f).ToString("0." + new string('#', 339), CultureInfo.InvariantCulture); return $@"[DiffusionProfile]{referenceName}(""{displayName}"", Float) = {f2s(HDShadowUtils.Asfloat(hash))} diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs index 95d1dec716b..b00fcce6ecb 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubShaderUtilities.cs @@ -275,6 +275,14 @@ public static string RenderQueueName(HDRenderQueue.RenderQueueType value) return result; } + public static bool IsValidRenderingPassValue(HDRenderQueue.RenderQueueType value, bool needAfterPostProcess) + { + if (!needAfterPostProcess && (value == HDRenderQueue.RenderQueueType.AfterPostProcessOpaque || value == HDRenderQueue.RenderQueueType.AfterPostprocessTransparent)) + return false; + + return true; + } + public static bool UpgradeLegacyAlphaClip(IMasterNode1 masterNode) { var clipThresholdId = 8; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs index 39b30d68acf..738720cb50f 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceOptionPropertyBlock.cs @@ -48,6 +48,11 @@ protected override void CreatePropertyGUI() context.globalIndentLevel++; var renderingPassList = HDSubShaderUtilities.GetRenderingPassList(systemData.surfaceType == SurfaceType.Opaque, enabledFeatures == Features.Unlit); // Show after post process for unlit shaders var renderingPassValue = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.GetOpaqueEquivalent(systemData.renderQueueType) : HDRenderQueue.GetTransparentEquivalent(systemData.renderQueueType); + // It is possible when switching from Unlit with an after postprocess pass to any kind of lit shader to get an out of array value. In this case we switch back to default. + if (!HDSubShaderUtilities.IsValidRenderingPassValue(renderingPassValue, enabledFeatures == Features.Unlit)) + { + renderingPassValue = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent; + } var renderQueueType = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent; context.AddProperty(renderingPassText, new PopupField(renderingPassList, renderQueueType, HDSubShaderUtilities.RenderQueueName, HDSubShaderUtilities.RenderQueueName) { value = renderingPassValue }, (evt) => diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs index 8ad381cb913..948128cedf4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs @@ -124,8 +124,11 @@ public List PrepareDensityVolumeData(CommandBuffer cmd, HDCamera internal void ReleaseAtlas() { // Release the atlas so next time the manager is used, it is reallocated with new HDRP settings. - volumeAtlas.Release(); - m_VolumeAtlas = null; + if (m_VolumeAtlas != null) + { + volumeAtlas.Release(); + m_VolumeAtlas = null; + } } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index 8ef6166406e..8ffbd2bf174 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -1571,9 +1571,9 @@ static void DoDepthOfField(in DepthOfFieldParameters dofParameters, CommandBuffe float nearMaxBlur = dofParameters.nearMaxBlur * resolutionScale; // If TAA is enabled we use the camera history system to grab CoC history textures, but - // because these don't use the same RTHandle system as the global one we'll have a - // different scale than _RTHandleScale so we need to handle our own - var cocHistoryScale = RTHandles.rtHandleProperties.rtHandleScale; + // because these don't use the same RTHandleScale as the global one, we need to use + // the RTHandleScale of the history RTHandles + var cocHistoryScale = taaEnabled ? dofParameters.camera.historyRTHandleProperties.rtHandleScale : RTHandles.rtHandleProperties.rtHandleScale; ComputeShader cs; int kernel; diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader index 8a5004a7d6d..41877ceeee7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/UpsampleTransparent.shader @@ -49,9 +49,7 @@ Shader "Hidden/HDRP/UpsampleTransparent" float2 fullResTexelSize = _ScreenSize.zw; float2 halfResTexelSize = 2.0f * fullResTexelSize; - #ifdef BILINEAR - return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_linear_clamp_sampler, ClampAndScaleUVForBilinear(uv, halfResTexelSize), 0.0); - #elif NEAREST_DEPTH + #ifdef NEAREST_DEPTH // The following is an implementation of NVIDIA's http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/OpacityMappingSDKWhitePaper.pdf @@ -101,6 +99,10 @@ Shader "Hidden/HDRP/UpsampleTransparent" return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_point_clamp_sampler, ClampAndScaleUVForPoint(nearestUV), 0); #endif } + #else // BILINEAR + + return SAMPLE_TEXTURE2D_X_LOD(_LowResTransparent, s_linear_clamp_sampler, ClampAndScaleUVForBilinear(uv, halfResTexelSize), 0.0); + #endif }