Metaball Object

Technically speaking, a metaball object is a special kind of level which interprets its sub objects as a density distribution and computes a connecting boundary surface to a given density iso value. In practice, a metaball 'melts' its sub object together. The melting property makes the metaball object especially suitable for representing liquids.

The first metaball tutorial shows you how to set up a metaball system using a special construction tool.

Tutorial level: Beginner

Example project: 'tutorprojects/modeling/metaball/snowman'

1. Model a snowman using some analytic spheres. As the name might indicate, a metaball object melts only spheres, so do not use other kinds of objects. However, you can freely stretch the spheres if necessary.

A snowman consisting of six analytic spheres
Select the spheres and activate the metaball tool

2. Select all spheres. Go to the Creation tab of the toolbar and activate the Metaball tool.

Metaball tool

The hierarchy of a metaball system

A new object called 'Metaball' appears in the object hierarchy. Open its sub hierarchy; all the original spheres are placed there.

Controlling iso value

The default properties of the 'snowman' metaball are such that the boundary surface shrinks radically from the original spheres.

Shrunk snowman

The surface generated by a metaball level follows a given density value in space. Each sphere inside a metaball level adds its contribution to the density field: the density is zero at the outer edge of the sphere, and reaches its maximum value of one at the middle of the sphere radius.

A cross-section of a metaball system consisting of two spheres

3. Select the metaball level. Open the property window and go to the Spec tab.

The Iso Value field defines the density value, which the metaball surface follows. The default Iso Value is 0.5. Change it to a smaller value, say 0.1, and you will see how the snowman rapidly gains weight.

The metaball specific properties

Editing metaballs

The sub objects of a metaball level define its construction history. You can modify the sub objects and add new spheres, and the shape is updated automatically.

4. Select the head sphere of the snowman.

5. Activate the Transformation/Scale tool and expand the sphere. The metaball surface follows the modification.

6. Select the Metaball level. Apply the Make Current menu from the select window's popup.

7. Create two new analytic spheres below the snowman (legs). The spheres are inserted to the current level (= metaball), and the shape changes accordingly.

Alternatively, you can create the spheres at the root level, edit them a bit and finally drag&drop them into the metaball level.

Converting metaballs to another geometry type

Sometimes it may be desirable to convert a shape modeled using metaballs to another form. For example, a metaball surface does not have well defined UV coordinates, which can make applying textures and materials difficult. Fortunately, it is easy to convert a metaball shape to subdivision surface form. The converted shape can be edited further and textured using the SDS tools.

Let's experiment how this happens using the snowman shape:

8. If Metaball is still the current level, select the root level and apply Make Current to it. Then select the metaball level.

9. Go to the SDS tab of the toolbar. Activate the To SDS tool. Make sure that Use Default Resolutions and Subdivision Object options are set. Then click Accept.

10. Note that when the To SDS tool is used, it converts all sub objects to SDS objects as well. We do not need any of these sub objects converted. Hence select all the newly created SDS objects except the last one and delete them. This leaves us with the metaball SDS only.

11. You can now delete the metaball object.

12. Select the created subdivision object and open the property window. Go to the Spec tab. Change Rendering/Type option to Smoothen to Nurbs, and set Quality to the minimum value 1. Close the property window.

13. The remaining step is polygon reduction by converting triangles to rectangles. To do this, select the function Methods/Subdivision Surface/Merge Triangles to Quadrangles.

A subdivision surface that consists of quads usually renders smoother than a triangular SDS mesh, because it is difficult to divide most surface forms to triangles using a symmetric pattern.

Metaball properties

The Spec properties of a metaball include the controls listed below.

Iso Value: The iso value of the density distribution. The generated surface follows this value.

Channel: Defines the channel, which modifies the density distribution. If set, materials that affect the metaball are evaluated to find out the channel value.

Expansion: Expands (or shrinks) the size of metaballs from their true geometric size.

Resolution X, Y, Z: These gadgets define the overall accuracy of density field evaluation for metaball surface computation. The higher the resolution, the more accurate and smooth the computed surface will be. On the other hand, increased accuracy means longer computation time and higher polygon count on the resulting surface.

Test interval: An optimization control. If the metaball system does not include small details, or if the Resolution fields are so high that all details will be accurately sampled, the test interval value can be larger than one. Test interval defines how accurately the program examines points defined by the resolution values to find out places where the density really changes. If most of the space is empty, using this control can speed up metaball evaluation dramatically.

Accuracy: Defines how accurately a detected density iso value point is computed. The higher the value, the more exactly the surface follows the given iso value. The default accuracy level zero is sufficient for most situations.

