Importing glb models as asset container into deserialized scene

Essentially I’m trying to reload a serialized scene or rather the content of the scene (the scene itself is NOT serialized), which works perfectly fine regarding anything Meshbuilder created.

There’s also glb models that are imported via LoadAssetContainerAsync which also works perfectly fine the first time, but as soon as I’m deserializing the scene the models become invisible and may only be seen if a glow layer is active as a faint figure.

I tried not serializing these models and adding them again like the first time, but it also results in invisible models.

When I toggle reflections in the inspector the models appear normally again.

Also I tried converting the PBR materials to Standard which makes the models show up but with crushed colors.

Now in my particular case it’s not really feasible to recreate the problem in a playground as I’m working with a Construct 2 plugin.

To try to fix the crushed colors I attemped something like

standard.diffuseTexture.onInternalTextureReadyObservable.add((internalTexture) =>{
internalTexture._isRGBE = false;
internalTexture.gammaSpace = true;				
internalTexture.getEngine().updateTextureSampling(internalTexture);
}

Which indeed fixes the colors but apparently breaks the hierachy as moving the root mesh doesn’t move the actual model anymore after that.

Consulting AI comes up with the following conclusion:

:warning: Hard conclusion

There is no public API or small code snippet in Babylon that will let you:

  • Fix the gamma/visuals on StandardMaterial

  • Preserve the root mesh hierarchy

  • During a GLB → Standard conversion

…without either:

  • Breaking the hierarchy (early fix), or

  • Losing color fidelity (late fix).

This is why all the approaches you’ve tried—manually toggling reflection in the inspector works, but programmatic equivalents do not—fail in the same way. There is no “hidden trick” left.

So I thought I should maybe ask around here instead for any further insight.

Not sure that I understood your problem in all its complexity.
As for PBR-Standard material conversion you may find some ideas in this PG - https://playground.babylonjs.com/#ISZ7Y2#118
The original PBR spheres here - https://playground.babylonjs.com/#ISZ7Y2#98

1 Like

Some specific bug repros would be great.

StandardMaterial does not support gamma space mod.

1 Like

It appears it was the best solution for my particular situation to completely dispose the scene and engine.

Creating it anew before deserializing the scene content avoids the mentioned glb model problem altogether, so I don’t have to consider to convert anything.

Basically was barking up the wrong tree.

That playground example was indeed what the conversion was based on btw.

Thanks for your replies!

1 Like