Skip to content

Size splats by the viewport they are drawn in - #487

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

dmarcos merged 1 commit into
sparkjsdev:mainfrom
oscarlorentzon:xr-render-size

Conversation

@oscarlorentzon

Copy link
Copy Markdown
Collaborator

In WebXR, three.js draws both eyes into one render target, each eye into its own viewport of it, but SparkRenderer sized splats by the whole target. With the eyes side by side, the anti-alias blur added to every splat was half as wide across, and the largest splats were drawn at half their width.

SparkRenderer now sizes splats for the area being drawn, so each eye renders like a desktop view of its size. Custom generators get the same size.

three.js keeps the area being drawn in two places: camera.viewport, which each WebXR eye and ArrayCamera camera is drawn with, and the renderer's current viewport. SparkRenderer prefers camera.viewport, because Reflector, Refractor and Water reset the renderer's, and falls back to the renderer's for setViewport, which sets only that one. three.js picks the viewport in the same order for its transmission pass.

Verification

  • The two new tests fail on main: an eye in a 100×100 viewport of a 200×100 XR target gets 200×100, and a setViewport camera gets the canvas size.
  • npm run test:browser and npm run build pass.

Splats drawn in a viewport smaller than the canvas or render target, such
as one WebXR eye, used the full size, so their anti-alias blur and size
limit were too small. The viewport's size is now used.
@dmarcos
dmarcos merged commit 4f6b09d into sparkjsdev:main Oct 16, 2026
2 checks passed
@dmarcos

dmarcos commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

sweet

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