Notes for Wednesday April 28 -- implicit surfaces

Implicit surfaces

We showed an alternate way of creating triangle meshes: Define a function that fills a volume, then create an approximation of the surface where that function value is zero.

The most well known way of doing this is the Marching Cubes algorithm published in 1987 by Bill Lorensen. The basic idea is to evaluate regular samples within a rectalinear volume, then look at each little cube that has one of those sample at each of its eight corners.

We use those values at the corners to create a plausible set of triangles in the interior of the cube that approximates a surface where the function is zero.

Since the function at any of the eight corners of the cube can have either a positive or negative value, there are 28 or 256 possibilities. We store those possibilities in a table, and then do a table look-up for each cube to create the triangles that comprise the approximate surface.

Because the marching cubes algorithm has so many cases, some people use an alternative approach, in which each cube is partitioned into six tetrahedra, whose vertices are, respectively:

   [0,0,0] , [1,0,0] , [1,1,0] , [1,1,1]
   [0,0,0] , [1,0,0] , [1,0,1] , [1,1,1]
   [0,0,0] , [0,1,0] , [1,1,0] , [1,1,1]
   [0,0,0] , [0,1,0] , [0,1,1] , [1,1,1]
   [0,0,0] , [0,0,1] , [1,0,1] , [1,1,1]
   [0,0,0] , [0,0,1] , [0,1,1] , [1,1,1]
Each tetrahedron can have either zero, one or two triangles as the approximating surface in its interior. The code included in this assignment contains a complete working implementation of the Marching Tetrahedra algorithm.

To effectively use the Marching Tetrahedra algorithm to create interesting shapes, one approach is to add up functions that create lots of little spherical blobs.

When the blobs fuse together, they form interesting shapes. If you properly place these spherical regions, you can create many biologically interesting shapes, including bodies, faces, hands, animals and plants.

For each blob with center C and radius r, we can define the following function:

FC,r(x,y,z) = max(0, 1 - 0.16 * ((x-Cx)2 + (y-Cy)2 (z-Cx)2)) / r2
We can then take the sum of all these functions raised to a power and add an offset to that sum, to get a function that we can pass into the implicit surface generator:
n FC,r(x,y,z)4   -   ½
This function will "blend" together all of the spherical blobs as they start to get near each other.

At the end of class we showed the Oscar winning short computer animated film Ryan by Chris Landreth:

https://videosift.com/video/Chris-Landreth-Ryan-Oscar-winning-animated-short>Ryan

Homework, due before the start of class on Wednesday May 5

Starting with the code we developed in class, which you can find in hw10.zip, create your own implicit surface object or objects.

See if you can make something that looks like a creature, or a hand, or anything recognizable.

You don't need to redefine the implicitSurfaceMesh every animation frame. Instead, you can choose to define a mesh just once outside the animation loop, and then simply display that mesh every frame. Doing this will let you create a much more complex shape.