I have a scene with a point light and alpha textured (RGBA) triangle strips. I want to apply the point light color with a shader.
Shader "Custom/Test02" {
Properties {
_MainTex("Texture (RGBA)", 2D) = "gray" {}
}
SubShader {
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Tags { "LightMode" = "ForwardBase" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
uniform float4 _LightColor0;
struct vertexInput {
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
};
struct vertexOutput {
float4 position : SV_POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
};
vertexOutput vert(vertexInput input) {
vertexOutput result;
result.position = mul(UNITY_MATRIX_MVP, input.vertex);
result.uv = input.texcoord;
result.color = float4(_LightColor0.rgb, 1.0f);
// result.color = float4(1.0, 1.0, 1.0, 1.0);
return result;
}
float4 frag (vertexOutput input) : COLOR {
float4 color = tex2D(_MainTex, input.uv);
return color * input.color;
}
ENDCG
}
}
}
The color in _LightColor0
is always black. How do I get the proper point light color? If the color is set to float4(1.0, 1.0, 1.0, 1.0);
everything appears but without color from the point lights.