this works mostly, but when Chrome is hidden at creation of the scene ‘ambientColor’ remains 0.0 even if it is set to 1 at render time when visible (so the material remains black).
What is a better way to apply the ambientColor and keep it up to date?
You can also simply in shaderMaterial.effect.onApply observable always bind it there is a clever cache in Babylon which will prevent it to flow to the GPU if the value did not change
actually… I went back to my original observable: onBeforeRenderObservable, because otherwise there was again a moment where the material is completely black while the rest of the scene is fading in!
There are many ways to achieve your goal. As I said it’s impossible to tell you why do you get a black material without seeing your code. However I’m glad you managed it to work!