Jump to content
  • Advertisement
Sign in to follow this  
ClementLuminy

Problem With additive blending...

This topic is 4173 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 ! In order to light an object with multiple light sources, i use multipass rendering, and additive blending. For Each light i render the same object on the same render target and blending is done using additive blending. The only render state that are set are: m_D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE); m_D3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); m_D3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE); Everything works fine, execpt one thing: If my object is convex, some part of it are first rendered to the render target, and some other part are renderer on top of it. Without additive blending, everything goes fine, but with additive blending ... well... i get some problems: Here is a screenshot of the problem i'm talking about: Do you have any idea on how can i handle this problem ??.. I'm really stuck with it! Thanks for any help !! Clement :)

Share this post


Link to post
Share on other sites
Advertisement
In fact, after reading some other posts, it seams that one possible solution is to do a Z-Only render pass to render only the ZBuffer values and then, to render my object using a "Color-only" pass by disabling Z-Write but enabling Z Test.

Do you thinks it's a good way to solve this problem ??

Do you konw any other one ???

Thanks again !

Clement

Share this post


Link to post
Share on other sites
You could either render a Z-Fill pass, with Color Writes disabled to fill the z-buffer with it's final values, or, if you prefer, you could have the first pass render regularly (alphablending disabled) and only enable alphablending on the next passes.

The second option would likely perform somewhat better, since alphablending has a small performance penalty, although a Z-Fill pass is very quick on most hardware and would completely eliminate overdraw.

In short, do whichever you feel is easiest.

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!