Flat Shading on

Hi! I am curious if anyone knows how to get the same effect in Babylon as I am getting in Blender.
The image above is what I am trying to get it to look like. Below is the link to the Babylon playground.

What I enabled in Blender to get this effect says “Display Render Preview” - It is in the very top right of the screen. I cannot add a screenshot, as I am a new user on the forums.

Playground: https://playground.babylonjs.com/#WVTNSH#3

You can try to disable lighting and use emissiveTexture / emissiveColor:


1 Like

This might work:

Basically you do not use flat shading but unlit instead to not see shading.

Cross post again :slight_smile: :slight_smile: but at least you have 2 solutions :slight_smile:

Thank you!! I was trying to work with emmisive properties, but just couldnt get it down. Thanks a ton!

This is great! Thank you very much!

You should use @sebavan solution (unlit=true instead of disableLighting=true) because it removes much more code from the fragment shader.

1 Like

:+1: Thank you.

Out of interest, is that how Babylon works under the hood, creating custom shaders for different materials based on their properties, subbing in bits as required?

1 Like

Yes, for some of the shader parameters, some code is removed/added from the final shader code, as they correspond to #ifdef / #endif blocks in the shader: if the #ifdef evaluates to false, the corresponding code is not emitted.

That’s what happens here: when unlit is false, a big chunk of code is removed from the shader and a smaller one if you only use disableLighting = true.


Do you guys know if there is a way to scale the unlit effect? I am kind of looking for an in-between now. I’m currently researching, just wanted to see if you guys had a quick solution.

Yup you can simply scale the albedo ?

That is what I have been messing with, but all I have found is albedoScaling = true; However, no mention on how to affect the scale?

albedoScaling is only for sheen (name of a technique).

What I mean here is to scale manually the albedoColor manually as I do here:


mat.originalAlbedo.scaleToRef(lightIntensity, mat.albedoColor);

Understood, thanks!