Digital Hermit  -- Unix and Linux Solutions  About    Linux    Mathematics    Science    The Project   
 

Isosurfaces

NOT FINISHED YET!
As mentioned in the mesh tutorial, povray uses mathematical representations of objects internally and the primitives discussed earlier are just pre-defined calls to the isosurface object. This allows great flexibility since almost any object, as long as you can visualize it mathematically, can be modeled in povray. For an insanely complete and well written tutorial on isosurfaces, please check out Mike Williams' treatment of the subject at http://www.econym.demon.co.uk/isotut/index.htm.

Isosurfaces

We start by setting up our scene -- laying a nice checkerboard carpet, adding lights, positioning our camera. We make one significant change, however, by swapping the X and Y dimensions to make our function definitions somewhat easier to visualize in external software such as MuPAD or GnuPLOT.

#include "colors.inc"
#include "textures.inc"

camera {
  location < 4, 5, 4>
  look_at  < 0, 0,  0>
  right <-4/3,0,0>
}

plane { <0, 1, 0>, -1
  pigment {
    checker color Red, color Blue
  }
}

light_source { <2, 8, -0> color White}

Next we'll create the actual surface. We declare the isosurface so that we can more easily manipulate the object later. In this example the isosurface is defined by the function cos(x*y) - z. If you've visited the previous tutorial on meshes, you'll see that this is a re-written form of z=cos(x*y).
 
#declare surface1=isosurface {
  function { cos(x*y) - z }
        accuracy 0.001
        max_gradient 4
		open
		threshold 1
        contained_by {
			box {-4, 2} 
		}
}
Finally, we place the object and add a finish.
object { surface1 rotate 90*x 
 pigment { BrightGold }
     finish {
        ambient .1
        diffuse .1
        specular 1
        roughness .01
        metallic
        reflection {
          .65
          metallic
        }
     }

}


After we render the picture:

 
© 2002, 2003     Kwan Lowe     DigitalHermit