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.

Parametric Surfaces

ProgrammingPosted by Søren Greiner Tue, February 02, 2010 16:32:13
Another way of creating 3D models is by using parametric surfaces. A parametric surface is described by a function of two variables u and v that evaluates to a x,y,z coordinate. The function f(u,v) can then, by sweeping u and v over a range, generate points that can be connected to a mesh of small triangles.

An example is a flat plane given by:
x = u
y = v
z = 0

for u = [0,1] and v=[0,1]

This yields a small flat square (rather dull to look at).

More interesting are parametric surfaces that sweep through all three coordinates, x,y,z.

This formula is a the formula for a torus:
x = (0.7+0.3*cos(v))*cos(u)
y = (0.7+0.3*cos(v))*sin(u)
z = 0.3*sin(v)

for u = [0, 2*pi] and v = [0, 2*pi]

And the resulting image (using a glass material):