Skip to content

Handle preUpdate ahead of updating material uniforms to avoid 1 frame latency#391

Open
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:fix-pre-update
Open

Handle preUpdate ahead of updating material uniforms to avoid 1 frame latency#391
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:fix-pre-update

Conversation

@mrxz

@mrxz mrxz commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #390

The preUpdate flag is supposed to ensure the splat update takes place before rendering. While this was technically true, the updated splats were not used in the rendering as the relevant uniforms had already been set. This also meant that the uniforms referred to values from an accumulator that had already been released.

This PR moves the updateInternal call to the start of the onBeforeRendering method. In case of preUpdate this would ensure a synchronous update before the uniforms were updated. Whereas the default case is still to schedule the update asynchronously through setTimeout.

Note that whether or not the result of update is visible that same frame still depends on whether or not the mappings are compatible, though in simple cases like recolor this holds.

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.

Make recolor update on the same frame

1 participant