Accessing Lambert Light intensity

In an old version of ThreeJS I used this to get the light intensity front and back.

vec3 vLightFront, vLightBack;
#include <beginnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <project_vertex>
#include <lights_lambert_vertex>

How would you recommend doing this using the latest library.

Since r144 MeshLambertMaterial does not use gouraud (per-vertex) shading anymore but phong (per-fragment) shading. Lighting computations are done in the fragment shader now which means you can’t access any light intensity values in the vertex shader.

The change was done to fix a series of issues with MeshLambertMaterial. You can read about this in the respective PR:

However, in the same release MeshGouraudMaterial was introduced as an addon that retains the per-vertex shading. Use it as a code template but be aware that the lights_lambert_vertex shader chunk is now inlined.


Sorry for the delay in replying. I’ve been travelling. Thank you for your advice.