I’m trying to create a special kind of light by putting special conditions into the light’s cookie. If it’s a certain kind of light, do my own calculation, otherwise, use the Standard lighting calculations.
I’ve created a Surface Shader using the “Create > Shader > Standard Surface Shader” Menu item from the project tab.
In the shader, I’ve created a custom lighting function:
#pragma surface surf Custom
inline half4 LightingCustom(SurfaceOutput s, half3 lightDir, half atten)
{
if (_LightColor0 or _LightTexture0 meets a condition)
{
//Do a custom lighting calculation
}
else
{
//Use the Standard lighting calculation(s)
}
}
My question is, how do I call Unity’s standard lighting calculations? Is it that simple? Would I be better off using a multi-compile statement and setting the conditions another way?
Edit: I should note, I would love to just modify DefaultResourcesExtra/Standard.shader, but I’m not sure where to even begin there. I only need a sub-set of the standard shader’s input power (Normal Maps and Emission). So creating my own surface shader seemed like a simpler option.