Repository navigation
Skip regeneration and sorting when the camera turns in place - #512
Open
vanyathecyborg wants to merge 1 commit into
Open
vanyathecyborg wants to merge 1 commit into
vanyathecyborg wants to merge 1 commit into
Conversation
Generated splats are stored relative to the camera position, view-dependent color reads that position, and the default radial sort orders splats by their distance from it. None of these depend on where the camera looks, yet a turn in place did the work again: - A mesh with spherical harmonics bumped its version on every change of the view matrix, so turning frames generated every splat again and queued a sort. - A turn of more than about 2.6 degrees counted as a view change and asked for a new generation and sort, also under radial sorting. SplatMesh now bumps its version for view-dependent color only when the view origin in object space changes. enableViewToObject still bumps it on any change, since it promises modifiers the whole transform. SparkRenderer counts a change of direction as a view change only under directional sorting. With no new generation on a turn, the generated view can be older than the camera, so LoD traversal reads the camera it is given. Turning in place inside a 15.7M-splat scene with third-order spherical harmonics, drawn with LoD at 2.5M splats, 1920x1080 on an Apple M4 Max in Chrome 158: 900 frames sweeping 60 degrees to each side, each followed by a one-pixel readback so that it waits for the GPU, two alternating runs per build. Frames went from 15.03 to 14.56 ms, frames with a new generation from 31% to 2% (the LoD updates), and sorts from 157 to 21. Unit tests cover radial and directional sorting, a mesh with spherical harmonics on a turn and on a move, enableViewToObject, and LoD following a turn. turn.test.ts checks in the browser that a turn draws exactly what a new generation and sort at that pose draws. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated splats are stored relative to the camera position, view-dependent color reads only that position, and the default radial sort orders splats by distance from it. None of these depend on where the camera looks, yet a turn in place regenerated meshes with spherical harmonics and queued a new sort.
SplatMeshnow bumps its version for view-dependent color only when the view origin changes;enableViewToObjectstill bumps it on any change.SparkRenderertreats a change of direction as a view change only under directional sorting. LoD traversal reads the camera it is given, since the generated view can now be older.Verification
turn.test.ts: it turns the camera in place, then forces a new generation and sort at the same pose.mainthe turn already regenerates and sorts, so the test fails.enableViewToObject, and LoD following a turn.Behaviour change
A custom modifier that reads the view rotation on a mesh with spherical harmonics, without
enableViewToObject, no longer updates on a turn. Setting that flag restores it.🤖 Generated with Claude Code