OpenGL
Revolution

(R)evolution

ray traced
... is a demo of some new OpenGL features. Unleashing the power of the GPUs is like pushing a new frontier. Very exciting, but quite nasty when it comes to small details. Anyway... this Java/OpenGL (JOGL) + GLSL code demonstrates how amazing it can be. Here we have complex sphere raytracing in full-screen and real-time!

Features

boing!
It is a sortof work in progress (reworking it a bit each time I manage to get a better GPU). But the current code is able to draw a bunch of "old school" spheres (ala Apple][, Amiga, ...). To push things a bit further the last mini-demos are GPU intensive with real-time julia, animation, refractive/reflective plane and spheres, ...

Download sources

Hum... this is not exactly a well packaged piece of code. Please ask me for sources if you feel they can be of some use.

Useful tips

To speed up raytracing without having to implement a full fledged bounding-box algorithm on the GPU you can use polygons to invoke the raytracer shader only for pixels that have a good chance to hold a sphere point. I choose to use the smallest, screen aligned, square enclosing the sphere projection.

Another tip is the formula that gives you the fragment Z buffer depth to be used in the shader when you compute the ray/primitive intersection. You could use any monotonic function but this one is compatible with OpenGL so you can mix OGL pipeline rendered primitives with your shader-generated ones.

gl_FragDepth = ( a + b / z );
where: a = zFar / ( zFar - zNear )
b = zFar * zNear / ( zNear - zFar )
z = distance from the eye to the object

Back to home page oliv@arsac.org