Field: The type of density distribution. Defines how smoothly the density inside a metaball component decreases from one to zero. The following four alternatives are available:

Volume: The density drops rapidly to zero at the boundary.

Linear: The density decreases at a constant rate.

Quadric: The density decreases smoothly to zero.

Cubic: The density decreases extra smoothly to zero.

4th Degree: The density decreases proportionally to the 4th power of the radius. The smoothest way to blend metaballs.

Rendering:

Hierarchical: If set, the full sub hierarchy of the metaball level is examined to find metaballs, otherwise only the direct children.

Fluid simulation using metaballs

The next tutorial example, flowing water, combines fluid dynamics and metaballs. The idea is to use a creator object to produce new metaballs (= water drops) during the animation. First read the manual chapter Simulation if you are not yet familiar with the simulation tools of Realsoft 3D.

Tutorial level: Advanced

Example project: 'tutorprojects/modeling/metaball/metafluid'

1. Use the select window's New/Creator to add a creator object to the hierarchy.

2. Create an analytic sphere (radius about 5 cm) and drop it into the creator level. The sphere represents a water drop.

3. Open the property window and go to the Phys tab. Change the mass of the sphere to about 0.15 kilograms.

4. Switch to the Sim tab. Define Gravity = Affected and Fluid Dynamics = Affected for the sphere.

5. Select the creator object. Go to the Spec tab of the property window, and define (approximately) the following values:

Note that these values represent only one possible combination creating a slow water flow. You can experiment and find other values that work as well.

6. Switch to the Phys tab and define a spin value '2 0 0' for the creator object. This changes the direction of water drops slightly during the animation, making it more interesting.

7. Activate the Simulation/Fan tool from the toolbar, and draw a fan object in a view window. Set Turbulence = 1 from the Spec tab of the property window. Then go to the Phys tab and set Density = 10 (dense air will enable slow motion effect). Change Fluid Velocity to 1 m/s.

8. Start the Simulation/Gravity tool and draw a gravity line downward in a view window. Using the Spec tab, change Strength of gravity to 0.2.

9. Activate the Simulation option for the parent level of the created objects.

Now it is time to play the animation to check how the water drops move. It is faster to test the simulation part now when the metaball system is not yet included. Rewind the animation and adjust the above mentioned properties if necessary.

10. Select New/Metaball from the select window's popup menu. Drag and drop the creator, the fan and the gravity into its sub hierarchy.

The hierarchy of the scene is now ready. It is shown in the adjacent image.

11. We dropped the simulation components to a new hierarchy level after initial experiments. Therefore, select the metaball level and using the Spec tab of the property window, turn on Simulation again.

The structure of the simulation

12. With the metaball level selected, drag & drop the glass material from the material library to the view window.

Add a nice environment and lighting to the scene before rendering the animation - the kind of environment that gives a realistic look for transparent objects.

Material controlled density field

The regular spherical density field of metaballs can be modified using a material. The following example explains the required steps.

Tutorial level: Medium

Example project: 'tutorprojects/modeling/metaball/asteroid'

1. Create a group of analytic spheres. Select them and apply the tool Creation/Metaball.

2. Go to the Channels tab of the select window and create a new Float channel. Rename it, for example, as metadensity.

3. Go to the Materials tab of the select window and create a new VSL material called as 'Metafield'. Open the property window and check the Advanced option. First drop a Shader object from the VSL objects frame into the material root folder. Change the type of the shader to Surface Geometry. Then drop a Noise object into the Surface Geometry shader. Change Output of the Noise object to metadensity.

Density field material

Leave the Base value of the noise to zero and Amplitude to 1, as the noise should vary between 0 and 1 just like the original density field of metaballs. Set the 1D option to obtain faster noise computation (density is a one-dimensional value). Activate the Smooth option, which produces more continuous surface distortion.

4. Select Map/Parallel from the popup menu of the material library. Hold the Shift key down to get an uniform map geometry and draw a faily large parallel map cube over the metaballs in a view window.

Density field mapped to metaballs

5. Go back to the object hierarchy tab of the select window and activate the metaball level, which is now inside a new level. Open the property window. Go to the Spec tab and select metadensity from the Channel gadget. You may also set Rendering to Procedural; that method can properly represent very complex surfaces. However, procedural rendering is often much slower than triangle based rendering. On the other hand, memory consumption is very low and the render quality is much better.

Metadensity channel modifies the density field of a metaball system

6. Adjust the Iso Value so that a suitable amount of the density field generates a surface around it.

[Note] Note
The total density field is the product of the spherical density fields and the material defined density field.
An asteroid defined by two metaballs and a density field material