3.4.5 Parametric Object

Where the isosurface object uses implicit surface functions, F(x,y,z)=0, the parametric object is a set of equations for a surface expressed in the form of the parameters that locate points on the surface, x(u,v), y(u,v), z(u,v). Each pair of values for u and v gives a single point <x,y,z> in 3d space

The parametric object is not a solid object it is "hollow", like a thin shell.

Syntax:

  parametric {
    function { FUNCTION_ITEMS },
    function { FUNCTION_ITEMS },
    function { FUNCTION_ITEMS }
    <u1,v1>, <u2,v2>
    [contained_by { SPHERE | BOX }]
    [max_gradient FLOAT_VALUE]
    [accuracy FLOAT_VALUE]
    [precompute DEPTH, VarList]
  }

Parametric default values:

accuracy     : 0.001 

The first function calculates the x value of the surface, the second y and the third the z value. Allowed is any function that results in a float.

<u1,v1>,<u2,v2> boundaries of the (u,v) space, in which the surface has to be calculated

contained_by { ... } The contained_by 'object' limits the area where POV-Ray samples for the surface of the function. This container can either be a sphere or a box, both of which use the standard POV-Ray syntax. If not specified a box {<-1,-1,-1>, <1,1,1>} will be used as default.

max_gradient, It is not really the maximum gradient. It's the maximum magnitude of all six partial derivatives over the specified ranges of u and v. That is, if you take dx/du, dx/dv, dy/du, dy/dv, dz/du, and dz/dv and calculate them over the entire range, the max_gradient is the maximum of the absolute values of all of those values.

accuracy The default value is 0.001. Smaller values produces more accurate surfaces, but take longer to render.

precompute can speedup rendering of parametric surfaces. It simply divides parametric surfaces into small ones (2^depth) and precomputes ranges of the variables(x,y,z) which you specify after depth. The maximum depth is 20. High values of depth can produce arrays that use a lot of memory, take longer to parse and render faster. If you declare a parametric surface with the precompute keyword and then use it twice, all arrays are in memory only once.

Example, a unit sphere:

  parametric {
    function { sin(u)*cos(v) }
    function { sin(u)*sin(v) }
    function { cos(u) }

    <0,0>, <2*pi,pi>
    contained_by { sphere{0, 1.1} }
    max_gradient ??
    accuracy 0.0001
    precompute 10 x,y,z
    pigment {rgb 1}
  }