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: https://developer.playcanvas.com/api/pc.Scene.html#setSkybox
Yes if you set
pc.app.scene.skybox this will apply to all objects.
(You can then also override a specific material’s
skybox with a different one if you like).