I have a pixel shader that tries to return a static colour
float4 PPBright(PS_POSTPROCESS_INPUT ppIn) : SV_Target
{
return (1.00f, 0.00f, 0.00f, 1.0f);
}
no matter the colour values it returns white, I can change the alpha values and it affects the colour (white, grey, black).
here's my cpp code:
g_pd3dDevice->OMSetRenderTargets(1, &BackBufferRenderTarget, DepthStencilView);
BloomTextureVar->SetResource(SceneShaderResource);
g_pd3dDevice->IASetInputLayout(nullptr);
g_pd3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
tech->GetPassByIndex(index)->Apply(0);
g_pd3dDevice->Draw(4, 0);
The pixel shader doesn't return the float4
you expect. It returns in this case a float4(1.0f, 1.0f, 1.0f, 1.0f)
. Why? Because of the comma operator. The left side of the expression is ignored, and 1.0f
is implicitly converted in to a float4
. You want to call the contructor of float4
, like so float4(1.0f, 0.0f, 0.0f, 1.0f)
.