Reply To: DX 11 implementation
Home › Forums › TimelineFX Module › DX 11 implementation › Reply To: DX 11 implementation
Veki
Hi Peterigz.
I’m using alpha blending. I tried using additive blending, but the result is much worse.
Here are my alpha and additive blend states configuration :
ALPHA
SrcBlend = D3D11_BLEND_SRC_ALPHA;
DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
BlendOp = D3D11_BLEND_OP_ADD;
SrcBlendAlpha = D3D11_BLEND_ONE;
DestBlendAlpha = D3D11_BLEND_ZERO;
BlendOpAlpha = D3D11_BLEND_OP_ADD;
ADDITIVE
SrcBlend = D3D11_BLEND_ONE;
DestBlend = D3D11_BLEND_ONE;
BlendOp = D3D11_BLEND_OP_ADD;
SrcBlendAlpha = D3D11_BLEND_ONE;
DestBlendAlpha = D3D11_BLEND_ZERO;
BlendOpAlpha = D3D11_BLEND_OP_ADD;
Vertex color is calculated like this (<< is displayed incorrectly, should be left shift) :
color = ((r << 0) | (g << 8) | (b << 16) | ((a * 255) << 24));
In pixel shader I sample texture and multiply it with color :
return shaderTexture.Sample (SampleType, input.texture_coordinates) * input.color;
I don’t know what I’m doing different than what TimeLineFX editor is doing. Could you tell me what you’re doing in editor so I could get the same result?
For animated particles, how do I calculate texture coordinates of a sprite in a sprite sheet? I know I can get width and height of a texture, and I can get frames count. Do sprite sheets always have NxN sprites so I can get N by doing a square root of frames count. And then dividing texture width / height with N to get sprite texture coordinates?