-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Port] [2023.2] Added custom light data shadow and light layer sync w…
…ith the main light. Fixes - Setting shadow rendering layer is not changing shadow when using “shadowRenderingLayers” in the script https://jira.unity3d.com/browse/UUM-28061 Added logic similar to UI. Where we replace base light component renderingLayerMask with either shadow or light layers. Which later used for shadow drawing.
- Loading branch information
1 parent
a297a97
commit a0dbcb4
Showing
3 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using NUnit.Framework; | ||
|
||
namespace UnityEngine.Rendering.Universal.Tests | ||
{ | ||
[TestFixture] | ||
class LightTests | ||
{ | ||
[Test] | ||
public void TestMainLightRenderingLayerMaskSyncWithUniversalLightAndShadowLayers() | ||
{ | ||
var lightObject = new GameObject("Light"); | ||
var light = lightObject.AddComponent<Light>(); | ||
var lightData = light.GetUniversalAdditionalLightData(); | ||
|
||
lightData.renderingLayers = (1 << 1); | ||
lightData.shadowRenderingLayers = (1 << 2); | ||
|
||
lightData.customShadowLayers = false; | ||
Assert.AreEqual(light.renderingLayerMask, lightData.renderingLayers); | ||
|
||
lightData.customShadowLayers = true; | ||
Assert.AreEqual(light.renderingLayerMask, lightData.shadowRenderingLayers); | ||
|
||
lightData.customShadowLayers = false; | ||
lightData.renderingLayers = (1 << 3); | ||
lightData.shadowRenderingLayers = (1 << 4); | ||
Assert.AreEqual(light.renderingLayerMask, lightData.renderingLayers); | ||
|
||
lightData.customShadowLayers = true; | ||
lightData.renderingLayers = (1 << 5); | ||
lightData.shadowRenderingLayers = (1 << 6); | ||
Assert.AreEqual(light.renderingLayerMask, lightData.shadowRenderingLayers); | ||
|
||
Object.DestroyImmediate(lightObject); | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightTests.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.