gray

gray

About Gray

Gray (Greiners Raytracer) is a hobby/research project of mine. It is a program that simulates light to produce computer generated images. The technique used is called ray tracing, where a large number of rays are cast against mathematical 3D models to simulate the interaction between light and materials. The result is beautiful computer generated images, like the ones we are used to see in special effects in movies.

Isosurfaces

ProgrammingPosted by Søren Greiner Tue, February 02, 2010 13:39:53
My work with isosurfaces actually started more than a year ago (christmas 2008), but I have yet not posted any images on my website of my work.

Isosurfaces are surfaces described with a formula rather than with thousands of small polygons. The benefit is that very complex models can be visualized using only little memory, the drawback is lack of artistic control and costly evaluation times of each isosurface formula.

So what does an isosurface formula look like? One of the simplest is the sphere given by f(x,y,z)=x*x+y*y+z*z-r*r . The isosurface is given by all the x,y,z triplets that evaulates to 0 when inserted into f(x,y,z). Iso-surface because, all evaluations give the same value 0 on the surface.

The way I ray trace isosurfaces is by defining a bounding box around my object. When a ray hits the bounding box, Gray evaluates the formula f. If f is positive, I move forward along the ray and evaluates f again. When f yields a negative value this iteration stops and the last position with a positive value is selected as a point on the surface.

The trick to optimize this progress is the find some upper bound on the derivative of the formula f (how fast does f go towards 0). This tells me how far I can move forward and still be sure that f is positive. The actual implementation in Gray iterates in smaller and smaller steps until it is within some accepted threshold.

Enough talking. Here is an image:


This "rock" is a sphere, whose radius has been modulated with some fractal noise.