How to change many materials environment map?

Hey @Saad_Haider & @slimbuck, I noticed this example only takes 1 specific model into account. Would it be possible to load a cubemap dynamically and apply the light settings to every mesh instance in the scene without being too resource heavy? I’m working on a project that has 1 scene with multiple environments, and we were wondering if changing skyboxes and other lighting settings dynamically would be feasible.

It would be possible but it would mean going through each material and/or mesh instance and changing them in a loop.

You may get a frame drop when doing this if the materials did not have an environment map before since it has to recompile the shaders.

But in general, changing skyboxes and other lighting settings is possible.

If it’s going to be the same environment map for all materials and mesh instances in the scene, it be easier to changing it in the scene object via:

1 Like

Hi @timrodz,

Yes if you set and this will apply to all objects.

(You can then also override a specific material’s envAtlas and skybox with a different one if you like).


1 Like