Recommended approach for efficiently comparing two scenes? (.babylon files)

TL;DR: I’ll take any tips for comparing in an efficient way two large but (in theory) mostly identical scenes, in order to facilitate troubleshooting and iterations with 3D artists.

I am working on a project where the first step is to swap two relatively large (10-20MB) but similar scenes, which I have not created myself (i.e. I have limited visibility so far into how those scenes are produced). I cannot share much details but basically, the scenes’ boundaries are supposed to be the same (overall dimension, meshes, textures, lights), and only a few objects at the center of the scene are expected to change.

What I did first was to open two sandboxes side-by-side, and visually inspect the two scenes to get familiar with their common structure, with what differs, with the naming conventions used, etc.

Everything looked good in the sandboxes… Until the first attempt to swap scenes in the app :slight_smile:
At that point I discovered that for some reason the new scene was downscaled by 10x.
I manually scaled _root_ in the sandbox and exported a modified version. That addressed the scaling issue, but the lights and some material rendering feel a bit off in the app. So I suspect that scaling only the meshes was not enough. Also, some simple properties like alpha values are not set properly in the new scene.

Bottom line: there is to a collection of small things that need to be addressed by the 3D artist before I can “just” swap the scenes, re-wire what needs to be in the app, and continue the development of its functionalities.

To facilitate the discussion, I would like to find an efficient way to extract an exhaustive list of things that differ between the scenes. I have attempted something along the lines of:

  1. dump a pretty print of the .babylon files
    python3 -m json.tool scene1.babylon > scene1.json
    python3 -m json.tool scene2.babylon > scene2.json
  2. compare the pretty prints
    diff -y scene1.json scene2.json | more

This does expose the difference between the scenes, but the volume of info produced isn’t practical… Also, the fact that I am not familiar with each and every settings described in the .babylon files doesn’t help filtering useful info from noise…

How do you guys tackle this type of task? Thanks a bunch!

You could try to use the SceneRecorder but it may not work as it is meant to compare two states of a single scene, not 2 different scenes…


const sr = new BABYLON.SceneRecorder();
sr._trackedScene = secondScene;

That was an interesting idea @Evgeni_Popov , unfortunately the library doesn’t seem fit currently for that sort of abuse :slight_smile:

I’ve recreated the issue in a PG:

In fact it won’t work because the comparison code is based on the unique ids of the objects. None of the objects from scene1 will have the same id than objects from scene2, so even if it worked the code would not be able to find similar objects.

Apart from comparing the json of scene1 against scene2 as you did above, I don’t really see how to do it…

Ah that makes sense… Thanks!

I guess I could build on my initial approach and add some intelligence to the comparison process. But that would require a certain level of acquaintance with the structure of the data, which I don’t have yet. So not exactly the quick fix that I was hoping for.

If I keep running into this sort of situation, I will probably make time for this. Meanwhile I am still interested in the general troubleshooting workflows used by the community! :slight_smile: