Skip to content

Clamp SpotLight.outer_angle to pi/2-epsilon at extraction time#24734

Open
dylansechet wants to merge 2 commits into
bevyengine:mainfrom
dylansechet:spot_light
Open

Clamp SpotLight.outer_angle to pi/2-epsilon at extraction time#24734
dylansechet wants to merge 2 commits into
bevyengine:mainfrom
dylansechet:spot_light

Conversation

@dylansechet

@dylansechet dylansechet commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Objective

The documentation currently recommends SpotLight.outer_angle stay <pi/2, but doesn't enforce it anywhere. SpotLight.outer_angle = pi/2 is fundamentally broken, notably causing issues with gpu light clustering.

This fixes #24721.

Solution

Clamp outer_angle to pi/2 - epsilon at extraction time and warn the user if it's out of range.

Testing

Tested the scene from #24721.

Spot lights require `outer_angle < π/2`",
outer_angle
);
outer_angle = core::f32::consts::FRAC_PI_2 - 1e-4;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 1e-4 is completely arbitrary

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 24, 2026
@kfc35 kfc35 added this to the 0.19.1 milestone Jun 24, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Jun 24, 2026
/// Angle defining the distance from the spot light direction to the outer limit
/// of the light's cone of effect.
/// `outer_angle` should be < `PI / 2.0`.
/// `PI / 2.0` defines a hemispherical spot light, but shadows become very blocky as the angle

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not true anymore? Just wondering the reason for the removal

@dylansechet dylansechet Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like publicly documenting the behavior of an unsupported value sends a confusing message. To me this read as "pi/2 is possible, with the only downside that you might get weird shadows".

@kfc35 kfc35 added the D-Straightforward Simple bug fixes and API improvements, docs, test and examples label Jun 24, 2026
@JMS55 JMS55 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Point lights artifacts on sponza on 0.19.

3 participants