Skip to content

Commit fd01370

Browse files
JarkkoUnityEvergreen
authored andcommitted
Fixed HDRP area light culling
Fixed HDRP area light culling
1 parent 85e33e6 commit fd01370

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,15 +3223,23 @@ void UpdateRectangleLightBounds()
32233223
float halfWidth = m_ShapeWidth * 0.5f;
32243224
float halfHeight = m_ShapeHeight * 0.5f;
32253225
float diag = Mathf.Sqrt(halfWidth * halfWidth + halfHeight * halfHeight);
3226-
legacyLight.boundingSphereOverride = new Vector4(0.0f, 0.0f, 0.0f, Mathf.Max(range, diag));
3226+
legacyLight.boundingSphereOverride = new Vector4(0.0f, 0.0f, 0.0f, range + diag);
3227+
}
3228+
3229+
void UpdateDiscLightBounds()
3230+
{
3231+
legacyLight.useShadowMatrixOverride = false;
3232+
// TODO: Don't use bounding sphere overrides. Support this properly in Unity native instead.
3233+
legacyLight.useBoundingSphereOverride = true;
3234+
legacyLight.boundingSphereOverride = new Vector4(0.0f, 0.0f, 0.0f, range + m_ShapeWidth);
32273235
}
32283236

32293237
void UpdateTubeLightBounds()
32303238
{
32313239
legacyLight.useShadowMatrixOverride = false;
32323240
// TODO: Don't use bounding sphere overrides. Support this properly in Unity native instead.
32333241
legacyLight.useBoundingSphereOverride = true;
3234-
legacyLight.boundingSphereOverride = new Vector4(0.0f, 0.0f, 0.0f, Mathf.Max(range, m_ShapeWidth * 0.5f));
3242+
legacyLight.boundingSphereOverride = new Vector4(0.0f, 0.0f, 0.0f, range + m_ShapeWidth * 0.5f);
32353243
}
32363244

32373245
void UpdateBoxLightBounds()
@@ -3278,6 +3286,9 @@ void UpdateBounds()
32783286
case LightType.Rectangle:
32793287
UpdateRectangleLightBounds();
32803288
break;
3289+
case LightType.Disc:
3290+
UpdateDiscLightBounds();
3291+
break;
32813292
case LightType.Tube:
32823293
UpdateTubeLightBounds();
32833294
break;

0 commit comments

Comments
 (0)