Backface Directional Lighting

normal_fragment_begin

Assuming you don’t need tangent and flat shading, just replace include with normal declaration:

shader.fragmentShader = shader.fragmentShader.replace(
  '#include <normal_fragment_begin>',
  'vec3 normal = normalize( vNormal );'
);

JSFiddle Example

3 Likes