Skip to content

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
joaomelorodrigues:v2.0.0-preview
Open

Fix: LOD camera handling causing font warnings with UI under camera (e.g. react-three/uikit Fullscreen)#285
joaomelorodrigues wants to merge 3 commits intosparkjsdev:v2.0.0-previewfrom
joaomelorodrigues:v2.0.0-preview

Conversation

@joaomelorodrigues
Copy link

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.

…tate and updating world matrix without affecting descendants. Adjusted method signatures to use cameraMatrixWorld and cameraPosition for better clarity and performance.
@joaomelorodrigues joaomelorodrigues changed the title Fix: LOD camera handling causing font warnings with UI under camera (e.g. uikit Fullscreen) Fix: LOD camera handling causing font warnings with UI under camera (e.g. react-three/uikit Fullscreen) Mar 13, 2026
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.

1 participant