Skip to content

Visualization: in-memory round-trip for Serialize-without-materials test#18569

Merged
bkaradzic-microsoft merged 2 commits into
BabylonJS:masterfrom
bkaradzic-microsoft:playground-serialize-without-materials-roundtrip
Jun 13, 2026
Merged

Visualization: in-memory round-trip for Serialize-without-materials test#18569
bkaradzic-microsoft merged 2 commits into
BabylonJS:masterfrom
bkaradzic-microsoft:playground-serialize-without-materials-roundtrip

Conversation

@bkaradzic-microsoft

Copy link
Copy Markdown
Member

Summary

Repoints the Serialize scene without materials visualization test (#PH4DEZ#1 -> #PH4DEZ#4).

The previous revision's only DOM usage was a file download (createElement('a') + createEvent + link.dispatchEvent) with no visual effect. #PH4DEZ#4 instead performs a real in-memory serialization round-trip:

  1. serialize the sphere hierarchy with SceneSerializer.SerializeMesh;
  2. reload it via SceneLoader.ImportMeshAsync(null, "", "data:" + json, scene);
  3. render the deserialized scene.

This actually validates serialization correctness (not just that it doesn't throw), modeled on the glTF serializer round-trip #KU72PX. The browser-only .babylon download is kept but guarded on document.createEvent, so it is skipped where the DOM isn't available.

Motivation: the same shared snippet is used by BabylonNative's visual suite, which has no DOM. The round-trip lets both web and native run the test without faking DOM APIs. Mirrors BabylonNative PR BabylonJS/BabylonNative#1708.

Visual impact

The rendered scene is unchanged (same sphere hierarchy), so the serializeWithoutMaterials.png reference is expected to still match — the BabylonNative side validates against the same reference with the new revision (248 px diff, well within tolerance). No reference image regeneration is included; CI's Playwright run will confirm.

@bjsplat

bjsplat commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the visualization test configuration to point the “Serialize scene without materials” test at a newer Playground revision that performs an in-memory serialization round-trip (better suited for non-DOM environments like BabylonNative) while keeping the same expected rendered output.

Changes:

  • Repointed the “Serialize scene without materials” visualization test Playground ID from #PH4DEZ#1 to #PH4DEZ#4.

@bjsplat

bjsplat commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

Comment thread packages/tools/tests/test/visualization/config.json
@bjsplat

bjsplat commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Snapshot stored with reference name:
refs/pull/18569/merge

Test environment:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18569/merge/index.html

To test a playground add it to the URL, for example:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18569/merge/index.html#WGZLGJ#4600

Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves):

https://playground.babylonjs.com/?snapshot=refs/pull/18569/merge
https://sandbox.babylonjs.com/?snapshot=refs/pull/18569/merge
https://gui.babylonjs.com/?snapshot=refs/pull/18569/merge
https://nme.babylonjs.com/?snapshot=refs/pull/18569/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/18569/merge#BCU1XR#0

If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools.

@bkaradzic-microsoft bkaradzic-microsoft enabled auto-merge (squash) June 11, 2026 23:49
@bjsplat

bjsplat commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

13 passed, 0 leaked out of 13 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (13)
Scenario Package
Core Feature Stack @babylonjs/core
Core Rendering Materials Shadows Stack @babylonjs/core
Core Textures Render Targets PostProcess Stack @babylonjs/core
GUI Fullscreen UI Controls @babylonjs/gui
GUI Mesh ADT Controls @babylonjs/gui
Loaders Boombox Import @babylonjs/loaders
Loaders OBJ Direct Load @babylonjs/loaders
Loaders STL Direct Load @babylonjs/loaders
Materials Library Stack @babylonjs/materials
Serializers glTF Export @babylonjs/serializers
Serializers GLB Export @babylonjs/serializers
PostProcesses Digital Rain Stack @babylonjs/post-processes
Procedural Textures Stack @babylonjs/procedural-textures

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

13 passed, 0 leaked out of 13 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (13)
Scenario Package
Core Feature Stack @babylonjs/core
Core Rendering Materials Shadows Stack @babylonjs/core
Core Textures Render Targets PostProcess Stack @babylonjs/core
GUI Fullscreen UI Controls @babylonjs/gui
GUI Mesh ADT Controls @babylonjs/gui
Loaders Boombox Import @babylonjs/loaders
Loaders OBJ Direct Load @babylonjs/loaders
Loaders STL Direct Load @babylonjs/loaders
Materials Library Stack @babylonjs/materials
Serializers glTF Export @babylonjs/serializers
Serializers GLB Export @babylonjs/serializers
PostProcesses Digital Rain Stack @babylonjs/post-processes
Procedural Textures Stack @babylonjs/procedural-textures

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

bkaradzic-microsoft and others added 2 commits June 12, 2026 15:40
#PH4DEZ now does an in-memory serialization round-trip (serialize ->
SceneLoader.ImportMeshAsync("data:" + json) -> render the deserialized
scene) instead of a DOM file download, modeled on the glTF serializer
#KU72PX. This validates serialization correctness with no DOM dependency
and lets BabylonNative run the same shared test without faking DOM APIs
(mirrors BabylonNative PR BabylonJS#1708). The browser-only download is kept but
guarded on document.createEvent. The rendered scene is unchanged (same
sphere hierarchy), so the reference image is expected to still match.
Picks up nightly Playground 20260612.1 which bundles the texture-upload
use-after-free fix from BabylonJS/BabylonNative#1758

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bkaradzic-microsoft bkaradzic-microsoft force-pushed the playground-serialize-without-materials-roundtrip branch from 11c914f to 206184d Compare June 12, 2026 22:40
@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

🟢 Memory Leak Test Results

13 passed, 0 leaked out of 13 scenarios

🟢 All memory leak tests passed — no leaks detected.

Passed Scenarios (13)
Scenario Package
Core Feature Stack @babylonjs/core
Core Rendering Materials Shadows Stack @babylonjs/core
Core Textures Render Targets PostProcess Stack @babylonjs/core
GUI Fullscreen UI Controls @babylonjs/gui
GUI Mesh ADT Controls @babylonjs/gui
Loaders Boombox Import @babylonjs/loaders
Loaders OBJ Direct Load @babylonjs/loaders
Loaders STL Direct Load @babylonjs/loaders
Materials Library Stack @babylonjs/materials
Serializers glTF Export @babylonjs/serializers
Serializers GLB Export @babylonjs/serializers
PostProcesses Digital Rain Stack @babylonjs/post-processes
Procedural Textures Stack @babylonjs/procedural-textures

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

⚡ Performance Test Results

🟢 All performance tests passed — no regressions detected.

@bkaradzic-microsoft bkaradzic-microsoft merged commit 7399905 into BabylonJS:master Jun 13, 2026
21 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.

5 participants