- Home /
Spot Light at ForwardBase
Hi,
I have a scene with just one light, it's a spotlight and it's marked as "important". I also have a custom shader that has just one pass (ForwardBase). _WorldSpaceLightPos0 gives me the right light position, on the other hand _LightColor0 is aways black. Why?
To by pass this now I've created a shader with two passes, where the first pass just returns 0. Something like:
Pass {
Tags {"LightMode" = "ForwardBase"}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct vertexInput{
half4 vertex : POSITION;
};
struct vertexOutput{
half4 pos : SV_POSITION;
};
vertexOutput vert(vertexInput v){
vertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
fixed4 frag(vertexOutput i) : COLOR {
return fixed4(0, 0, 0, 0);
}
ENDCG
}
Pass {
Tags {"LightMode" = "ForwardAdd"}
Blend One One
// My real shader goes here
}
}
So, my question is: Do I really need a two passes shader to work with only one pixel-light just because this pixel-light is not directional?
PS: I'm using unity 3.5, if it makes any difference.
I'm on Unity 5.3. The only difference is that the version numbers are inverted!!! I also would like to know why if there is only one light it requires a second pass. It's a waste.
Your answer
Follow this Question
Related Questions
Spotlight is not working 3 Answers
Flashlight GUI and battery pick up. 1 Answer
How to force the compilation of a shader in Unity? 5 Answers