bug(light): point/spot range is derived from intensity, making every light global #1088
Labels
No labels
Context: Bug
Context: Enhancements
Platform: Android
Platform: Linux
Platform: Web
Platform: Windows
Platform: iOS
Platform: macOS
Release
Target: CI
Target: CLI
Target: Dependency
Target: Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SakulFlee/Orbital#1088
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Point and spot lights are packed with a “range” of
intensity / 0.01. For the all-in-one scene’s intensities of 30–60 this producesrange_sqvalues of 3000–6000, i.e. a radius of ~55–77 world units. The scene is only ~40 units wide, so every point/spot light covers almost every pixel.That explains the measurements:
The shader treats
params.zas a distance-culling radius, but the packed value is derived from intensity, not from a real range.Relevant code:
The existing tests explicitly assert
range_sq == intensity / 0.01, so this is current behavior rather than accidental corruption.Fix direction
KHR_lights_punctualrange when importing; use a sensible engine default when absent.params.wis currently padding.Quick confirmation
A temporary test can change the packed point/spot
range_sqto a fixed value such as100.0(radius 10) and re-capture the all-in-one scene. If deferred lighting and both shadow costs drop sharply, this is confirmed.Acceptance criteria
Confirmed on device with fixed packed ranges:
gpu_deferredgpu_scene_totalAll subpass sums stayed exact;
gpu_light_cullingstayed ~1.05–1.08 ms and the deferred cost collapsed because the lists became sparse. Radius 5/10 screenshots also show hard circular light pools, confirming the cutoff needs smoothing.Implemented on
feat/perf-timingsinb7086621:LightDescriptorhas an explicitrangewithDEFAULT_LIGHT_RANGE = 10.0.with_rangebuilder on bothorbital_lightand ECS descriptors.KHR_lights_punctualimport uses the glTF range, falling back to 10.params.znow packsrange², no longerintensity / 0.01.1 - (d/r)^4)²) to forward/deferred PBR and volumetric lighting so the cutoff is not a hard edge.Next: rebuild the test project from
b7086621, capture the all-in-one scene at the default 10-unit range, and check the light boundaries visually. Then re-run the culling and shadow A/B tests; they should now be meaningful.