Difference between revisions of "Reference:Parametric"

From POV-Wiki
Jump to navigation Jump to search
m (1 revision: Initial Load (TF))
 
m (one more point)
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
{{#indexentry:function, parametric}}
 
{{#indexentry:function, parametric}}
 
{{#indexentry:keyword, function}}  
 
{{#indexentry:keyword, function}}  
<p>Where the isosurface object uses implicit surface functions, F(x,y,z)=0, the parametric object
+
<p>While the <code>isosurface</code> object uses implicit surface functions like <strong><em>F(x,y,z) = 0</em></strong> the <code>parametric</code> object uses is a set of equations for a surface expressed in the form of the parameters that locate points on the surface. For example: <code>x(u,v)</code>, <code>y(u,v)</code>, <code>z(u,v)</code>. Each of the pairs of values for <code>u</code> and <code>v</code> gives a single point <code>&lt;x,y,z&gt;</code> in 3d space.</p>
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 <code>&lt;x,y,z&gt;</code>
 
in 3d space.</p>
 
  
<p>The parametric object is not a solid object it is <em>hollow</em>, like a thin shell.</p>
+
<p>The <code>parametric</code> object is not a solid it is <em>hollow</em>, like a thin shell. The syntax is as follows:</p>
 
 
<p>Syntax:</p>
 
 
<pre>
 
<pre>
 
parametric {
 
parametric {
Line 28: Line 23:
  
 
{{#indexentry:default values, parametric}}
 
{{#indexentry:default values, parametric}}
<p>Parametric default values:</p>
+
<p>The default values are:</p>
 
 
 
<pre>
 
<pre>
accuracy    : 0.001  
+
accuracy    : 0.001
 +
contained_by : box {&lt;-1,-1,-1&gt;, &lt;1,1,1&gt;}
 
</pre>
 
</pre>
 
<p>The first function calculates the <code>x</code> value of the surface, the second <code>y</code> and
 
the third the <code>z</code> value. Allowed is any function that results in a float.</p>
 
 
<p><code>&lt;u1,v1&gt;,&lt;u2,v2&gt;</code> boundaries of the <code>(u,v)</code> space, in which
 
the surface has to be calculated</p>
 
 
 
{{#indexentry:contained_by, parametric}}
 
{{#indexentry:contained_by, parametric}}
 
{{#indexentry:keyword, contained_by}}
 
{{#indexentry:keyword, contained_by}}
<p><code>contained_by { ... }</code> 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 <code>box {&lt;-1,-1,-1&gt;, &lt;1,1,1&gt;}</code>
 
will be used as default.</p>
 
 
 
{{#indexentry:max_gradient, parametric}}
 
{{#indexentry:max_gradient, parametric}}
 
{{#indexentry:keyword, max_gradient}}
 
{{#indexentry:keyword, max_gradient}}
<p><code>max_gradient</code>,
 
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 <code>dx/du</code>, <code>dx/dv</code>, <code>dy/du</code>,
 
<code>dy/dv</code>, <code>dz/du</code>, and <code>dz/dv</code>
 
and calculate them over the entire range, the <code>max_gradient</code> is the
 
maximum of the absolute values of all of those values.
 
</p>
 
 
 
{{#indexentry:accuracy, parametric}}
 
{{#indexentry:accuracy, parametric}}
 
{{#indexentry:keyword, accuracy}}
 
{{#indexentry:keyword, accuracy}}
<p><code>accuracy</code> The default value is 0.001. Smaller values produces more accurate surfaces,
 
but take longer to render.</p>
 
 
 
{{#indexentry:precompute, parametric}}
 
{{#indexentry:precompute, parametric}}
 
{{#indexentry:keyword, precompute}}
 
{{#indexentry:keyword, precompute}}
<p><code>precompute</code> can speedup rendering of parametric surfaces. It simply divides parametric
+
<ol>
surfaces into small ones (2^depth) and precomputes ranges of the variables(x,y,z) which you specify
+
  <li>The first function calculates the <code>x</code> value of the surface, the second <code>y</code> and the third the <code>z</code> value. Any function that results in a float is allowed.</li>
after depth. The maximum depth is 20. High values of depth can produce arrays that use a lot of memory,
+
  <li>The <code>&lt;u1,v1&gt;</code> and the <code>&lt;u2,v2&gt;</code> boundaries of the <code>(u,v)</code> space, in which the surface <em>has</em> to be calculated.</li>
take longer to parse and render faster. If you declare a parametric surface with the precompute keyword
+
  <li>The <code>contained_by</code> <em>object</em> limits the area where POV-Ray samples for the surface of the function. The container can either be a <code>sphere</code> or a <code>box</code>.</li>
and then use it twice, all arrays are in memory only once.</p>  
+
  <li>The <code>max_gradient</code> is the maximum magnitude of all six partial derivatives over the specified ranges of u and v.</li>
 
+
  <ol type="a">
 +
    <li>Take <code>dx/du</code>, <code>dx/dv</code>, <code>dy/du</code>, <code>dy/dv</code>, <code>dz/du</code>, and <code>dz/dv</code> and calculate them over the entire range</li>
 +
    <li>The <code>max_gradient</code> should be at least the maximum (absolute value) of all of those values.</li>
 +
    <li>Choosing a <em>too small</em> of a value will create holes or artifacts in the object.</li>
 +
  </ol>
 +
  <li>For <code>accuracy</code> smaller values produces more accurate surfaces, but take longer to render.</li>
 +
  <li>Using <code>precompute</code> can speedup the rendering of parametric surfaces by simply dividing the parametric surfaces into smaller ones</li>
 +
    <ol type="a">
 +
      <li>The maximum value for <em>DEPTH</em> is 20. High values of depth can produce arrays that use a lot of memory, take longer to parse and render.</li>
 +
      <li>It <em>precomputes</em> the ranges for the <em>VarList</em> variables (x,y,z)</li>
 +
      <li>If you declare a <code>parametric</code> surface using <code>precompute</code> and then use it twice, all arrays are in memory only once.</li>
 +
    </ol>  
 +
</ol>
 
<p>Example, a unit sphere:</p>
 
<p>Example, a unit sphere:</p>
 
<pre>
 
<pre>

Latest revision as of 00:12, 22 November 2016

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

The parametric object is not a solid it is hollow, like a thin shell. The syntax is as follows:

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]
  }

The default values are:

accuracy     : 0.001
contained_by : box {<-1,-1,-1>, <1,1,1>} 
  1. The first function calculates the x value of the surface, the second y and the third the z value. Any function that results in a float is allowed.
  2. The <u1,v1> and the <u2,v2> boundaries of the (u,v) space, in which the surface has to be calculated.
  3. The contained_by object limits the area where POV-Ray samples for the surface of the function. The container can either be a sphere or a box.
  4. The max_gradient is the maximum magnitude of all six partial derivatives over the specified ranges of u and v.
    1. Take dx/du, dx/dv, dy/du, dy/dv, dz/du, and dz/dv and calculate them over the entire range
    2. The max_gradient should be at least the maximum (absolute value) of all of those values.
    3. Choosing a too small of a value will create holes or artifacts in the object.
  5. For accuracy smaller values produces more accurate surfaces, but take longer to render.
  6. Using precompute can speedup the rendering of parametric surfaces by simply dividing the parametric surfaces into smaller ones
    1. The maximum value for DEPTH is 20. High values of depth can produce arrays that use a lot of memory, take longer to parse and render.
    2. It precomputes the ranges for the VarList variables (x,y,z)
    3. If you declare a parametric surface using precompute 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}
  }