Skip to content

Conversation

@mrxz
Copy link
Collaborator

@mrxz mrxz commented Dec 15, 2025

Addresses #237 by expanding PackedSplats.dispose() to also dispose the spherical harmonics textures stored in extra as well as setting all references to (large) arrays to null. The latter is done since the PackedSplat and Texture instances themselves are still retained in various places throughout, including dyno programs. Ideally these would be GC'ed but it's impractical hunting these down.

There is a slight change in behaviour. Previously it was possible to call splatMesh.dispose() and then use it again later. Generally in Three.js calling dispose implies the object won't be used any more and I think the same should hold for Spark for consistency. Only the interactivity example made use of this behaviour, but has been fixed.

That said, it was a crude way to dispose of the textures (GPU resources) while still keeping a copy of the splat data in memory. Not sure if this was intended as a way to keep VRAM usage lower in the interactivity example, but if so, we should probably introduce a proper method for this purpose.

@dmarcos
Copy link
Contributor

dmarcos commented Dec 16, 2025

Thank you!

@dmarcos dmarcos merged commit a573987 into sparkjsdev:main Dec 16, 2025
2 checks passed
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