So in my shader if i do the following:
half3 lightDirection = normalize( _WorldSpaceLightPos0.xyz - i.posWorld );\
I get the correct lighting for spot and point lights. However, directional lights are broken, examples below:
point: Imgur: The magic of the Internet
directional: Imgur: The magic of the Internet
If i remove the " - i.posWorld", then the opposite is true. I will have correct directional lights but spot and point are broken.
If i run a check to see whether it’s directional or not:
half3 lightDirection = normalize( _WorldSpaceLightPos0.xyz - i.posWorld );\
if( _WorldSpaceLightPos0.w == 0 ) lightDirection = normalize(_WorldSpaceLightPos0.xyz);\
then ambient light breaks for point/spot lights: Imgur: The magic of the Internet
but directional lights work fine: Imgur: The magic of the Internet
What am i doing wrong here?