This topic is now archived and is closed to further replies.


blob objects

Recommended Posts

Does anyone know if it is possible or feasible to raytrace blob objects? I know how to do "marching cubes" to polygonize blobs, but I really love raytracing, and I''d be a lot happier if I also had a program to raytrace them as well. (In case you don''t know, by blob objects I mean a field function determined by distances from points and lines, with a threshold to define the isosurface.)

Share this post

Link to post
Share on other sites
Think of your blob in terms of voxels. Now raytracing is a heck of a lot easier than marching cubes.

You probably know how line-drawing algorithms work (most notably Bresenham's, or maybe DDA). If not, check google; it will explain better than I could.

Now, implement one of these algorithms in 3d. Simple. For each ray, march through your voxels (since it's all math, you don't need to store a 3d bitmap; just compute as you go). Then just stop when you reach the critical value. There, you've got your point of intersection (rounded to the nearest voxel center, sure, but that's no big deal). You can figure it out from there!

I do not pretend that this is necessarily the most efficient way. It merely happens to be the technique with which I am most familiar. I can guess at an improvement though.

Binary search. If you can determine one point on your ray that is within the volume, then you can do a binary search on the ray (rather than marching through it sequentially) to hone in on the edge. This also gives you the ability, unlike the sequential voxel method, to get to an arbitrary precision.

The key there is knowing one point within the volume. There may be a trick to this I don't know, but you may just start at the point on the ray closest to the center of the object and search outward for "solid" points. Then you can do the binary search with that and the eye as endpoints.

An alternative to the raytracing approach is the "splatting" approach in which you rasterize "slices" of the volume on top of each other, starting at the back. That technique may yield results, and can benefit from hardware acceleration, but might not fit well into a raytracer.

Whatever method you choose, good luck with your project.

[edited by - TerranFury on April 28, 2003 7:23:13 PM]

Share this post

Link to post
Share on other sites