In
computer graphics
Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
, metaballs are organic-looking ''n''-dimensional
isosurface
An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure, temperature, velocity, density) within a volume of space; in other words, it is a level set of a continuous fu ...
s, characterised by their ability to meld together when in close proximity to create single, contiguous objects.
In
solid modelling
Solid modeling (or solid modelling) is a consistent set of principles for mathematical and computer modeling of three-dimensional shapes '' (solids)''. Solid modeling is distinguished from related areas of geometric modeling and computer graphi ...
,
polygon mesh
In 3D computer graphics and solid modeling, a polygon mesh is a collection of , s and s that defines the shape of a polyhedral object. The faces usually consist of triangles (triangle mesh), quadrilaterals (quads), or other simple convex polyg ...
es are commonly used. In certain instances, however, metaballs are superior. A metaball's "blobby" appearance makes them versatile tools, often used to model organic objects and also to create base meshes for
sculpting
Sculpture is the branch of the visual arts that operates in three dimensions. Sculpture is the three-dimensional art work which is physically presented in the dimensions of height, width and depth. It is one of the plastic arts. Durable sc ...
.
The technique for
rendering metaballs was invented by
Jim Blinn
James F. Blinn (born 1949) is an American computer scientist who first became widely known for his work as a computer graphics expert at NASA's Jet Propulsion Laboratory (JPL), particularly his work on the pre-encounter animations for the Voya ...
in the early 1980s to model atom interactions for
Carl Sagan
Carl Edward Sagan (; ; November 9, 1934December 20, 1996) was an American astronomer, planetary scientist, cosmologist, astrophysicist, astrobiologist, author, and science communicator. His best known scientific contribution is research on ext ...
's 1980 TV series ''
Cosmos
The cosmos (, ) is another name for the Universe. Using the word ''cosmos'' implies viewing the universe as a complex and orderly system or entity.
The cosmos, and understandings of the reasons for its existence and significance, are studied in ...
''. It is also referred to colloquially as the "jelly effect" in the
motion
In physics, motion is the phenomenon in which an object changes its position with respect to time. Motion is mathematically described in terms of displacement, distance, velocity, acceleration, speed and frame of reference to an observer and mea ...
and
UX design
User experience design (UX design, UXD, UED, or XD) is the process of defining the experience a user would go through when interacting with a digital product or website. Design decisions in UX design are often driven by research, data analysis, an ...
community,
commonly appearing in
UI elements such as navigations and buttons. Metaball behavior corresponds to
mitosis
In cell biology, mitosis () is a part of the cell cycle in which replicated chromosomes are separated into two new nuclei. Cell division by mitosis gives rise to genetically identical cells in which the total number of chromosomes is mainta ...
in cell biology, where chromosomes generate identical copies of itself through cell division.
Definition
Each metaball is defined as a
function
Function or functionality may refer to:
Computing
* Function key, a type of key on computer keyboards
* Function model, a structured representation of processes in a system
* Function object or functor or functionoid, a concept of object-oriente ...
in ''
n'' dimensions (e.g., for three dimensions,
; three-dimensional metaballs tend to be most common, with two-dimensional implementations popular as well). A thresholding value is also chosen, to define a solid volume. Then,
represents whether the volume enclosed by the surface defined by
metaballs is filled at
or not.
Implementation
A typical function chosen for metaballs is the
inverse-square law
In science, an inverse-square law is any scientific law stating that a specified physical quantity is inversely proportional to the square of the distance from the source of that physical quantity. The fundamental cause for this can be understo ...
, that is the contribution to the thresholding function falls off in a bell as the distance from the centre of the metaball increases.
For the three-dimensional case,
:
where
is the center of the metaball. However, due to the division, it is
computationally expensive
In computer science, the analysis of algorithms is the process of finding the computational complexity of algorithms—the amount of time, storage, or other resources needed to execute them. Usually, this involves determining a function that re ...
. For this reason, approximate
polynomial function
In mathematics, a polynomial is an expression (mathematics), expression consisting of indeterminate (variable), indeterminates (also called variable (mathematics), variables) and coefficients, that involves only the operations of addition, subtrac ...
s are typically used.
When seeking a more efficient falloff function, several qualities are desired:
*
Finite support
In mathematics, the support of a real-valued function f is the subset of the function domain containing the elements which are not mapped to zero. If the domain of f is a topological space, then the support of f is instead defined as the small ...
. A function with finite support goes to zero at a maximum radius. When evaluating the metaball field, any points beyond their maximum radius from the sample point can be ignored.
Nearest neighbor search
Nearest neighbor search (NNS), as a form of proximity search, is the optimization problem of finding the point in a given set that is closest (or most similar) to a given point. Closeness is typically expressed in terms of a dissimilarity function ...
can ensure only adjacent metaballs need to be evaluated regardless of the total number in the field.
*
Smoothness
In mathematical analysis, the smoothness of a function is a property measured by the number of continuous derivatives it has over some domain, called ''differentiability class''. At the very minimum, a function could be considered smooth if it ...
. Because the
isosurface
An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure, temperature, velocity, density) within a volume of space; in other words, it is a level set of a continuous fu ...
is the result of adding the fields together, its smoothness is dependent on the smoothness of the falloff curves.
The simplest falloff curve that satisfies these criteria is
where is the distance to the point. This formulation avoids expensive
square root
In mathematics, a square root of a number is a number such that ; in other words, a number whose ''square'' (the result of multiplying the number by itself, or ⋅ ) is . For example, 4 and −4 are square roots of 16, because .
E ...
calls.
More complicated models use a
Gaussian
Carl Friedrich Gauss (1777–1855) is the eponym of all of the topics listed below.
There are over 100 topics all named after this German mathematician and scientist, all in the fields of mathematics, physics, and astronomy. The English eponymo ...
potential constrained to a finite radius or a mixture of polynomials to achieve smoothness. The Soft Object model by the Wyvill brothers provides higher degree of smoothness and still avoids square roots.
A simple generalization of metaballs is to apply the falloff curve to distance-from-lines or distance-from-surfaces.
There are a number of ways to render the metaballs to the screen. In the case of three dimensional metaballs, the two most common are
brute force raycasting and the
marching cubes
Marching cubes is a computer graphics algorithm, published in the 1987 SIGGRAPH proceedings by Lorensen and Cline, for extracting a polygonal mesh of an isosurface from a three-dimensional discrete scalar field (the elements of which are sometime ...
algorithm.
2D metaballs were a very common
demo effect
Demo effect is computer-based real-time visual effects found in demos created by the demoscene.
The main purpose of demo effects in demos is to show off the skills of the programmer. Because of this, demo coders have often attempted to create n ...
in the 1990s. The effect is also available as an
XScreensaver
XScreenSaver is a free and open-source collection of 240+
screensavers for Unix, macOS, iOS and Android operating systems. It was created by Jamie Zawinski in 1992 and is still maintained by him, with new releases coming out several times ...
module.
See also
*
NURBS
Non-uniform rational basis spline (NURBS) is a mathematical model using basis splines (B-splines) that is commonly used in computer graphics for representing curves and surfaces. It offers great flexibility and precision for handling both analyt ...
*
Bézier surface
Bézier surfaces are a species of mathematical spline used in computer graphics, computer-aided design, and finite element modeling.
As with Bézier curves, a Bézier surface is defined by a set of control points. Similar to interpolation in man ...
References
Further reading
*{{cite journal , last1=Blinn , first1=J. F. , title=A Generalization of Algebraic Surface Drawing , doi=10.1145/357306.357310 , journal=
ACM Transactions on Graphics
''ACM Transactions on Graphics'' (TOG) is a bimonthly peer-reviewed scientific journal that covers the field of computer graphics. It was established in 1982 and is published by the Association for Computing Machinery. TOG publishes two special ...
, volume=1 , issue=3 , pages=235–256 , date=July 1982 , s2cid=24838292 , url=https://dl.acm.org/doi/pdf/10.1145/357306.357310
External links
Implicit Surfaces articleby Paul Bourke
from
Blender
A blender (sometimes called a mixer or liquidiser in British English) is a kitchen appliance, kitchen and laboratory appliance used to mix, crush, purée or emulsion, emulsify food and other substances. A stationary blender consists of a blender ...
wiki
Metaballs articlefrom
SIGGRAPH
SIGGRAPH (Special Interest Group on Computer Graphics and Interactive Techniques) is an annual conference on computer graphics (CG) organized by the ACM SIGGRAPH, starting in 1974. The main conference is held in North America; SIGGRAPH Asia ...
website
*
Exploring Metaballs and Isosurfaces in 2D, 3 September 2008, Stephen Whitmore, gamedev.net
3D computer graphics
Demo effects