Logo by Pauldelbrot - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. March 28, 2024, 09:36:07 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: opengl, order independent tranparency ?  (Read 3158 times)
0 Members and 1 Guest are viewing this topic.
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« on: May 06, 2013, 12:37:06 AM »

hi all, i have read about order independent transparency, why is it so hard to achieve ?
as far as i have seen the standard blend modes do not allow to set up "additive" blending, and always a shader is needed, but a nice example was not found by me, can anyone point me to how to set up an independent rendering method for opengl huh?

thank you
Logged

---

divide and conquer - iterate and rule - chaos is No random!
hobold
Fractal Bachius
*
Posts: 573


« Reply #1 on: May 06, 2013, 12:46:57 AM »

i have read about order independent transparency, why is it so hard to achieve ?
Because light in nature travels trough the farthest transparent object first, and through the nearest transparent object last before it hits our eyes. Additionally, the interactions between light and transparent materials tend to be non-commutative.

In other words, in a traditional rasterizer like OpenGL, you have to render transparent surfaces back to front. The alternative would be a Z-buffer that stores not just a single Z-coordinate, but a sorted list of transparent surfaces at that particular pixel.

Or you use raytracing, where each ray hits surfaces in geometrical order, regardless of the order in which they were specified in the model.
Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #2 on: May 06, 2013, 01:18:08 AM »

Quote
as far as i have seen the standard blend modes do not allow to set up "additive" blending
opengl does support additive blending. But it is not a very good approximation of transparency... it might work ok for frosted glass which tends towards white as you look through more of it.
Logged
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #3 on: May 06, 2013, 01:36:38 PM »

hi all, i have read about order independent transparency, why is it so hard to achieve ?
as far as i have seen the standard blend modes do not allow to set up "additive" blending, and always a shader is needed, but a nice example was not found by me, can anyone point me to how to set up an independent rendering method for opengl huh?

thank you

I've posted an improved "order independent transparency" sample (based on OpenSceneGraph) to the osg-submissions mailinglist recently. This example uses depth peeling, which is a multi-pass technique. It shows how to combine solid and transparent geometry, and also how to use GLSL shaders in combination with depth peeling. OpenSceneGraph is an open source scene graph, a middleware between the application and the OpenGL API.

There are other approaches to transparency rendering, like sorting all objects or even object faces from back to front before rendering. But this only works for few objects or relatively simple geometries, and also sorting individual faces becomes nearly impossible when your geometry is arranged as a quad or triangle mesh, where the faces are already arranged as quad or tri strips.

So yes, real transparency is hard.

Christian
« Last Edit: May 06, 2013, 02:40:57 PM by cbuchner1 » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: May 06, 2013, 02:47:07 PM »

so, as i understand the additive blending is the cheapest single step? any examples around ? i am not seeking reality here, i am just wanting to counter my millions of dots that i can not by any means sort in each step wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #5 on: May 06, 2013, 02:52:23 PM »

so, as i understand the additive blending is the cheapest single step? any examples around ? i am not seeking reality here, i am just wanting to counter my millions of dots that i can not by any means sort in each step wink


Additive blending does not  really achieve a realistic transparency effect - but it is the only order independent blending operation (subtractive blending as well). It is kind of cool for "glow" effects, because the more "transparency" layers you add the brighter (or darker for subtractive blending) things become.

Just experiment with this blending feature to see if that will suit your needs. You will have to draw solid geometry first, then all the transparent objects with depth test enabled, but depth writes disabled.
« Last Edit: May 06, 2013, 03:07:59 PM by cbuchner1 » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #6 on: May 06, 2013, 03:25:38 PM »

so, i am unsure, is additive blending just the alpha *source+ (one minus dest alpha)*dest equation ?
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #7 on: May 06, 2013, 04:31:38 PM »

so, i am unsure, is additive blending just the alpha *source+ (one minus dest alpha)*dest equation ?


glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #8 on: May 06, 2013, 06:08:35 PM »

nice, thank you wink will try it right away wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #9 on: May 06, 2013, 06:46:03 PM »

hmm, ok, you are right it is somehow problematic, i wonder why the color is getting white ...
Logged

---

divide and conquer - iterate and rule - chaos is No random!
kram1032
Fractal Senior
******
Posts: 1863


« Reply #10 on: May 06, 2013, 08:41:53 PM »

that's why it's called additive.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #11 on: May 06, 2013, 09:00:54 PM »

but if i add 2 blue colors, why is it getting white then ? sad
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #12 on: May 06, 2013, 11:03:21 PM »

The joys of glBlendFunc. I still remember the first time, I tried reading the documentation on that one!

but if i add 2 blue colors, why is it getting white then ? sad

Are you sure you are not saturating your colors? Are they pure blue, with no lighting enabled? I think per default OpenGL sets some ambient global light (GL_LIGHT_MODEL_AMBIENT).
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #13 on: May 06, 2013, 11:20:35 PM »

hmm, the colors are set/interpolated in the vertex shader, so no light influence here wink

it has to do with my iteration visualisation, if you look carefully in the mandelbox iteration visualisations you spot the problem when the bailouted points move back to their starting positions, in that case many points are rendered wrongly, hence i have exactly 1 million of them and already use the vertex shaders for interpolating there would be in no case time for sorting them out ..

a 2 step rendering would be - in my eyes - expensive as well, but just doubled amount wink

right now i stick with the normal blending equation

to make it really look good something like the flame rendering algorithm should be used, but this would induce more effort for the rendering,
by just calculating the number of pixels that lie on top ... and then renormalizing the output ... something like this ... because no matter
what i do i have a problem anyways ... either there is no point overlaping another one and hence i could not reduce the alpha anymore, but
when 3 or 10 points lie on top of eachother they just blend to white ... sad another problem with the normalization would be to keep the
overall renormalisation stable throughout the animation, because the amount of points that lie on top of eachother may vary strongly from
frame to frame ... sad

ehrm, i need a faster computer!
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
OpenGL Mandelbulb implementation Mandelbulb Implementation Dmitry Brant 4 7008 Last post November 25, 2009, 03:14:46 PM
by Dinkydau
OpenGL+cuda renderer (video+src) Mandelbulb Implementation kyrlian 3 6590 Last post April 12, 2010, 05:32:34 AM
by keldor314
independent film maker requires help from fractal animators Let's collaborate on something! teamfresh 6 1006 Last post March 25, 2010, 02:38:40 AM
by teamfresh
Web-based OpenGL ES2 Fractal Website of the Month David Makin 4 4225 Last post January 29, 2011, 01:16:50 AM
by subblue
Independent Glow for DE objects with Ray Marching ? Programming glennmarshall 9 2774 Last post June 13, 2013, 09:23:23 PM
by glennmarshall

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.213 seconds with 24 queries. (Pretty URLs adds 0.01s, 2q)