Real-time voxel raytracing

Practical and theoretical implementation discussion.

Real-time voxel raytracing

Postby IJs » 19 Jan 2008, 23:35

I'm currently working on yet another out-of-the-box raytracing idea (http://solid.student.utwente.nl) which utilizes voxels aligned in a uniform fixed-grid, and is fully implemented on the GPU instead of conventional CPU raytracers.

After looking at Ken Silverman's Voxlap engine (http://www.advsys.net/ken/voxlap/voxlap05.htm) which utilizes some runtime length encoding based raycasting algorithm that's pretty fast, I reckoned it would be cool to get a raytracer running capable of tracing a given voxel data set. I know there's been a lot of research (e.g. medical research) into this subject, and I've seen several approaches on rendering voxel data sets with reasonable speeds but I figured out they were mostly raycasted, which is not what I was looking after.

Here's a development snapshot (512x512 viewport):
Image

(And an example of how speeds can fluctuate based on implementation :P)
Image

1 basic light: blinn-phong diffuse (0.3) and specular shading (0.7) - of course implemented using Phantom's awesome raytracing tutorials. Visuals and performance don't seem that impressive yet, and they're certainly not at the level I want them to be, but I'm progressing by the day and it's starting to take shape now - just remember these are 100% voxels :)

One of the keys things here is that the programming, being executed on your GPU, is entirely different than that of a CPU-equivalent but it's pretty interesting and looks like a nice challenge anyways. The framerates are different every day, cause there's hardly any performance debugging available - so it's a matter of slightly brute-forcing stuff and figuring out what runs best. Everything is chopped up in logic blocks (or passes), so secondary (and more) ray tracing should be possible by just slapping another trace pass behind the first one. I'm fairly confident I can use the same technique for photon mapping (voxels seem to lend themselves nicely for the storage structure).. hopefully I'll be able to post some progress on that any time soon.

Currently it's running on my first generation NVidia GeForce 8800GTS (not one of the fastest.. G80, theoretical GFLOPS at ~345, 320-bit memory bus), and my CPU just sits there doing nothing (which is good, cause I will find a use for it). Fortunately GPU's are rapidly increasing in speed (and may have more potential than CPU's in the future imho).

The cool thing with voxels in my current implementation is that as you increase your scene complexity in terms of numbers of voxels in your grid, the performance of the tracer remains constant (!) - whereas with polygons (with the tracing done on your GPU) you would tend to get into trouble due to the required random memory lookups in combination with the fairly limited memory bus.

In short, the voxel grid is traversed using a heavily modified Bresenham algorithm (if you're familiar with the subject you probably know Bresenham used to be the fastest line drawing algorithm around) utilizing some GPU-optimized memory scheme. Everything is coded in C++ using a fairly new version of Rapidmind (http://www.rapidmind.net/), which seems fairly easy to use across multiple streamed processing platforms.

One big problem so far: the 3DS to voxel converter I'm currently using really sucks (e.g. I can only convert convex polygonal meshes), and unfortunately I wasn't able to find any voxel editors out there that supported grids of these sizes.

I'll try to keep you guys posted.
Multi Theft Auto, GTA multiplayer modification core developer: http://www.mtasa.com/
IJs
 
Posts: 5
Location: University of Twente, the Netherlands

Re: Real-time voxel raytracing

Postby dshankar » 24 Jan 2008, 04:32

Interesting to see the use of RapidMind! =D> Speaking of which, isn't it possible to render on both the CPU and the GPU using different RapidMind backplanes? Compile a GPU backplane, compile a x86 CPU backplane - wham - both are rendering. At least that's how I hope it works since I'm about to implement a rt ray tracer in a few weeks using this API :lol: . Let me know if you can render using both the CPU & GPU at the same time...
Cheers,
- DShankar
dshankar
 
Posts: 9

Re: Real-time voxel raytracing

Postby IJs » 27 Jan 2008, 23:35

Not sure if you can set it up right now so the GPU/CPU form some kind of hybrid program. If it isn't, I'm sure it'll be allowed somewhere in the future.

Good luck writing your real-time raytracer :)
Multi Theft Auto, GTA multiplayer modification core developer: http://www.mtasa.com/
IJs
 
Posts: 5
Location: University of Twente, the Netherlands

Re: Real-time voxel raytracing

Postby dshankar » 28 Jan 2008, 16:55

I just found out after searching for a couple of days that you can run multiple processes each utilizing different RM backends (for example process1.exe uses CPU backend, process2.exe uses GPU backend) but it is up to the programmer to implement load balancing and memory sharing etc. PITA but it's doable.
Cheers,
- DShankar
dshankar
 
Posts: 9


Return to General Development

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests