Reputation: 3075
Normally when you do SpriteBatch.Draw
you can specify a color. But here's the problem. If I use custom shaders they ignore color passed by SpriteBatch.Draw
...
How do I take that into account? I mean how exactly SpriteBatch.Draw
passes a color? If I know it I can use it in my shader.
So far what I have (relevant part):
float4 NoEffects(float2 coords: TEXCOORD0) : COLOR0
{
return tex2D(s0, coords);
}
technique Default
{
pass Pass1
{
PixelShader = compile ps_2_0 NoEffects();
}
}
Upvotes: 3
Views: 488
Reputation: 4867
You need to retrieve the color that's passed through the vertex shader and use it when calculating your final output:
float4 NoEffects(float4 color : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
return tex2D(s0, coords) * color;
}
Upvotes: 4
Reputation: 14507
You can use an EffectParameter to pass a value to your effect.
http://msdn.microsoft.com/en-us/library/bb976060.aspx
Upvotes: 0