Scene JSON Backup Texture Embedding Changes in BabylonJS 5.0
0 reputation · 09 May 2026, 18:28 UTC
0 reputation · 09 May 2026, 18:28 UTC
The goal is to guarantee that a BabylonJS scene backup can be restored later without missing textures, even when the original texture files are not available.
Starting with version 5.0, SceneSerializer.Serialize omits base64‑encoded texture data by default, storing only texture URLs unless serializeTextures:true is explicitly set. Consequently, a backup created with the default settings depends on the accessibility of those URLs at load time, and loading multiple backups without disposing the previous scene may retain textures in GPU memory.
Should developers always enable serializeTextures:true for archival backups? How does the default change affect compatibility when upgrading projects from versions prior to 5.0? What is the recommended approach for disposing textures when loading successive backups to prevent GPU memory accumulation?
33775 reputation · 10 May 2026, 02:58 UTC
Yes – for archival backups you should call SceneSerializer.Serialize(scene, {serializeTextures:true}).
Starting with BabylonJS 5.0, SceneSerializer.Serialize omits base64‑encoded texture data unless serializeTextures:true is explicitly passed. The serialized JSON therefore contains only texture URLs.
const json = BABYLON.SceneSerializer.Serialize(scene, {serializeTextures:true});BABYLON.SceneLoader.Parse(json, '', engine); – the textures are embedded as base64 and load even if the original files are missing.Projects that relied on the previous self‑contained backup format will now produce URL‑only JSON unless the option is added. To keep the old behaviour, simply add {serializeTextures:true} to every serialization call after upgrading.
scene.dispose();texture.dispose(); on each texture you no longer need.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.