From aa537da2a6b72342716caaf8bb18c1e6a71b8e76 Mon Sep 17 00:00:00 2001 From: Chris Chu Date: Fri, 23 Jul 2021 17:11:37 +0800 Subject: [PATCH 1/3] Fix for bug with normal map --- .../Runtime/2D/Passes/Utility/RendererLighting.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs b/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs index 41d47175fee..4b3a60e12c2 100644 --- a/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs +++ b/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs @@ -98,7 +98,7 @@ public static void CreateNormalMapRenderTexture(this IRenderPass2D pass, Renderi descriptor.graphicsFormat = GetRenderTextureFormat(); descriptor.useMipMap = false; descriptor.autoGenerateMips = false; - descriptor.depthBufferBits = 0; + descriptor.depthBufferBits = pass.rendererData.useDepthStencilBuffer ? 32 : 0; descriptor.msaaSamples = renderingData.cameraData.cameraTargetDescriptor.msaaSamples; descriptor.dimension = TextureDimension.Tex2D; From aa1d765bf5068e13b978959dad2b9fe22b67aece Mon Sep 17 00:00:00 2001 From: Chris Chu Date: Sat, 24 Jul 2021 03:01:05 +0800 Subject: [PATCH 2/3] Fixed issue with normal map not clearing depth --- .../Runtime/2D/Passes/Utility/RendererLighting.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs b/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs index d3b3995bee3..dc63977005b 100644 --- a/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs +++ b/com.unity.render-pipelines.universal/Runtime/2D/Passes/Utility/RendererLighting.cs @@ -510,7 +510,7 @@ public static void RenderNormals(this IRenderPass2D pass, ScriptableRenderContex else cmd.SetRenderTarget(pass.rendererData.normalsRenderTarget.Identifier(), RenderBufferLoadAction.DontCare, storeAction); - cmd.ClearRenderTarget(false, true, k_NormalClearColor); + cmd.ClearRenderTarget(pass.rendererData.useDepthStencilBuffer, true, k_NormalClearColor); context.ExecuteCommandBuffer(cmd); cmd.Clear(); From cfebee4cb35a4a7dca7f270db7e01d319818342a Mon Sep 17 00:00:00 2001 From: Chris Chu Date: Wed, 28 Jul 2021 13:50:27 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- com.unity.render-pipelines.universal/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index aa5b61d23bb..a17ba8d2ffc 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -84,6 +84,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where Sprite type Light2Ds were missing a default sprite - Fixed an issue where ShadowCasters were sometimes being rendered twice in the editor while in playmode. - Fixed an issue where ShadowCaster2D was generating garbage when running in the editor. [case 1304158](https://issuetracker.unity3d.com/product/unity/issues/guid/1304158/) +- Fixed an issue where the 2D Renderer was not rendering depth and stencil in the normal rendering pass - Fixed an issue where 2D lighting was incorrectly calculated when using a perspective camera. - Fixed an issue where objects in motion might jitter when the Pixel Perfect Camera is used. [case 1300474](https://issuetracker.unity3d.com/issues/urp-characters-sprite-repeats-in-the-build-when-using-pixel-perfect-camera-and-2d-renderer) - Fixed an issue where filtering in the scene view would not properly highlight the filtered objects. case 1324359