Skip to content

Commit df7cc1d

Browse files
[Backport 7.x.x] Fix issue with light layers > 7 in the deferred path (#1093)
* Mask layers to consider only the supported 8 bits * changelog Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 714a7b1 commit df7cc1d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9494
- Fixed an issue where manipulating the color wheels in a volume component would reset the cursor every time.
9595
- Fixed an issue where static sky lighting would not be updated for a new scene until it's reloaded at least once.
9696
- Fixed missing include guards in shadow hlsl files.
97+
- Fixed issue with light layers bigger than 8 (and above the supported range).
9798

9899
### Changed
99100
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ void EncodeIntoGBuffer( SurfaceData surfaceData
640640
outGBuffer3 *= GetCurrentExposureMultiplier();
641641

642642
#ifdef LIGHT_LAYERS
643-
OUT_GBUFFER_LIGHT_LAYERS = float4(0.0, 0.0, 0.0, builtinData.renderingLayers / 255.0);
643+
// Note: we need to mask out only 8bits of the layer mask before encoding it as otherwise any value > 255 will map to all layers active
644+
OUT_GBUFFER_LIGHT_LAYERS = float4(0.0, 0.0, 0.0, (builtinData.renderingLayers & 0x000000FF) / 255.0);
644645
#endif
645646

646647
#ifdef SHADOWS_SHADOWMASK

0 commit comments

Comments
 (0)