From 12cd5ddc7e3aee07e253b6f90184217ce7ae67e5 Mon Sep 17 00:00:00 2001 From: Kenny Tan Date: Mon, 27 Sep 2021 12:19:25 +0800 Subject: [PATCH 1/2] Fix for perspective lighting 2d --- .../Shaders/2D/Sprite-Lit-Default.shader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader b/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader index d2ea9e8732b..383d414f77a 100644 --- a/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader +++ b/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader @@ -86,7 +86,7 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" o.positionCS = TransformObjectToHClip(v.positionOS); o.uv = TRANSFORM_TEX(v.uv, _MainTex); - o.lightingUV = half2(ComputeScreenPos(o.positionCS).xy); + o.lightingUV = half2(ComputeScreenPos(o.positionCS / o.positionCS.w).xy); o.color = v.color; return o; From c777c68331bb30a87e3c067dd6ebec09a1fe45ea Mon Sep 17 00:00:00 2001 From: Kenny Tan Date: Mon, 27 Sep 2021 12:23:15 +0800 Subject: [PATCH 2/2] update changelog --- 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 b3b4ee1e33e..6f5ba23cbde 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Opacity as Density blending feature for Terrain Lit Shader is now disabled when the Terrain has more than four Terrain Layers. This is now similar to the Height-blend feature for the Terrain Lit Shader. ### Fixed +- Fixed an issue in Sprite-Lit-Default.shader causing 2D lighting in perspective to be incorrect. [case 1315645](https://issuetracker.unity3d.com/issues/lighting-renders-incorrectly-when-using-2d-lighting-and-perspective-camera) - Fixed an issue where the 2D Renderer was not rendering depth and stencil in the normal rendering pass [1259874](https://issuetracker.unity3d.com/product/unity/issues/guid/1259874/) - Fixed an issue where Transparency Sort Mode value is taken from Graphics Settings instead of 2D Renderer [1310652](https://issuetracker.unity3d.com/issues/transparency-sort-mode-value-is-taken-from-graphics-settings-instead-of-2d-forward-renderer) - Fixed an issue where Post Processing doesn't enable when PostProcessData reassigned from the asset selector window.