Bug in fog serialization

1.“scene.fogEnabled” cannot be serialized
2.When my "fogMode " is 0, parameters like "fogColor " cannot be serialized.

My procedure involves creating a scene with fog and exporting it. Upon loading, fogMode or fogEnabled can be invoked to enable fog with previously set parameters

Wanna share a repro?

Due to the fact that I serialize the scene before opening it in other pages, it may not work properly in PG implementation. Here is my portion of code:

When fogMode is 0, this is expected to not store fog data (to save size).
scene.fogEnabled is not a property we store. It is intended to be used as a feature control.

What is your use case? Can you store with fogMode !== 0 and use fogEnabled to control it in your scene

I need to store various information about fog, and generate fog when I need it. But currently, I don’t have any method to achieve this

fogMode and fogEnable cannot be implemented (fogEnable cannot be serialized, and when fogMode=0, all information cannot be stored). The only method I can think of is to enable fogMode first, and then immediately set fogMode to 0 after entering the scene. This operation is obviously unreasonable.

That makes sense. Please create an issue for me on the repo and I will fix that next week

nevermind I will do the fix now :wink:

Better individual store for fog serialization by deltakosh · Pull Request #15039 · BabylonJS/Babylon.js (github.com)

1 Like