Jump to content
Posted 21 April 2012 - 02:14 PM
Posted 21 April 2012 - 03:25 PM
outputcolor = (texColor + blendColor) * 0.5;
outputcolor = lerp(texColor, blendColor, t);
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
Posted 21 April 2012 - 03:54 PM
I actually figured it out myself. I tried the code you provided, and it didn't do what I wanted. It did some weird blending.
Then you can just go like this in your pixel shader (in pseudocode):outputcolor = (texColor + blendColor) * 0.5;
Or you can blend it more or less strongly like this:outputcolor = lerp(texColor, blendColor, t);
If t = 0, the output color will just be texColor, if t = 1 then it will be blendColor. Values in between give various blend levels. t = 0.5 corresponds to the blend before.
texColor * blendColordoes exactly what I want.