Skip to content

Commit c36a2d3

Browse files
committed
Support rotating the resulting reflections, not just rotating the proxy / influence. This is necessary to handle reflection probes inside of prefabs, placed into scenes at arbitrary orientations, as well as to support streaming sub-scenes in an arbitrary orientations.
1 parent 0738f01 commit c36a2d3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

com.unity.render-pipelines.high-definition/Runtime/Lighting/LightEvaluation.hlsl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,13 @@ float EvaluateLight_EnvIntersection(float3 positionWS, float3 normalWS, EnvLight
587587
// We can reuse dist calculate in LS directly in WS as there is no scaling. Also the offset is already include in light.capturePositionRWS
588588
R = (positionWS + projectionDistance * R) - light.capturePositionRWS;
589589

590+
// custom-begin
591+
// Support rotating the resulting reflections, not just rotating the proxy / influence.
592+
// This is necessary to handle reflection probes inside of prefabs, placed into scenes at arbitrary orientations,
593+
// as well as to support streaming sub-scenes in an arbitrary orientations.
594+
R = mul(R, worldToPS);
595+
// custom-end
596+
590597
weight = InfluenceSphereWeight(light, normalWS, positionWS, positionIS, dirIS);
591598
}
592599
else if (influenceShapeType == ENVSHAPETYPE_BOX)
@@ -596,6 +603,10 @@ float EvaluateLight_EnvIntersection(float3 positionWS, float3 normalWS, EnvLight
596603
// We can reuse dist calculate in LS directly in WS as there is no scaling. Also the offset is already include in light.capturePositionRWS
597604
R = (positionWS + projectionDistance * R) - light.capturePositionRWS;
598605

606+
// custom-begin
607+
R = mul(R, worldToPS);
608+
// custom-end
609+
599610
weight = InfluenceBoxWeight(light, normalWS, positionWS, positionIS, dirIS);
600611
}
601612

0 commit comments

Comments
 (0)