Page 1 of 1

Alphablending ... ?

Posted: Fri May 29, 2009 10:01 pm
by d3fxyh
Because I'm more familiar with DirectX gfx than the OpenGL platform I thought I'd ask whether it's relatively easy to alphablend in OpenGL and whether there are commands that easily implement this in Oolite?

My reason for asking is that it struck me that no-one has as yet, as far as I can see, implemented any planetary rings of the sort that in our Sol system one sees around i.e. Saturn. An easy if rather simplistic way to produce such a graphical effect might be to texture a plane object (with backface culling off) with a bitmap or .png with a ring graphic on it, then alpha-blend it into its immediate background (to give a sort of ghosting or semi-transparent effect). Then you'd have to scale the plane so that it is larger than the planet and position the plane at the centre of the planet.

I guess this leads onto another question which I haven't yet looked at the source about: does OpenGL have hard coded into it the standard primitives or is this kind of thing for the programmer to implement. DirectX comes with the usual cube, sphere, cone, torus and, of course, the famous teapot!!

Posted: Fri May 29, 2009 10:09 pm
by DaddyHoggy
I'm pretty sure alphablending is an issue - this is why ships and other space fodder do not have things such as transparent windows and domes.

Although of course the planets have atmospheres and the ships have exhaust plumes both of which have transparency so I could well be talking out my a-hole...

So, basically, I don't know, other than to say that there are some issues with alphablending but I don't fully understand what those issues are. Somebody much more clever than I will be along shortly.

Posted: Sun May 31, 2009 10:13 am
by Griff
i'm not the clever person DH is referring to, but i remember Ahruman (now this guy is a clever person) mentioning something about the graphics engine sorting polygons in the wrong order (front to back?) to allow transparency to work, it was going to mean a massive re-write and a drop in performance speed to get it working, and that planet atmospheres have their own special bit of code to get them working.

Posted: Sun May 31, 2009 2:55 pm
by d3fxyh
If you are talking about z-depth and rendering the polygons furthest away before rendering polygons closer, as far as I can recall that is standard in both openGL and DirectX and has been for a while. If you are saying that at the moment oolite does not do this despite being based on openGL, then I'm puzzled!!!

Posted: Sun May 31, 2009 3:04 pm
by DaddyHoggy

Posted: Mon Jun 01, 2009 9:57 pm
by d3fxyh
Thanks but that thread effectively repeats my previous (almost rhetorical) question rather than answers it. I'm definitely puzzled by this but my knowledge of OpenGL is not as good as my knowledge of DirectX and I cannot answer it without some poking around into websites about the OpenGL graphics pipeline.

Posted: Tue Jun 02, 2009 8:04 am
by DaddyHoggy
If (when?) Ahruham comes back he may be able to answer your questions more succinctly.

Posted: Sat Jun 13, 2009 4:01 pm
by JensAyton
OpenGL does not automatically sort polygons from back to front for alpha blending, and I’m pretty sure Direct3D doesn’t either. The tradeoffs involved in deciding how to do this are far too complex for a low-level renderer, and new ways of doing it are an active topic of research.

Posted: Sat Jun 13, 2009 4:21 pm
by DaddyHoggy
Hooray - Ahruman is back!!! :shock: 8) :D