Babylonjs equivalent to Three.js LightFormer?

@TiagoSilvaPereira, the issue with environment reflections is that we have to respond to the material roughness by passing a specific mip value for the reflection texture. So when we process an HDRI into an env file, we are generating a mip chain which effectively blurs the image as we reduce the image size per mip. Then we pass the corresponding mip level as determined by the material roughness which will render a reflection at the correct level of blur.

With what I am seeing in the examples you attached above are basically area lights that aren’t part of a mipped environment. Punctual lights in a scene already handle the blurring of reflection based on the material roughness properly so there’s no need to precompute the mip chain. While there hasn’t been area light support in Babylon traditionally, I will ping @srzerbetto for his thoughts on the matter.

In terms of working only with an environment and not dynamically moving lights, I disagree with the premise of the original post about found HDRI’s not looking good. The example shown in the post was not balanced for the scene and so it obviously looks blown out. However, with care, you can tailor even a found HDRI to your scene. There’s nothing to say you can’t bring a found HDRI into an image editor and modify the number of EVs or change the color balance of the image. A lot of the examples we create do use HDRIs from Polyhaven because it’s an easy way to bring good light to the scene. However, you can author your own, particularly if you are using an indoor lighting setup.

In your favorite DCC tool, place a spherical camera at the world center and set up your lights as you would want to light your object. Make sure your lights render in your ray tracer and then render from your spherical camera. Creating a room around your lights will allow for some extra detail in your lights. You can see in our default sandbox env that I have a simple cube for the room and a cylinder for a table in the environment. I modeled the light heads and stands to add some realism to the environment, but just enough detail to let the brain connect to other lighting that we’ve seen through traditional photography. This way I can set up whatever lights I want and render a specific lighting setup for a specific model. This is cheaper than trying to be dynamic at runtime because we will already need an IBL for PBR to work correctly, so I can author my lights however I like and not worry about perf. The only reason to really want to calculate lights at runtime is if you need them to be dynamic in some way. If the lights don’t move, an IBL will be cheaper. Then you just need your shadow casting light. as a punctual light, but it can be used to cast shadow only and not add to lighting by culling the light from meshes. This will make the scene cheaper and rely on your specifically authored environment to do the heavy lifting for lighting.

I hope this makes sense, but feel free to ping back with more questions.

4 Likes