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:

Do you mind changing them by code so I can see them?

1 Like

This one is for @Drigax

1 Like

Thanks, These are material extensions that aren’t supported yet at export. Usually we implement import of a glTF using these experimental extensions early for evaluation, then support export later. The unsupported material parameters aren’t included in the exported scene.

However, we have a few open issues for some of the material parameters like clear coat are first on my list of extensions to add, now that they’ve been approved. IOR and specular F0 have just recently been approved as well (I believe as of last week), and will be added shortly as I get our exporters up to speed.

I updated the docs to give a clearer picture of what functionality is currently supported for export: glTF Exporter | Babylon.js Documentation

1 Like

Thanks for the explanation @Drigax .

Does that also apply to the SceneRecorder class and why it is not applying all the changes?
If so, is there another way to save the settings of a GLB model?

Thanks in advance!

This should work with the SceneRecorder. As soon as you create a PG with the code highlighting the issue I will fix it

1 Like

@Deltakosh I’m sorry but I can not provide the code in the playground because the project uses react and many other things.

But, here is a video showing my problem while I’m using sandbox. I start recording, make some changes, apply the delta file and as you can see some changes are not being applied.

As the babylon daddy is off for a couple days, adding @Evgeni_Popov in case he got a few spare cycles today, otherwise this will be done I bet on Monday.

1 Like

PR on its way:

2 Likes