Home › Forums › TimelineFX Module › DX 11 implementation › Reply To: DX 11 implementation
Well, I believe blend modes in DX work very similar to blend modes in other APIs. Just to be clear, blend state configuration from above post do this :
ALPHA
FinalColor = SourceColor * SourceAlpha + DestinationColor * (1 – SourceAlpha)
FinalAlpha = SourceAlpha
ADDITIVE
FinalColor = SourceColor + DestinationColor
FinalAlpha = SourceAlpha
If blend mode looks good, there are 2 more places in code where things might be amiss.
1. Vertex color calculation – r, g, b, a values are bit shifted to create RGBA “four-component, 32-bit unsigned-normalized-integer format that supports 8 bits per channel including alpha.”
Vertex color is calculated like this (<< is displayed incorrectly as “& lt;& lt;”) :
color = ((r << 0) | (g << 8) | (b << 16) | ((a * 255) << 24));
2. Pixel shader – output pixel is calculated by multiplying color and sample from texture at uv coordinates
return shaderTexture.Sample (SampleType, input.texture_coordinates) * input.color;