What is the shader/algorithm used in "viewport shading: solid" to color faces in Blender?

I want to make a low-poly game.

I noticed that in blender in viewport shading mode, when the camera rotates, the face progressively change color, from grey to black, depending on the angle between the camera and the normal of the faces.

Usually, when I load my model or level inside an engine like godot, with or without lighting, it’s difficult to differentiate faces.

Is it possible to easily recreate this method of displaying faces in an engine? It makes it easy to see 3D shapes and perspective. (the result is similar when wireframe is disabled)

The godot visual shader screenhot in this post seems like a partial answer, it sort of does what I want, but I now want to decide what angle have what shade of gray.

Is there a blender developer who could point to me what part of the Blender source code that is involved in this?

Apparently it is not exactly a fresnel effect, since fresnel creates a gradient, while here the whole face has the same color.

wijtIpSY

Here is a partial solution, but it’s not really replicating it.

I haven’t looked at the code that controls this, but you might be able to gain insight from the studio light editor in Blender.

This can be found by:

  • Opening Blender
  • Selecting Edit -> Preferences from the top of Blender
  • Going to the Lights tabs
  • In the Studio Lights seciton, expand the Editor and enable Edit Studio Light

My interpretation of this is that Blender’s colours come from a simple shader (Some sort of Phong shading?) interacting with a few lights.