diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index e51275a0372..81158c24c67 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -131,6 +131,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SSS materials in planar reflections (case 1319027). - Fixed Decal's pivot edit mode 2D slider gizmo not supporting multi-edition - Fixed missing Update in Wizard's DXR Documentation +- Fixed issue were the final image is inverted in the Y axis. Occurred only on final Player (non-dev for any platform) that use Dynamic Resolution Scaling with Contrast Adaptive Sharpening filter. +- Fixed a bug with Reflection Probe baking would result in an incorrect baking reusing other's Reflection Probe baking +- Fixed volumetric fog being visually chopped or missing when using hardware Dynamic Resolution Scaling. +- Fixed generation of the packed depth pyramid when hardware Dynamic Resolution Scaling is enabled. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLit.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLit.hlsl index 340cd438312..3b81107267f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLit.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/StackLit/StackLit.hlsl @@ -4231,7 +4231,7 @@ IndirectLighting EvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput, } lighting.specularReflected = ssrLighting.rgb * lerp(reflectanceFactorB, reflectanceFactorC, bsdfData.coatMask); - reflectionHierarchyWeight = lerp(ssrLighting.a, ssrLighting.a * reflectanceFactorC, bsdfData.coatMask); + reflectionHierarchyWeight = lerp(ssrLighting.a, ssrLighting.a * reflectanceFactorC.x, bsdfData.coatMask); } else { diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader index e1c29124785..b1fc0df495b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FinalPass.shader @@ -93,7 +93,7 @@ Shader "Hidden/HDRP/FinalPass" #if defined(BILINEAR) || defined(CATMULL_ROM_4) || defined(LANCZOS) CTYPE outColor = UpscaledResult(positionNDC.xy); #elif defined(CONTRASTADAPTIVESHARPEN) - CTYPE outColor = LOAD_TEXTURE2D_X(_InputTexture, round(input.texcoord * _ViewPortSize.xy)).CTYPE_SWIZZLE; + CTYPE outColor = LOAD_TEXTURE2D_X(_InputTexture, ((input.texcoord.xy * _UVTransform.xy) + _UVTransform.zw) * _ViewPortSize.xy).CTYPE_SWIZZLE; #else CTYPE outColor = LOAD_TEXTURE2D_X(_InputTexture, positionSS).CTYPE_SWIZZLE; #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index a80e002ca6e..6bb5624993f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -840,13 +840,15 @@ TextureHandle GenerateMaxZPass(RenderGraph renderGraph, HDCamera hdCamera, Textu using (var builder = renderGraph.AddRenderPass("Generate Max Z Mask for Volumetric", out var passData)) { + //TODO: move the entire vbuffer to hardware DRS mode. When Hardware DRS is enabled we will save performance + // on these buffers, however the final vbuffer will be wasting resolution. This requires a bit of more work to optimize. passData.parameters = PrepareGenerateMaxZParameters(hdCamera, depthMipInfo); passData.depthTexture = builder.ReadTexture(depthTexture); - passData.maxZ8xBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one * 0.125f, false, true) + passData.maxZ8xBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one * 0.125f, true, true) { colorFormat = GraphicsFormat.R32_SFloat, enableRandomWrite = true, name = "MaxZ mask 8x" }); - passData.maxZBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one * 0.125f, false, true) + passData.maxZBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one * 0.125f, true, true) { colorFormat = GraphicsFormat.R32_SFloat, enableRandomWrite = true, name = "MaxZ mask" }); - passData.dilatedMaxZBuffer = builder.ReadWriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one / 16.0f, false, true) + passData.dilatedMaxZBuffer = builder.ReadWriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one / 16.0f, true, true) { colorFormat = GraphicsFormat.R32_SFloat, enableRandomWrite = true, name = "Dilated MaxZ mask" })); builder.SetRenderFunc( diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs index dc7be708a91..0b03f76fb6e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/HDUtils.cs @@ -568,6 +568,7 @@ internal static void RestoreRenderPipelineAsset(bool wasUnsetFromQuality, Render internal struct PackedMipChainInfo { public Vector2Int textureSize; + public Vector2Int hardwareTextureSize; public int mipLevelCount; public Vector2Int[] mipLevelSizes; public Vector2Int[] mipLevelOffsets; @@ -590,12 +591,15 @@ public void ComputePackedMipChainInfo(Vector2Int viewportSize) if (viewportSize == mipLevelSizes[0]) return; - textureSize = viewportSize; - mipLevelSizes[0] = viewportSize; + bool isHardwareDrsOn = DynamicResolutionHandler.instance.HardwareDynamicResIsEnabled(); + hardwareTextureSize = isHardwareDrsOn ? DynamicResolutionHandler.instance.ApplyScalesOnSize(viewportSize) : viewportSize; + Vector2 textureScale = isHardwareDrsOn ? new Vector2((float)viewportSize.x / (float)hardwareTextureSize.x, (float)viewportSize.y / (float)hardwareTextureSize.y) : new Vector2(1.0f, 1.0f); + + mipLevelSizes[0] = hardwareTextureSize; mipLevelOffsets[0] = Vector2Int.zero; int mipLevel = 0; - Vector2Int mipSize = viewportSize; + Vector2Int mipSize = hardwareTextureSize; do { @@ -625,11 +629,13 @@ public void ComputePackedMipChainInfo(Vector2Int viewportSize) mipLevelOffsets[mipLevel] = mipBegin; - textureSize.x = Math.Max(textureSize.x, mipBegin.x + mipSize.x); - textureSize.y = Math.Max(textureSize.y, mipBegin.y + mipSize.y); + hardwareTextureSize.x = Math.Max(hardwareTextureSize.x, mipBegin.x + mipSize.x); + hardwareTextureSize.y = Math.Max(hardwareTextureSize.y, mipBegin.y + mipSize.y); } while ((mipSize.x > 1) || (mipSize.y > 1)); + textureSize = new Vector2Int((int)((float)hardwareTextureSize.x * textureScale.x), (int)((float)hardwareTextureSize.y * textureScale.y)); + mipLevelCount = mipLevel + 1; m_OffsetBufferWillNeedUpdate = true; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/SceneObjectIDMap.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/SceneObjectIDMap.cs index 57642b82a45..4c15b9241bf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/SceneObjectIDMap.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/SceneObjectIDMap.cs @@ -260,6 +260,11 @@ int Insert(GameObject gameObject, TCategory category) m_IndexByGameObject.Add(gameObject, index); m_Entries.Insert(index, entry); + for (int i = index + 1; i < m_Entries.Count; ++i) + { + // Upon insertion, all index by game object entries after the insertion point need their index updated. + m_IndexByGameObject[m_Entries[i].gameObject] = i; + } return m_Entries[index].id; }