Create environment after PBRMaterial, needs update on PBRMaterial reflection settings?

I’m having a case, where I might need to load an environment skybox after some models with PBR Material applied to them have already been loaded and added to the scene. In this case the reflection of the materials is black.

I guess I need to update some material settings by myself in this case, but I cant figure out which and how. Maybe anyone has a pointer?

Example PG: Babylon.js Playground
Changing the value in setTimeout to 0 makes the reflection texture appear

Hi thomasaull,

In the Playground you linked, I see the reflection as soon as the default environment is created even if I turn setTimeout up to 1000. However, if you need to set the reflection texture manually, I believe you can just assign the texture you want to the PBRMaterial's reflectionTexture property. Does that work for your scenario?

Hmm I set the timeout to 5s and tried again, in v4 it does work indeed in v5 it does not (I’m using Firefox 94 if this is relevant).

In my project I actually tried to set:

material.reflectionTexture = scene.environmentTexture

but this didn’t help either. It seems like this is a bug in v5 then?

Interesting. It works in both v4 and v5 for me on Chromium-based Edge, but I repro exactly what you described in Firefox. @sebavan, do you know if this is a bug?

It actually does not work for me in Chrome 98 for v5 (but does for v4)

Fix is in PR

cc @Deltakosh


Bugreport to Bugfix in 6 hours, thats awesome :slight_smile: Thanks @sebavan I just tested with the latest /master and it seems to work :slight_smile: