virtual paint marbling http://people.csail.mit.edu/jaffer/Marbling/Mathematics

The Mathematics of Marbling

marble-dyed fabric The essential feature I am trying to produce is that when a tine moves through regions of different color paints, it stretches the boundaries between the paints to bend around it. If a blue paint region is surrounded by a red paint region, in the deformation induced by the movement of the tine through it, the blue region is still surrounded by the red region.

A mapping taking each point in the plane to its destination after the tine has moved through the area will be represented by a vector-valued function F from a plane (ℝ×ℝ) to a plane. Further, F will be a homeomorphism, a continuous bijection.

The functional composition of homeomorphisms is also a homeomorphism. So if we have a homeomorphism for a single stroke, we can compose the functions representing each movement together to create a more complicated homeomorphism where F1 will be the first stroke and Fn will be the last stroke of the sequence:
F = FnFn−1 ∘ … ∘ F1
Note that order is important here. The last stroke, Fn, will be the most obvious in the marbled image.

Paint boundary curves which are continuous in the plane are mapped to continuous curves by homeomorphisms, no matter how much they fold and stretch. In order for homeomorphisms to remain reversible, we set a maximum displacement z for the deformation each tine introduces.

2-Dimensional Fluid Mechanics

Consider an unbounded plane containing a 2-dimensional incompressible isotropic Newtonian fluid with laminar flow. Associated with F(x,y) is a vector field H(x,y)=F(x,y)-(x,y) returning the vector displacement at each coordinate. Along the y axis we introduce a displacement z, H(0,y)=(0,z) [F(0,y)=(0,y+z)]. This displacement will not affect points far away from the x axis; so the limit of H(x,y) tends to zero as the magnitude of x grows. Because the fluid is incompressible, the divergence of H is zero everywhere. Because its flow is laminar, it is uniform in the direction of motion, y:
Hy
y
= 0
Thus H(x,y) depends only on x. Furthemore, only the y component of H(x,y) depends on x. Let Hy(x)=Hy(x,0); then Hy(0)=z.

Hy(x) is even; the displacements to either side of x=0 will be equal and in the same direction. So we will consider Hy(x) for x≥0 only. Because the flow is laminar, displacements induced by z travel along the x axis should be proportional to z. Let w=Hy(a). Then Hy(2a) will be reduced from w by the same proportion as w was reduced from z.
Hy(2a)=w2
z
; thus Hy(2a)
Hy(0)
=w2
z2
=Hy(a)2
Hy(0)2
The only continuous real functions satisfying these constraints are Hy(x)=z·u|x| with independent parameter 0<u<1 related to the viscosity.

A key property of this marbling transform is that the displacement parallel to the line is dependent only on the perpendicular distance from the line. Because of this, the inverse transform is simply the forward transform with its displacement negated. We will use this property later on.

It is remarkable that an exact, closed-form expression is derived for the asymptotic equilibrium of a fluid-dynamics problem using little more than boundary conditions and symmetry.


About PostScript

Most of the marbling images are linked to PostScript files (with a ".ps" suffix). PostScript is a programming language; but these files use a very limited subset. There are links to language reference manuals and tutorials at the bottom of http://en.wikipedia.org/wiki/PostScript#The_language.

You can run PostScript programs and view the images they generate using GSview, available from http://pages.cs.wisc.edu/~ghost/gsview.


Paints

At the start of the real marbling process, paints are dropped from one or more locations to form expanding disks on a substrate. The mathematics is described in Dropping Paint. For now, we just want an paint pattern which shows subsequent displacements. In my first renderings, 5 virtual paints are dropped from the center to form 25 concentric rings of equal radial width.

The boundaries between virtual paint rings will be traversed using the Minsky circle algorithm; although walking the circles using coordinates generated by sin and cos would work as well. The angular step size is made inversely proportional to the ring radius, making the distance between successive points uniform.

[These images are linked to the PostScript files which generated them.]

A Single Stroke

For a single tine's vertical stroke, each (xy) coordinate in the paint-circle plane is mapped to Fv(xy):
Fv(xy) =  ( x, y + z·u|xxL| )
Fv displaces each point vertically by an amount exponentially decreasing with horizontal distance from the tine's x-coordinate xL.

Parameters

The scalars z and u control the maximum displacement and sharpness of the bends, respectively. An earlier version of this work used hyperbolic approximations parametrized by (z and) c>0. A rough equivalence is u=1/21/c. The larger z is, the larger the maximum displacement. The smaller c is, the sharper the bends are.

The transform for straight, horizontal strokes is to displace each point horizontally by an amount exponentially decreasing with vertical distance from the tine's y-coordinate yL:
Fh(xy) =  ( z · u |yyL| + x, y )

Rendering

The lines connecting the mapped coordinates of points adjacent on the circle form a closed curve. The region inside this boundary curve is then filled with the outermost paint color. This rendering process, implemented directly in PostScript, is repeated for the next largest circle and so on until the projections of all the paint circles have been filled with their respective paint colors.

Multiple Strokes

Because the composition of homeomorphisms is a homeomorphism, the mapping functions for the strokes can be composed, forming a single function. With this composite function taking the place of the single stroke function in the above algorithm, we are marbling!

After verifying that a combing and its reverse (eg. North and South) cancel each other, the next combing sequence to try is a commutator. Where operators do not commute, composing operators and their inverses in an asymmetrical sequence often reveals essential properties of their mathematical interactions.

The image to the right is the result of straight combings (7 tines) in the North, East, South, then West directions.

[These images are linked to the PostScript files which generated them.]

The image to the left was combed North, East, South, then East. Although the depth of combing was the same as the previous picture, its character is somewhat different.

Generalizations

This calculation can be extended to lines with arbitrary slope. If L is the tine-line, N is a unit vector perpendicular to L, B a point on the tine line, and P a point, then P's minimum distance from the line is d, the length of the projection of vector PB onto N:
d = | (PB) · N |
Given M, the unit vector in the direction of the tine line L, the (vector) mapping for point P is:
FL(P) =  P + z · ud · M


Circular tine tracks are also compatible with laminar incompressible flow. In this case points are displaced along arcs around a center point C.

Because the displacements tend to zero far from the center, outside of the tine track the exponentially decreasing magnitude of the displacements again applies. Inside of the tine track, however, asymptotic considerations don't apply. This finite area could, for instance, rotate as a rigid disk. Using the same formula on the inside as the outside lets circular tine tracks with very large radii behave similarly to straight tine tracks.
d = | ||PC||−r |
The length l of the displacement arc, and its angle a subtended at C are:
l = z · ud       a = l
||PC||
The point P is thus mapped to:
FC(P) =  C + (PC) ·( cos a
−sin a
  sin a
cos a
)


The figure to the left shows the paths of the virtual tines moving through the field of view. Those clockwise circular motions result in the marbling shown to the right.

Arcs of increasing radius whose centers track away from the field of view create a fan like that at the top of this article.

Vortex

Outside the circle of radius r consider the arc-length l as a function of the distance h between P and C, z, u, and r:
l(h,z,u,r) = z·uhr
It follows that:
l(h,z,u,r) = z·uhr = (z·ur)uh = l(h,z·ur,u,0)
This allows us to reduce the fourth argument to zero, resulting in a vortex centered at C. Given z, u, and r for a vortex, the length l of the displacement arc, and its angle a subtended at C are:
h = ||PC||       l = (z·ur) · uh       a = l
h
If h = 0, then FV(C) = C. Otherwise, h > 0, and the point P is mapped to:
FV(P) =  C + (PC) ·( cos a
−sin a
  sin a
cos a
)


Short Strokes

The deformation caused by a arbitrarily thin tine being inserted; moved a short distance; then extracted turns out to require fluid mechanics theory to solve. Read Oseen Flow in Paint Marbling (on arXiv) for the full story.

The next chapter deals with tine tracks with other than straight or circular trajectories.

Copyright © 2003, 2004, 2007, 2010, 2011, 2016, 2017 Aubrey Jaffer

I am a guest and not a member of the MIT Computer Science and Artificial Intelligence Laboratory.  My actions and comments do not reflect in any way on MIT.
Topological Computer Graphics
agj @ alum.mit.edu
Go Figure!