Fix: LOD camera handling causing font warnings with UI under camera (e.g. react-three/uikit Fullscreen)#285
Open
joaomelorodrigues wants to merge 3 commits intosparkjsdev:v2.0.0-previewfrom
Conversation
…tate and updating world matrix without affecting descendants. Adjusted method signatures to use cameraMatrixWorld and cameraPosition for better clarity and performance.
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.
Problem
When using react-three/uikit component with and SparkSplatMesh:
driveLod used inputCamera.clone() each frame, which recursively cloned camera children (including fullscreen UI).
inputCamera.updateMatrixWorld(true) forced world-matrix updates on the entire subtree every frame.
These operations caused uikit Text components to re-resolve fonts every frame, producing repeated console warnings:
unknown font family "Gilroy Bold". Available font families are "inter". Falling back to "inter".
Solution
Removed camera cloning. LOD now uses a snapshot of the camera’s world matrix and position (e.g. cameraMatrixWorld.clone(), setFromMatrixPosition()).
Replaced updateMatrixWorld(true) with updateWorldMatrix(true, false) so only the camera’s matrix is updated; camera children (fullscreen UI, etc.) are no longer traversed.
Changes
driveLod: Snapshot camera matrix/position instead of cloning the camera.
driveLod: Use updateWorldMatrix(true, false) instead of updateMatrixWorld(true).
updateLodInstances: Accept cameraMatrixWorld and cameraPosition instead of a camera instance.
No functional change to LOD behavior; only the way camera state is passed into LOD logic.