Volumetric renderer example code


I’m posting a cleaned up version of my volumetric rendering/raycasting code seen here: http://forum.openframeworks.cc/t/fun-with-volumetrics-and-time/4534/1
I dont know why the vimeo links arent working in that post, even if I try to edit it and reinsert them, so I’ll post one here:

And here is the output from this example code:

I’ve made this code clearer and simpler for this example. It generates a volume using the noise function then uploads it to the GFX card and renders the volume. You can also toggle animation on and off which basically overwrites the texture one slice at a time. This is usefull to test the glTexSubImage3d() function which can upload partial data into a 3d texture.

The shader itself I’ve adapted from peter trier’s example: http://www.daimi.au.dk/~trier/?page-id=98
but I’ve added some tweaks for performance and usability like the quality and density variables. I don’t have any support for dynamic lighting or shadows on the volume yet.

here’s the project designed for 0062 on ubuntu 10.10 : http://timothyscaffidi.com/files/VolumetricsExample.tar.gz

If you get this to run please let me know what your computer’s specs are and what framerates you get.
I’m running this on an atom 330 with ION graphics (similar to 9400m) and I get 30-50 without animation and 20-30 with animation

I am particularly interested to see if anyone can get this running on the new intel HD graphics 3000 thats integrated into sandy bridge chips, like the ones that the new macbook pro 13" is using.

Although this topic is a year old (almost exactly!) I thought I’d post my experiences. I just uploaded a 0071 xcode project with this example working like a charm. Check it out at https://github.com/daanvanhasselt/raycasting.

FYI, this runs at 300 - 400 fps on my hackintosh (i7 2600k, ati hd6870). :slight_smile: The noise-generating takes a while though, it might be a good idea to move that to the GPU as well.

I cleaned up the code a bit and added a little UI using ofxUI. Even with this simple noise texture it is fun to play with!

Oh and you probably fixed this (after all, you’ve had a year) but in your example you swapped the front and backside culling. The fixed example is at github.

hey I never saw the replies in this thread till now, but I’ve since cleaned this up a lot and released ofxVolumetrics: https://github.com/timscaffidi/ofxVolumetrics

Take a look and if you have any improvements, please send me a pull request!