Jump to content
  • Advertisement
Sign in to follow this  
GaryNas

Alpha blend R32F

This topic is 3674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
sampler2D MyR32fSurface;
sampler2D BackBuffer;

float4 ps_main(float2 tcoord : TEXCOORD0) : COLOR0
{
   float colorFromMyR32fSurface = tex2D(MyR32fSurface, tcoord ).r;
   
   return tex2D(BackBuffer, p_TexUV0) * colorFromMyR32fSurface;
   
}

Is there any way to perform the same operation using D3DRS_ALPHABLENDENABLE and its related render states?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!