I am using OpenGL to render my scene but I'm run into a problem when trying to render two transparent objects that are overlapping one another. My two objects are inner twined so that at some points, object A is on top of object B and in other points it is the other way around. A simplification of this would be to image the lower case letter n and u. if you but the n on top of the u and then have the left side such that the n is ontop of the u but the right side with the n under the u then you get the same overlapping problem.
anyway back to my problem.... so I have two objects that are semi transparent. How do I render these objects so that the colors are calculated correctly.
If I render object A first then B then where ever B is below A, the colors don't look right.
how to render overlapping transparent objects?
Started by MarekKnows.com, Dec 09 2005 03:34 PM
9 replies to this topic
#1
Posted 09 December 2005 - 03:34 PM
C++, 3D OpenGL and Game Programming video tutorials:
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
#2
Posted 09 December 2005 - 03:40 PM
depth peeling
#3
Posted 09 December 2005 - 04:19 PM
what does that mean?
C++, 3D OpenGL and Game Programming video tutorials:
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
#4
Posted 09 December 2005 - 04:47 PM
Why exactly do the objects intersect? Is there no way to avoid that? (Split the object into convex subobjects). Then do the normal z sorting of transparent objects.
Alex
Alex
#5
Posted 09 December 2005 - 07:44 PM
Alex said:
Why exactly do the objects intersect? Is there no way to avoid that? (Split the object into convex subobjects). Then do the normal z sorting of transparent objects.
Alex
Alex
I'm writing a general 3D graphics rendering program. therefore the objects that are rendered are out of my control.... it depends on what the user trys to render on the screen. If the user chooses to make two transparent objects that are aligned in such a way that they are overlapping as shown in http://www.maduckgam...z3d/overlap.jpg , then my rendering code doesn't work
C++, 3D OpenGL and Game Programming video tutorials:
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
#6
Posted 09 December 2005 - 07:54 PM
Most rendering systems do not correctly handle intersecting transparent objects; as roel mentioned, depth peeling is the way to do this, but it is relatively slow and it is not easy to detect when it should be applied. Ordinarily z-sorting is enough and that is all that most graphics engines do.
In other words, if your users make transparent objects intersect and don't split them into enough sub-components for z-sorting to work, it's their own fault
In other words, if your users make transparent objects intersect and don't split them into enough sub-components for z-sorting to work, it's their own fault
reedbeta.com - developer blog, OpenGL demos, and other projects
#7
Posted 09 December 2005 - 08:01 PM
hmm, interesting. I thought that there should be an easy solution to this problem because when I load my VRML scene in any web browser that has a vrml viewer, the scene is rendered correctly.
C++, 3D OpenGL and Game Programming video tutorials:
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
#8
Posted 09 December 2005 - 09:12 PM
Well..you have the usual generality/quality/speed trade off.
It's certainly possible to write something that handles all these cases properly..
The big crap about current 3d hardware is that it is rather inefficient at rendering the kind of data you normally want to render (many diverse, semi transparent animated objects). Actually...that's not quite right... there is no efficient way to supply this kind of data to the hardware.
Alex
It's certainly possible to write something that handles all these cases properly..
The big crap about current 3d hardware is that it is rather inefficient at rendering the kind of data you normally want to render (many diverse, semi transparent animated objects). Actually...that's not quite right... there is no efficient way to supply this kind of data to the hardware.
Alex
#9
Posted 12 December 2005 - 06:54 AM
Quote
The big crap about current 3d hardware is that it is rather inefficient at rendering the kind of data you normally want to render (many diverse, semi transparent animated objects). Actually...that's not quite right... there is no efficient way to supply this kind of data to the hardware.
Oh yeah.. Something we've been arguing for like an year:whistle: . Seemingly simple things get so complicated.
You will face this problem in case of alpha-channel blend modes( blend_src_alpha , blend_inv_src_alpha ).
For additive translucency blend-modes, sorting is not needed. Depth writes must be turned off.
#10
Posted 13 December 2005 - 04:12 PM
mmakrzem said:
I'm writing a general 3D graphics rendering program. therefore the objects that are rendered are out of my control.... it depends on what the user trys to render on the screen. If the user chooses to make two transparent objects that are aligned in such a way that they are overlapping as shown in http://www.maduckgam...z3d/overlap.jpg , then my rendering code doesn't work
Actually in the case you show there its easy. Use alpha testing and you can draw in any order ya like ... mmmm ... 1-bit alpha.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












