How SceneRecorder Works?

Hello friends
I have a question regarding the SceneRecorder class and the delta file in Babylon JS.
This is the link to documentation Applying Delta Changes To A Scene | Babylon.js Documentation

I just don’t understand what are the changes that it records. I tried it on some of my models and then applied the delta file on the same models but it didn’t record all of the changes and it applied very few settings to the new model.
Roughness, Metallic and Transparency changes for example where applied to the new model but the rest of the changes where ignored.

Can anyone explain to me how the SceneRecorder works? Why aren’t all the changes to the model being recorded?

This is a very important topic for me because I am wasting a lot of time applying the settings to the model that my friend is sending to me.

Any help will be appreciated
Thanks in advance

Hey! it records simple properties by comparing the save state (serialized state)
For instance it will not record when you affect a new object (like foo.bar = new …)

If you can repro some issues you have with recording simple properties in the playground I will gladly fix it.

2 Likes

Thank you for the reply @Deltakosh
Can you please give examples of the simple properties?

For me the only properties that work are Roughness, Metallic and Transparency

For instance I started recording and made some changes and most of them were not recorded or were not applied (Color, index of refraction were not applied)

Here is the JSON file that it generated

{

“cameras”: [

{

  "alpha": 7.288981332062524,

  "beta": 1.195981799622413,

  "position": [0.2716048713764323, 0.23497520230713193, 0.4420880196101331],

  "__state": { "id": "default camera" }

}

],

“materials”: [

{

  "metallic": 1,

  "roughness": 0.26,

  "metallicF0Factor": 0.61,

  "albedo": [0, 0.03287591694838383, 1],

  "alpha": 0.54,

  "__state": { "id": "01 - Default" }

},

{

  "metallic": 1,

  "roughness": 0.26,

  "metallicF0Factor": 0.61,

  "albedo": [0, 0.03287591694838383, 1],

  "id": "01 - Default",

  "name": "01 - Default",

  "alpha": 0.54,

  "__state": { "id": "01 - Default" }

},

{

  "metallicF0Factor": 0.61,

  "albedo": [0, 0.03287591694838383, 1],

  "microSurface": 1,

  "disableLighting": false,

  "enableSpecularAntiAliasing": true,

  "id": "01 - Default",

  "name": "01 - Default",

  "alpha": 0.54,

  "__state": { "id": "01 - Default" }

},

{

  "useSpecularOverAlpha": true,

  "roughness": 0.26,

  "twoSidedLighting": true,

  "id": "01 - Default",

  "name": "01 - Default",

  "alpha": 0.54,

  "backFaceCulling": false,

  "__state": { "id": "01 - Default" }

}

]

}

Another question if I may @Deltakosh
Clear Coat, Sheen, Anisotropic, Subsurface, Levels ……
Are those settings considered simple or not?

Thanks in advance :+1:

Ok thanks, please provide a working repro in the Playground and I will make sure to make it work (please include all properties you want to see recorded)

@Deltakosh here is a working playground
https://playground.babylonjs.com/#0R1EDI#40
Please open the inspector to make changes and then click on the white sphere to download the delta file

@Deltakosh If you don’t mind me asking
I told you about my problem that I am trying to save the settings of the models and the textures added.
I am trying a different solution other than using SceneRecorder I am exporting the entire scene as GLB
using the Export To GLB button in the Tools tab of the inspector.
But the problem remains the same as not all the changes are being saved!

Please can you help me find a solution?

Wait! export to GLB must capture all your changes. Can you provide a repro for that as well? (adding @Drigax )

1 Like

I’m so sorry but I do not understand what you try to demonstrate here. I do not see code changing properties in your sample. What property are you changing that is not recorded?

The changes that I’m making to the model are through the inspector

Ok, I will provide something that shows what I did with the Export to GLB button

Here is a video where I am uploading a car model. I made some changes like Metallic, Roughness, F0 Factor, Index Of Refraction and I’m enabling Clear Coat.
I am exporting the scene as GLB then I upload the file to sandbox.
You can see that not all changes have been applied like F0 Factor, Index Of Refraction and enabling Clear Coat. Only Metallic and Roughness have been applied.

Thank you for your time @Deltakosh :pray: