Material reaction to lights

Hello,

We often use different model and shape in our scenes and we noticed that each element doesn’t react the same way to lights and we often have to put outlier for light intensity in order to have the correct result.
Here is a playground where it feels like the plane is much more enlightened than the models: https://www.babylonjs-playground.com/#0108NG#26

So I was wondering if there was a way to choose how the mesh and its material will react to lights?
I look for a parameter in the material api but didn’t find one which would do that: StandardMaterial - Babylon.js Documentation
Another solution would be to put a darker colour on the plane material but not very good if we have to follow very specific graphic design.

Thanks for your help

I noticed you use PBRMaterial for all the meshes but the plane.
If you want consistent lighting i guess you want to use the same Material as PBR uses another shader than StandardMaterial.

I modiefied your example to use PBRMaterial for the plane. Maybe this is what you are looking for?
https://www.babylonjs-playground.com/#0108NG#27

Ok thanks. Indeed right now we have the same light “response” for both models and plane.

So do you advise us to use PBR materials only in all our scenes?
But what if we want to use have a material with a bump texture for instance?

If you want consistent shading I would suggest sticking to the same material.
I guess there are some instances where you want to use a different material for effects but in your example I don’t see the need for it.

You can use normal maps as bumpTexture on the PBRMaterial. Maybe the naming of some of the parameter differs a bit within different materials but I mostly use PBR and it works well for me.

Alternatively I think to remember that you can use a non-PBR material in GLTF Models (specular/glossiness) if you want to stick to the StandardMaterial. That might be an advantage if PBR uses too much graphics power for your use-case.

// These two links helped me to get a better understanding about the PBRMaterial:
https://doc.babylonjs.com/how_to/physically_based_rendering
https://doc.babylonjs.com/how_to/physically_based_rendering_master

I am new to the PBR material so thanks for the links.

In the tool we develop, you can import custom models and we don’t have the control on the type of materials they will use.
But it seems that main of the models will have PBR materials. Or is it that BABYLONJS will choose the PBR material by default?

all materials coming from gltf will be PBR based, since that is the standard.

But you could choose to loop though all your meshes and replace the materials with other non pbr versions.
But as you say, if you are not completely in control of the models coming in it’s hard :slight_smile:

Note that since default ambientColor of PBRMaterial is black, you can easily add and tweak standardMaterial into PBR workflow scene, playing with both scene & std material ambientColor (example: https://www.babylonjs-playground.com/#K4S3GU#45).

As Leon suggests, you may also have to write a (fake) conversion script if the user materials are standard: create a PBRMaterial from the Standard imported, linking some maps into the rights channels. Of course as the map will not be made for standard this could lead to issues.

Thank you @Leon and @Vinc3r for suggesting me those solutions.

For now we accept obj, gltf, glb and babylon files type. As said by @Leon gltf only use PBR material, but what about the other formats. Because one solution would be to only accept formats using PBR material right?