i want to carry out an experiment to explain how wo use the _LightColor0.
i want to use the color of the light to render the object.
so, the shader code is like this:
Shader "Course/LightColor0"
{
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityLightingCommon.cginc"
struct a2v
{
float4 localPosition:POSITION;
};
struct v2f
{
float4 position:SV_POSITION;
};
v2f vert(a2v a)
{
v2f v;
v.position = UnityObjectToClipPos(a.localPosition);
return v;
}
fixed4 frag(v2f i):SV_Target
{
fixed4 color = fixed4(_LightColor0.rgb, 1);
return color;
}
ENDCG
}
}
}
be care about the
fixed4 color = fixed4(_LightColor0.rgb, 1);
not the
fixed4 color = fixed(_LightColor0.rgb,1);
and include “UnityLightingCommon.cginc”
often you can use #include"Lighting.cginc"