Rune's Blob Tutorial

Image that shows off how this
tutorial will visualize blobs The blob primitive in POV-Ray is a very flexible shape, that can for example be used to create organic-looking shapes. At first it can be a little difficult to understand how blobs work, because the shape of the blob is affected by several variables. The most important variables are the threshold of the blob, the strength of each component, and the radius of each component. In this document I will attempt to make it easy to understand how these variables work, as well as tell a few tips, that can make it easier to work with blobs.

Imagine a blob as…

To the left: Visualizion of blob component
To the right: The actual blob component Imagine a blob component as a mountain partly under water. In my images you can see what's below the surface of the water, but let's pretend that you can't. So we have a mountain with a certain radius, but it is only some of the mountain that is visible. That is the part that is above the water level.

A blob component works in a similar way. It has a certain radius, but it appears smaller than its radius, because we can only see the part of the component that has a strength greater than the threshold value.

Radius

blob {
   threshold Threshold
   sphere { <Center>, Radius, Strength }
   cylinder { <End1>, <End2>, Radius, Strength }
}
The visible radius is always smaller than the actual radius In the image to the right you can see three blob components. The first component has a radius of 1, the second has a radius of 2, and the third has a radius of 3. All three components have a strength of 2.

We won't go into details here, but just take note of that the visible radius is never as big as the actual radius you specify.

Strength

blob {
   threshold Threshold
   sphere { <Center>, Radius, Strength }
   cylinder { <End1>, <End2>, Radius, Strength }
}
The higher the strength, the more we can see In the image to the right you can see three blob components. All three components have a radius of 2. The three components have different strength values. In the blob graph this is shown as the mountains having different heights.

As we can see in the image, the greater the strength, the more of the component is visible. If the strength is very high, the visible radius is almost as big as the actual radius. That's because most of the mountain is above the water level. If the strength is small, the visible radius is much smaller than the actual radius. That's because most of the mountain is below the water level.

Threshold

blob {
   threshold Threshold
   sphere { <Center>, Radius, Strength }
   cylinder { <End1>, <End2>, Radius, Strength }
}
The higher the threshold, the less we can see When we have some mountains partly under water, we can only see parts of the mountains. If we lower the level of the water, we can see more of the mountains. If we increase the level of the water, we can see less of the mountains. And if the level of the water is higher than the height of a mountain, then the mountain is not visible at all.

Similar with blob components. If we lower the threshold value, we can see more of the blob components. If we increase the threshold value, we can see less of the blob components. And if the threshold value is greater than the strength of a blob component, then the blob component becomes invisible.

Strength relative to threshold

Threshold and strength are relative The strength value and the threshold value always works relative to each other. Multiplying the strength with 2 gives the same result as dividing the threshold with 2. And if you multiply the strength and the threshold with the same amount, then the result remains the same.

It is important to note though, that the strength only affects one component at a time, while the threshold affects all the components in a blob. When you work with a blob with many components, it's a good idea to set the threshold value once and for all, and after that only modify the strength values of the individual components.

In the image: From the top image to bottom image the strength of all the components have been multiplied with 2, but the threshold has also been multiplied with 2, so the result remains the same.

Controlling the visible radius and the blobbiness

Different combinations of radius and strength
can give the same visible radius, but different
degrees of blobbiness The radius value controls the actual radius of the blob component, but as already mentioned, the visible radius is never as big as the actual radius, because it's only part of the blob that is visible. The visible radius of a blob component is a result of both the radius and the strength.

Different combinations of radius and strength can give the same visible radius, but with different degrees of "blobbiness" (see image). To be able to control the visible radius and the blobbiness precisely, you need to know some formulas and stuff, which are a bit complicated. To make it easier, I have made a macro:

#macro easyblob (_threshold,_visibleradius,_blobbiness)
   #local _strength = (1+1/_blobbiness)*_threshold;
   #local _actualradius =
   _visibleradius/sqrt(1-sqrt(_threshold/_strength));
   _actualradius, _strength
#end


For a sphere blob component, you use it as follows:

sphere {
   <Center>,
   easyblob (Threshold, Visible_radius, Blobbiness)
}


For a cylinder blob component, you use it as follows:

cylinder {
   <End1>, <End2>,
   easyblob (Threshold, Visible_radius, Blobbiness)
}
The Threshold value should be the same as the threshold value of the blob. The Visible_radius is how big you want the visible radius to be. The Blobbiness is how much the blob component should blob together with other blob components. All three values must be positive.

The easyblob macro is not the solution for everything, but it is a nice tool when working with blobs.

Component interaction

Component interaction
is simple addition Exactly how does components blob together? Well, it's pretty simple. For a given point, the strengths of the different components are simply added together.

In the image to the right we have three blob components with a strength of 1.5. What happens when we move them so they're all located at the same location? The strengths are added together!

Negative strengths

Negative strengths As mentioned, strengths are simply added together. So if we want to subtract something from a blob component, we can just use another blob component that has a negative strength. The strength of the negative component is subtracted from positive components.

The image at the right shows three examples of sphere components with cylinder components subtracted from them. In all the examples the threshold is 0.5, and the strength of the sphere is 1.5. The difference between the threshold of 0.5 and the strength of 1.5 is 1.0. That means that a negative strength of more than 1.0 is required to cut a hole through the sphere.

In the first example the negative strength of the cylinder is 0.5. That isn't enough to cut a hole through the sphere. In the next example the negative strength is 1.0. That's on the edge between being a hole there or not. In the last example the negative strength of the cylinder is 1.5. That clearly is enough to cut a hole through the sphere.

Joining cylinders

Joining cylinders smoothly The cylinder blob components are very useful for some purposes, but sometimes it causes problems to join them smoothly. Suppose we want to make the letter "T" out of a blob. It only requires two cylinders, like in the upper image to the right. Both cylinders have a strength of 1.

However, at the area where the cylinders overlap, the strengths are added together, so we have a strength of 2. That causes an enlarged, bulbous region where the cylinders meet. If we want to get rid of that, we can just place a sphere with a strength of -1 at the place where the cylinders meet. That is far the easiest way to join cylinder components smoothly, and it works perfectly. You can see that in the lower image.

That's it for now…

Blob hand Well, that was the basics of blobs... Now there's only one thing to do - go playing around with blobs yourself! :)

Feedback about this tutorial is much appreciated!