Difference between revisions of "Reference:Blob"

From POV-Wiki
Jump to navigation Jump to search
m (1 revision: Initial Load (TF))
 
m (corrected link issue)
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{#indexentry:blob, keyword}}
 
{{#indexentry:blob, keyword}}
 
{{#indexentry:keyword, blob}}  
 
{{#indexentry:keyword, blob}}  
<p>Blobs are an interesting and flexible object type. Mathematically they are
+
<p>Blobs are an interesting and flexible object type. Mathematically they are iso-surfaces of scalar fields, i.e. their surface is defined by the strength of the field in each point. If this strength is equal to a threshold value you are on the surface otherwise you are not.</p>
iso-surfaces of scalar fields, i.e. their surface is defined by the strength
+
<p>Picture each blob component as an object floating in space. This object is <em> filled</em> with a field that has its maximum at the center of the object and drops off to zero at the object's surface. The field strength of all those components are added together to form the field of the blob. Now POV-Ray looks for points where this field has a given value, the threshold
of the field in each point. If this strength is equal to a threshold value
+
value. All these points form the surface of the blob object. Points with a greater field value than the threshold value are considered to be inside while points with a smaller field value are outside.</p>
you are on the surface otherwise you are not.</p>
+
<p>There's another, simpler way of looking at blobs. They can be seen as a union of flexible components that attract or repel each other to form a blobby organic looking shape. The components' surfaces actually stretch out smoothly and connect as if they were made of honey or something similar.</p>
<p>
+
<p>The syntax for <code>blob</code> is defined as follows:</p>
Picture each blob component as an object floating in space. This object is
 
<em> filled</em> with a field that has its maximum at the center of the
 
object and drops off to zero at the object's surface. The field strength
 
of all those components are added together to form the field of the blob. Now
 
POV-Ray looks for points where this field has a given value, the threshold
 
value. All these points form the surface of the blob object. Points with a
 
greater field value than the threshold value are considered to be inside
 
while points with a smaller field value are outside.</p>
 
<p>
 
There's another, simpler way of looking at blobs. They can be seen as a
 
union of flexible components that attract or repel each other to form a
 
blobby organic looking shape. The components' surfaces actually stretch
 
out smoothly and connect as if they were made of honey or something similar.
 
</p>
 
<p>
 
The syntax for <code>blob</code> is defined as follows:</p>
 
 
<pre>
 
<pre>
 
BLOB:
 
BLOB:
Line 40: Line 24:
 
</pre>
 
</pre>
  
{{#indexentry:default values,blob}}
+
{{#indexentry:default values, blob}}
 
<p>Blob default values:</p>
 
<p>Blob default values:</p>
 
<pre>
 
<pre>
Line 50: Line 34:
 
{{#indexentry:threshold, blob}}
 
{{#indexentry:threshold, blob}}
 
{{#indexentry:keyword, threshold}}
 
{{#indexentry:keyword, threshold}}
<p>The <code>threshold</code> keyword is followed by a float value which
+
<p>The <code>threshold</code> keyword is followed by a float value which determines the total field strength value that POV-Ray is looking for. The default value if none is specified is <code>threshold 1.0</code>. By following the ray out into space and looking at how each blob component affects the ray, POV-Ray will find the points in space where the field strength is equal to the threshold value. The following list shows some things you should know about the threshold value.</p>
determines the total field strength value that POV-Ray is looking for. The
 
default value if none is specified is <code>threshold 1.0</code>. By
 
following the ray out into space and looking at how each blob component
 
affects the ray, POV-Ray will find the points in space where the field
 
strength is equal to the threshold value. The following list shows some
 
things you should know about the threshold value.</p>
 
  
 
<ol>
 
<ol>
Line 66: Line 44:
  
 
{{#indexentry:cylinder, blob component}}
 
{{#indexentry:cylinder, blob component}}
<p>Cylindrical components are specified by a <code>cylinder</code> statement.
+
<p>Cylindrical components are specified by a <code>cylinder</code> statement. The center of the end-caps of the cylinder is defined by the vectors <em><code>&lt;End1&gt;</code></em> and <em><code> &lt;End2&gt;</code></em>. Next is the float value of the <em>Radius</em> followed by the float <em>Strength</em>. These vectors and floats are required and should be separated
The center of the end-caps of the cylinder is defined by the vectors <em>
+
by commas. The keyword <code> strength</code> may optionally precede the strength value. The cylinder has hemispherical caps at each end.</p>
<code>&lt;End1&gt;</code></em> and <em><code> &lt;End2&gt;</code></em>. Next
 
is the float value of the <em>Radius</em> followed by the float <em>
 
Strength</em>. These vectors and floats are required and should be separated
 
by commas. The keyword <code> strength</code> may optionally precede the
 
strength value. The cylinder has hemispherical caps at each end.</p>
 
  
 
{{#indexentry:sphere, blob component}}
 
{{#indexentry:sphere, blob component}}
<p>Spherical components are specified by a <code>sphere</code> statement. The
+
<p>Spherical components are specified by a <code>sphere</code> statement. The location is defined by the vector <em><code>&lt;Center&gt;</code></em>. Next is the float value of the <em> Radius</em> followed by the float <em>
location is defined by the vector <em> <code>&lt;Center&gt;</code></em>. Next
+
Strength</em>. These vector and float values are required and should be separated by commas. The keyword <code> strength</code> may optionally precede the strength value.</p>
is the float value of the <em> Radius</em> followed by the float <em>
+
<p>You usually will apply a single texture to the entire blob object, and you typically use transformations to change its size, location, and orientation. However both the <code>cylinder</code> and <code>sphere</code> statements may have individual texture, pigment, normal, finish, and transformations applied to them. You may not apply separate <code>interior</code> statements to the components but you may specify one for the entire blob.</p>
Strength</em>. These vector and float values are required and should be
 
separated by commas. The keyword <code> strength</code> may optionally
 
precede the strength value.</p>
 
<p>
 
You usually will apply a single texture to the entire blob object, and you
 
typically use transformations to change its size, location, and orientation.
 
However both the <code>cylinder</code> and <code>sphere</code> statements may
 
have individual texture, pigment, normal, finish, and transformations applied
 
to them. You may not apply separate <code>interior</code> statements to the
 
components but you may specify one for the entire blob. </p>
 
 
<p class="Note"><strong>Note:</strong> By unevenly scaling a spherical component you can create ellipsoidal components. The
 
<p class="Note"><strong>Note:</strong> By unevenly scaling a spherical component you can create ellipsoidal components. The
 
tutorial section on <!--<linkto "Blob Object">Blob Object</linkto>--->[[Documentation:Tutorial Section 3.1#Blob Object|Blob Object]] illustrates individually textured blob components and many other blob examples.</p>
 
tutorial section on <!--<linkto "Blob Object">Blob Object</linkto>--->[[Documentation:Tutorial Section 3.1#Blob Object|Blob Object]] illustrates individually textured blob components and many other blob examples.</p>
Line 93: Line 56:
 
{{#indexentry:component, blob}}
 
{{#indexentry:component, blob}}
 
{{#indexentry:keyword, component}}  
 
{{#indexentry:keyword, component}}  
<p>The <code>component</code> keyword is an obsolete method for specifying a
+
<p>The <code>component</code> keyword is an obsolete method for specifying a spherical component and is only used for compatibility with earlier POV-Ray versions. It may not have textures or transformations individually applied to it.</p>
spherical component and is only used for compatibility with earlier POV-Ray
 
versions. It may not have textures or transformations individually applied to
 
it.</p>
 
  
 
{{#indexentry:strength, blob}}
 
{{#indexentry:strength, blob}}
 
{{#indexentry:keyword, strength}}  
 
{{#indexentry:keyword, strength}}  
<p>The <code>strength</code> parameter of either type of blob component is a
+
<p>The <code>strength</code> parameter of either type of blob component is a float value specifying the field strength at the center of the object. The strength may be positive or negative. A positive value will make that component attract other components while a negative value will make it repel other components. Components in different, separate blob shapes do not affect each other.</p>
float value specifying the field strength at the center of the object. The
 
strength may be positive or negative. A positive value will make that
 
component attract other components while a negative value will make it repel
 
other components. Components in different, separate blob shapes do not affect
 
each other.</p>
 
 
<p>You should keep the following things in mind.</p>
 
<p>You should keep the following things in mind.</p>
  
 
<ol>
 
<ol>
<li>The strength value may be positive or negative. Zero is a bad value,
+
<li>The strength value may be positive or negative. Zero is a bad value, as the net result is that no field was added -- you might just as well have not used this component.</li>
as the net result is that no field was added -- you might just as well have
+
<li>If strength is positive, then POV-Ray will add the component's field to the space around the center of the component. If this adds enough field strength to be greater than the threshold value you will see a surface.</li>
not used this component.</li>
+
<li>If the strength value is negative, then POV-Ray will subtract the component's field from the space around the center of the component. This will only do something if there happen to be positive components nearby. The surface around any nearby positive components will be dented away from the center of the negative component.</li>
<li>If strength is positive, then POV-Ray will add the component's field
 
to the space around the center of the component. If this adds enough field
 
strength to be greater than the threshold value you will see a surface.</li>
 
<li>If the strength value is negative, then POV-Ray will subtract the component's
 
field from the space around the center of the component. This will only
 
do something if there happen to be positive components nearby. The surface
 
around any nearby positive components will be dented
 
away from the center of the negative component.</li>
 
 
</ol>
 
</ol>
  
 
{{#indexentry:hierarchy, blob}}
 
{{#indexentry:hierarchy, blob}}
 
{{#indexentry:keyword, hierarchy}}  
 
{{#indexentry:keyword, hierarchy}}  
<p>After all components and the optional <code>threshold</code> value have
+
<p>After all components and the optional <code>threshold</code> value have been specified you may specify zero or more blob modifiers. A blob modifier is any regular object modifier or the <code>hierarchy</code> or <code>
been specified you may specify zero or more blob modifiers. A blob modifier
+
sturm</code> keywords.</p>
is any regular object modifier or the <code>hierarchy</code> or <code>
+
<p>The components of each blob object are internally bounded by a spherical bounding hierarchy to speed up blob intersection tests and other operations. Using the optional keyword <code>hierarchy</code> followed by an optional boolean float value will turn it off or on. By default it is on.</p>
sturm</code>keywords.</p>
 
<p>The components of each blob object are internally bounded by a spherical
 
bounding hierarchy to speed up blob intersection tests and other operations.
 
Using the optional keyword <code>hierarchy</code> followed by an optional
 
boolean float value will turn it off or on. By default it is on.</p>
 
  
 
{{#indexentry:sturm, blob}}
 
{{#indexentry:sturm, blob}}
 
{{#indexentry:keyword, sturm}}
 
{{#indexentry:keyword, sturm}}
<p>The calculations for blobs must be very accurate. If this shape renders
+
<p>If additional accuracy is required you can add the <code>[[Reference:Sturm Object Modifier|sturm]]</code> object modifier.</p>
improperly you may add the keyword <code>sturm</code> followed by an
 
optional boolean float value to turn off or on POV-Ray's
 
slower-yet-more-accurate Sturmian root solver. By default it is off.</p>
 
 
<p>An example of a three component blob is:</p>
 
<p>An example of a three component blob is:</p>
 
<pre>
 
<pre>
Line 151: Line 90:
 
</pre>
 
</pre>
  
<p>If you have a single blob component then the surface you see will just
+
<p>If you have a single blob component then the surface you see will just look like the object used, i.e. a sphere or a cylinder, with the surface being somewhere inside the surface specified for the component. The exact surface location can be determined from the blob equation listed below (you will probably never need to know this, blobs are more for visual appeal than
look like the object used, i.e. a sphere or a cylinder, with the surface
 
being somewhere inside the surface specified for the component. The exact
 
surface location can be determined from the blob equation listed below (you
 
will probably never need to know this, blobs are more for visual appeal than
 
 
for exact modeling).</p>
 
for exact modeling).</p>
<p>For the more mathematically minded, here's the formula used internally
+
<p>For the more mathematically minded, here's the formula used internally by POV-Ray to create blobs. You do not need to understand this to use blobs. The density of the blob field of a single component is:</p>
by POV-Ray to create blobs. You do not need to understand this to use
 
blobs. The density of the blob field of a single component is:</p>
 
  
 
<table class="centered" width="405x" cellpadding="0" cellspacing="10">
 
<table class="centered" width="405x" cellpadding="0" cellspacing="10">
Line 174: Line 107:
 
</table>
 
</table>
  
<p>where <em>distance</em> is the distance of a given point from the
+
<p>Where <em>distance</em> is the distance of a given point from the spherical blob's center or cylinder blob's axis. This formula has a convenient property that it is exactly equal to the strength parameter at the center of the component and drops off to exactly 0 at a distance from the center of the component that is equal to the radius value. The density formula for more than one blob component is just the sum of the individual component densities.</p>
spherical blob's center or cylinder blob's axis. This formula has the
 
nice property that it is exactly equal to the strength parameter at the
 
center of the component and drops off to exactly 0 at a distance from the
 
center of the component that is equal to the radius value. The density
 
formula for more than one blob component is just the sum of the individual
 
component densities.</p>
 

Latest revision as of 13:58, 17 July 2016

Blobs are an interesting and flexible object type. Mathematically they are iso-surfaces of scalar fields, i.e. their surface is defined by the strength of the field in each point. If this strength is equal to a threshold value you are on the surface otherwise you are not.

Picture each blob component as an object floating in space. This object is filled with a field that has its maximum at the center of the object and drops off to zero at the object's surface. The field strength of all those components are added together to form the field of the blob. Now POV-Ray looks for points where this field has a given value, the threshold value. All these points form the surface of the blob object. Points with a greater field value than the threshold value are considered to be inside while points with a smaller field value are outside.

There's another, simpler way of looking at blobs. They can be seen as a union of flexible components that attract or repel each other to form a blobby organic looking shape. The components' surfaces actually stretch out smoothly and connect as if they were made of honey or something similar.

The syntax for blob is defined as follows:

BLOB:
  blob { BLOB_ITEM... [BLOB_MODIFIERS...]}
BLOB_ITEM:
  sphere{<Center>, Radius,
    [ strength ] Strength[COMPONENT_MODIFIER...] } |
  cylinder{<End1>, <End2>, Radius,
    [ strength ] Strength [COMPONENT_MODIFIER...] } |
  component Strength, Radius, <Center> |
  threshold Amount
COMPONENT_MODIFIER:
  TEXTURE | PIGMENT | NORMAL | FINISH | TRANSFORMATION
BLOB_MODIFIER:
  hierarchy [Boolean] | sturm [Boolean] | OBJECT_MODIFIER

Blob default values:

hierarchy : on
sturm     : off
threshold : 1.0

The threshold keyword is followed by a float value which determines the total field strength value that POV-Ray is looking for. The default value if none is specified is threshold 1.0. By following the ray out into space and looking at how each blob component affects the ray, POV-Ray will find the points in space where the field strength is equal to the threshold value. The following list shows some things you should know about the threshold value.

  1. The threshold value must be positive.
  2. A component disappears if the threshold value is greater than its strength.
  3. As the threshold value gets larger, the surface you see gets closer to the centers of the components.
  4. As the threshold value gets smaller, the surface you see gets closer to the surface of the components.

Cylindrical components are specified by a cylinder statement. The center of the end-caps of the cylinder is defined by the vectors <End1> and <End2>. Next is the float value of the Radius followed by the float Strength. These vectors and floats are required and should be separated by commas. The keyword strength may optionally precede the strength value. The cylinder has hemispherical caps at each end.

Spherical components are specified by a sphere statement. The location is defined by the vector <Center>. Next is the float value of the Radius followed by the float Strength. These vector and float values are required and should be separated by commas. The keyword strength may optionally precede the strength value.

You usually will apply a single texture to the entire blob object, and you typically use transformations to change its size, location, and orientation. However both the cylinder and sphere statements may have individual texture, pigment, normal, finish, and transformations applied to them. You may not apply separate interior statements to the components but you may specify one for the entire blob.

Note: By unevenly scaling a spherical component you can create ellipsoidal components. The tutorial section on Blob Object illustrates individually textured blob components and many other blob examples.

The component keyword is an obsolete method for specifying a spherical component and is only used for compatibility with earlier POV-Ray versions. It may not have textures or transformations individually applied to it.

The strength parameter of either type of blob component is a float value specifying the field strength at the center of the object. The strength may be positive or negative. A positive value will make that component attract other components while a negative value will make it repel other components. Components in different, separate blob shapes do not affect each other.

You should keep the following things in mind.

  1. The strength value may be positive or negative. Zero is a bad value, as the net result is that no field was added -- you might just as well have not used this component.
  2. If strength is positive, then POV-Ray will add the component's field to the space around the center of the component. If this adds enough field strength to be greater than the threshold value you will see a surface.
  3. If the strength value is negative, then POV-Ray will subtract the component's field from the space around the center of the component. This will only do something if there happen to be positive components nearby. The surface around any nearby positive components will be dented away from the center of the negative component.

After all components and the optional threshold value have been specified you may specify zero or more blob modifiers. A blob modifier is any regular object modifier or the hierarchy or sturm keywords.

The components of each blob object are internally bounded by a spherical bounding hierarchy to speed up blob intersection tests and other operations. Using the optional keyword hierarchy followed by an optional boolean float value will turn it off or on. By default it is on.

If additional accuracy is required you can add the sturm object modifier.

An example of a three component blob is:

BLOB:
  blob {
    threshold 0.6
      sphere { <.75, 0, 0>, 1, 1 }
      sphere { <-.375, .64952, 0>, 1, 1 }
      sphere { <-.375, -.64952, 0>, 1, 1 }
    scale 2
    }

If you have a single blob component then the surface you see will just look like the object used, i.e. a sphere or a cylinder, with the surface being somewhere inside the surface specified for the component. The exact surface location can be determined from the blob equation listed below (you will probably never need to know this, blobs are more for visual appeal than for exact modeling).

For the more mathematically minded, here's the formula used internally by POV-Ray to create blobs. You do not need to understand this to use blobs. The density of the blob field of a single component is:

RefImgBlobdens.png

Blob Density

Where distance is the distance of a given point from the spherical blob's center or cylinder blob's axis. This formula has a convenient property that it is exactly equal to the strength parameter at the center of the component and drops off to exactly 0 at a distance from the center of the component that is equal to the radius value. The density formula for more than one blob component is just the sum of the individual component densities.