Jump to content
  • Advertisement
Sign in to follow this  
eigers

OpenGL Separate alpha blend enable states for MRT

This topic is 3605 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

Hello everyone, My application uses D3D9. I have a main render target into which the scene is rendered, and an additional render target used for writing some data which I'm using later. My problem is that when the scene is rendered with alpha blending enabled, my second RT gets blended as well, which produces meaningless values. Is there a way in D3D9 to enable alpha blending only for a specific RT? The D3D docs don't mention such an option, but I know that in OpenGL it's possible with some extension (DrawBuffers2 I think), so it's not a hardware limitation. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately you're stuck in D3D9. Seperate blending states for MRT's was a feature added for D3D10.

[Edited by - MJP on November 7, 2008 10:56:29 AM]

Share this post


Link to post
Share on other sites
D3D10 you mean I guess...
That's the answer I was afraid of... I can't move to D3D10. Isn't there some hack to do this in D3D9, like a secret format or something (even NV-only will be fine)? I know there are formats which don't undergo any post pixel shader operations, but for some reason I couldn't get them to work properly.

Share this post


Link to post
Share on other sites
Whoops, definitely meant to put "D3D10" there. :P

Anyway I don't know of any hacks or vendor-specific stuff to get around this. You could do the blending yourself in the shader by ping-ponging between render targets, but that's not exactly cheap...

Share this post


Link to post
Share on other sites
I think that though alpha blending is enabled for all render targets, the alpha of a specific target will be used for that target's rendering. In that case, just setting the alpha to 1 for the second RT will solve the problem. You're losing one output component, but that shouldn't be an insurmountable problem.

Share this post


Link to post
Share on other sites
How about when the second RT is a float target (say R32F)? What would be considered as alpha here?

Share this post


Link to post
Share on other sites
Quote:
Original post by eigers
How about when the second RT is a float target (say R32F)? What would be considered as alpha here?


It will still use the alpha value of the output, even if that alpha component isn't being stored anywhere.

Share this post


Link to post
Share on other sites
For the source it's understood, because the pixel shader always outputs a 4-component vector, but what about the destination, which doesn't store the alpha component at all? Is it always expanded to 1?

Share this post


Link to post
Share on other sites
Actually no, I don't really have a problem there. But I do have a problem with blending modes which use the destination color (e.g. D3DRS_DESTBLEND = D3DBLEND_ONE), as I don't want the second RT blended at all.
It seems that there really is no way around this in D3D9...

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!