sampler2D MyR32fSurface;
sampler2D BackBuffer;
float4 ps_main(float2 tcoord : TEXCOORD0) : COLOR0
{
float colorFromMyR32fSurface = tex2D(MyR32fSurface, tcoord ).r;
return tex2D(BackBuffer, p_TexUV0) * colorFromMyR32fSurface;
}
Alpha blend R32F
I would like to blend an R32F surface onto the back buffer and not have everything turn red. Assuming my back buffer were a render target, the HLSL code to perform this blend may look like this:
Is there any way to perform the same operation using D3DRS_ALPHABLENDENABLE and its related render states?
I very much doubt that common GPU's support blending with R32F. You'll probably end up having to do this manually, like in your example shader.
Use CheckDeviceFormat with D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING to verify whether a format supports blending.
As MJP said, floating point blending isn't a common feature. You'll have to resort to a render target plus blending as you've suggested.
As MJP said, floating point blending isn't a common feature. You'll have to resort to a render target plus blending as you've suggested.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement