Problem:
With NdotL calculations in the bottom part, i achieve proper shading, but it also removes light cone visibility from certain surfaces ofcourse.
Notice area marked red. Light are missed due to NdotL calculations.
the dot product returns -1 to 1 values, by using the saturate node after the dot product all the info in the 0 to -1 range is sheared off. however you will need that info. So instead of the saturate node use the constant bias scale to convert the values from -1 to 1 into 0 to 1, then tweak the gradient with add,mult/div,power.
Well, in that case problem was solved by using dot product of “light direction vector” and “surface point to light” vector (light position - world position), instead of pixel normal. ← WRONG
UPD: problem was solved by using dot product of “surface point to light” vector and pixelnormal vector.
I should sleep more before writing something.