Dynamic lighting and Background lights

Here we are using only one Direct light with shadows. I want it in Multiple lights. Help me out in changing different dynamic lighting and background lighting, and how to implement it in real in UI. Following is my reference video link on how I want.
I hope you understand, Please help me out.
Thank you

here you go :


could you please given me any reference for the playground , 1 or 2 dynamic lighting and background

You should may be visit the doc, look at lights and environment and the shadow generator and also select the type of GUI you want.
I understand this might not be the answer you expect but the question is a bit too open (at least for me).
In fact, there are many ways you can use and control lights and the env. And there are many approaches you can take from the UI. For a start, you could create up to 4 different lights. Here already you can choose from disposing them and creating them on the fly or use intensity or exclusion to handle them depending on context. Same for the env, you can update the url or pre-create n envs, next you can act on the level and intensity and more… Same for the shadowGenerator, also a number of options available to cast or exclude shadows.
What if you would try sketch something and share the PG with us. We could next have a look at it and better orientate you. Because honestly, just like that, I really don’t know which option and combination I should present you.

1 Like

i gave you what you needed :wink: The lighting you refer to is IBL ( image based lighting ) and is done using HDRI images.

these are normally .HDR files or .EXR, In babylon these files are better formated to other formats for better performance, the .ENV format.

Babylon does not provide these .env files , you need to create them.

All such info is in the link i provided , once you have several different .env files to use, switcching them is a no brainer. This will change your lighting and background each time. Here is the code to do it.

let envFile = "assets/images/babylon/autoshop_02_2k_bw.env";
let p = window.location_url + envFile;
hdrTexture = CubeTexture.CreateFromPrefilteredData(p, scene);
hdrTexture.gammaSpace = false;
hdrTexture.level = 1;
scene.environmentTexture = hdrTexture;
scene.environmentTexture.rotationY = 3.913;
scene.environmentIntensity = 0.3;
1 Like