Archived

This topic is now archived and is closed to further replies.

mannam

Selectively blending

Recommended Posts

Hello, Suppose I'm rendering a transparent object over 2 objects. Is it possible to use 2 seperate blending function for the 2 objects? For example i want object 1 to use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and use glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA) for object2. Thanks! Cheers, Man [edited by - mannam on March 17, 2003 10:02:19 PM]

Share this post


Link to post
Share on other sites
I''m not very sure about this as I haven''t used blending a lot, but woudln''t you simply, before rendering Object1 set glBlendFunc(...) to whatever you need, and then before rendering Object2 change to Blendfunc??
Don''t know for sure though.

Share this post


Link to post
Share on other sites
Thanks for replaying! RizMan

For my case, i want to render a particle system. But the background is too bright to use glBlendFunc(GL_ONE, GL_ONE). So i used glBlendFunc(GL_ONE, GL_SRC_ALPHA) to darken the background. Unfortunately the particles darken themselves each other...and it becomes a dark cloud...


[edited by - mannam on March 19, 2003 5:04:49 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by mannam
Thanks for replaying! RizMan

For my case, i want to render a particle system. But the background is too bright to use glBlendFunc(GL_ONE, GL_ONE). So i used glBlendFunc(GL_ONE, GL_SRC_ALPHA) to darken the background. Unfortunately the particles darken themselves each other...and it becomes a dark cloud...



You could use two passes :

- First, render all your particles with (GL_ZERO, GL_SRC_ALPHA) with a 50% alpha, so that you darkenn the background. The 50% alpha is important since you certainly don''t want to darken it as much as you''ll brighten it.

- Next, render all your particles with standard additive blending (GL_ONE, GL_ONE)

Well, it''s just a quick though but it may work.

Share this post


Link to post
Share on other sites
Try this:
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
I use it for my particle system, but I use 32 bit texture with
alpha map, transluency is great for this.


Share this post


Link to post
Share on other sites