I have been trying to implement rendering of the BMFont format in DirectX 11 based upon the sample code and I am running into issues once I started to use the channel information. Below I have two images, one where I do not use the channel information in the pixel shader and one where I do. The test being displayed is "testna" using the Comic24 binary file from the example code. The text at the top is with alpha blending off, the second is with it on.
Before using the channel information
With using the channel information
When I use the do not use the channel information the pixel shader is just
float4 PS( VS_OUTPUT input) : SV_Target {
return textureDiffuse0.Sample(textureSampler0, input.Tex);
}
When I use the channel information I do it the same way the example code does (except for using color)
float4 PS( VS_OUTPUT input) : SV_Target {
float4 pixel = textureDiffuse0.Sample(textureSampler0, input.Tex);
// Are we rendering a colored image, or
// a character from only one of the channels
if( dot(vector(1,1,1,1), input.channel) )
{
// Get the pixel value
float val = dot(pixel, input.channel);
pixel.rgb = 1;
pixel.a = val;
}
return pixel;
}
Does anyone know why when I use the channel information that this happens? I inspected the channel information while debugging and it is valid. I also tried to hard code it in the shader with the value that I see that it typically is (256) and I get the same result