Reference:Blob
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.
- The threshold value must be positive.
- A component disappears if the threshold value is greater than its strength.
- As the threshold value gets larger, the surface you see gets closer to the centers of the components.
- 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.
- 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.
- 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.
- 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.
The calculations for blobs must be very accurate. If this shape renders
improperly you may add the keyword sturm
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.
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:
where distance is the distance of a given point from the 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.