In the documentation for Custom lighting models in Surface Shaders it is stated that the functions used to define your custom lighting model should conform to one of four conventions, depending on the information you need:
- half4 Lighting<Name> (SurfaceOutput s, UnityGI gi);
- half4 Lighting<Name> (SurfaceOutput s, half3 viewDir, UnityGI gi);
- half4 Lighting<Name>_Deferred (SurfaceOutput s, UnityGI gi, out half4 outDiffuseOcclusion, out half4 outSpecSmoothness, out half4 outNormal);
- half4 Lighting<Name>_PrePass (SurfaceOutput s, half4 light);
The documentation for Surface Shader lighting examples however uses entirely different parameters:
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten);
half4 LightingSimpleSpecular (SurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
Is the documentation wrong or incomplete? It doesn’t describe the attenuation or light direction parameters at all, so I have no idea how to interpret the former, nor can I be sure if the latter, for instance, is normalized.
But if the former is the most recent version, how does one get the light direction and attenuation when using those methods?
– HooksForFeet