Stylized nodeMaterial renders quantized lighting in wrong direction on mesh?

I am trying to create a two tone shader following the Create Your Own Toon Shader youtube video from Nick from BabylonJS team.

To test shaders and debug I created this simple playground with a spotlight rotating around the sphere.
It uses the ParseFromSnippetAsync so we can easily load some NME shaders to illustrate what I am not understanding or getting right here.

Before loading a nodeMaterial the lighting appears normal or lets say “default” if not realistic. But when I am building the shader it quickly flips for lack of a better description. One would assume that the ambient color not be colored first and then specular highlights on the back of the sphere, away from the light? SI am new to this so its probably somthing obvious I dont understand.

// Final version of BJS shader from guide

The completed shader #81NNDY#2 can be used to illustrate the issue, but the problem appears for me as soon as I have gotten the N Dot L and feed it into the fragment shader the issue is there.

// Start of shader

Can someone smarter than me point out what I am missing?

Hi @MacGuffin and welcome to the forum!

N Dot L return a value with a range of [-1 … 1]
If you want to convert it to a texture coordinate or a light value, you’ll need to chane its range like *2 + 0.5