I have a simple shader which combines two textures into one to generate a lit texture. It looks something like this:
return texColor * float4(lightColor.a, lightColor.a, lightColor.a, 1);
Now I want to be able to add colored lights. It should look something like this. How do I need to combine the values to generate the light effect?
My problem is that if I want to lighten the background in blue I can not just multiply the two values if the background does not contain blue (or not much).
(255,255,0)*(0,0,255) = (0,0,0)
use blending, not just a*b…
ex…
or set in code spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
GraphicsDevice.BlendState = BlendState.Opaque;
edit add:
for example:
float4 color = float4(0,0,1,1);//blue
return color0.75f + texColor0.25f;