Limit Env light

Is there a way to get only a view objects/shaders in the scene lit by IBL.?
Id like to get only the metal shaders be iluminated by the IBL.

Yep, just play with environmentIntensity: https://www.babylonjs-playground.com/#4AJ16M#55

3 Likes

These are the golden lines. Thanks

scene.materials.forEach(function(material){
            if(material.metallic == 0){
                material.environmentIntensity = 0;
1 Like

Does this also work if the metallic is controlled by a texture?

if(material.metallic == 0 && material.metallicTexture == undefined){}

https://www.babylonjs-playground.com/#4AJ16M#56 :slight_smile:

Thanks im sure our coding department will know what todo. :smiley:

Made a fast scene to showcase what i want todo.
Only the metal area should get brighter if i ad the env light.

Here .babylon file.sphere.zip (364.9 KB)

I’m not sure if this usecase is possible.

Thanks. In this case we try to compensate the light with darker dielectric materials.

1 Like

dielectric materials?

Interesting…

Everything not metal is a dielectric.
Thats the reason why the metalness texture is black or white.

1 Like

Just a thought, but if you can split into 2 materials, you would be able to control their environment lighting independently. Of course depends on the actual asset how feasible that is.

1 Like

In this case its not possible we need pixel exact seperation.
There are a lot fo textures in the scene.

Thanks pjoe. I want to try that.