Skip to content

Base the LoD pixel limit on the camera projection - #488

Merged
dmarcos merged 1 commit into
sparkjsdev:mainfrom
oscarlorentzon:xr-lod-fov
Oct 16, 2026
Merged

dmarcos merged 1 commit into
sparkjsdev:mainfrom
oscarlorentzon:xr-lod-fov

Conversation

@oscarlorentzon

Copy link
Copy Markdown
Collaborator

While presenting in WebXR, SparkRenderer runs LoD with three.js's XR camera, renderer.xr.getCamera(). The LoD pixel limit came from that camera's fov, which three.js leaves at the 50° default, so LoD picked splats smaller than lodRenderScale asks for. The limit now comes from the camera's projection matrix.

three.js rebuilds the XR camera's projection each time it updates that camera, by default on every render, which can change the limit slightly from one frame to the next. driveLod now ignores relative changes below 1e-5, so those changes do not rerun LoD.

Verification

  • The new projection test fails on main.

The LoD pixel limit used the field of view, which three.js leaves at
its default on the WebXR camera, and now uses the projection matrix.
Changes in the limit too small to matter no longer rerun LoD.
@dmarcos
dmarcos merged commit 5b95990 into sparkjsdev:main Oct 16, 2026
2 checks passed
@dmarcos

dmarcos commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants