07.04.2013 Views

InkPlay: Watercolour Simulation using the Lattice Boltzmann Method ...

InkPlay: Watercolour Simulation using the Lattice Boltzmann Method ...

InkPlay: Watercolour Simulation using the Lattice Boltzmann Method ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The blocking factor κ at each site is defined as:<br />

κ = k1 + k2 G + k3 A + k4 g + k5 h Eq. 10<br />

where G and A are values from <strong>the</strong> grain and alum<br />

texture, ki are weights that define <strong>the</strong> blocking, g and h<br />

<strong>the</strong> glue concentration in <strong>the</strong> flow and fixture layers.<br />

4.4.5 Boundary and advection<br />

Since <strong>the</strong> effect of air is negligible, a single-phase model<br />

for water is used.<br />

The LBM for single-phase models was originally<br />

designed for <strong>the</strong> fluid to fill <strong>the</strong> whole domain. To overcome<br />

this limitation movable boundaries are introduced,<br />

where any site can become a boundary site and vice<br />

versa. A boundary site is a wet lattice site (i.e. ρ > 0)<br />

with at least one dry site amongst its eight neighbours.<br />

As <strong>the</strong> LBM model can cause negative water density for<br />

empty sites Chu and Tai (2005) reduce <strong>the</strong> advection<br />

when <strong>the</strong> water density gets low. This is done by introducing<br />

<strong>the</strong> factor ψ into equation 2:<br />

3 9 3<br />

ƒi (eq) = wi ρ + ρ0 ψ<br />

c 2 ei · u + 4 (ei · u)<br />

2c 2 – 2 u · u Eq.11<br />

2c<br />

ψ = smoothstep(0, α, ρ) Eq. 12<br />

where α is a parameter for adjusting this effect.<br />

4.4.6 Pinning texture<br />

Boundary roughening, or so called 'toes', are caused by<br />

<strong>the</strong> spreading front being pinned at different points. A<br />

front is depinned when <strong>the</strong>re is enough water pressure to<br />

overcome <strong>the</strong> pinning.<br />

Chu and Tai use simple local rules to model pinning and<br />

depinning which can be efficiently integrated into <strong>the</strong><br />

LBM.<br />

A site is a pinning site if it is dry and <strong>the</strong> water density<br />

ρ at each of <strong>the</strong> site's eight neighbours is below a<br />

specific threshold. The four nearest neighbours (north,<br />

east, south, west) share <strong>the</strong> same threshold, denoted by<br />

σ, and <strong>the</strong> four diagonal neighbours (NE, SE, SW, NW)<br />

use √ – 2 σ.<br />

The actual pinning is achieved by setting <strong>the</strong> blocking<br />

factor κ to a very high number to fully block all<br />

neighbouring links.<br />

To model <strong>the</strong> effect of paper disorder, a third helper<br />

texture map is introduced. It is procedurally created by<br />

sprinkling light, short lines on a black background.<br />

Modulating s with this texture gives <strong>the</strong> effect of easier<br />

ink flow at certain locations and directions.<br />

Fur<strong>the</strong>rmore σ is also made dependent on <strong>the</strong> glue concentration<br />

in <strong>the</strong> flow layer:<br />

σ = q1 + q2 h + q3 lerp(G, P, smoothstep(0, θ, g)) Eq. 13<br />

where G and P are values from <strong>the</strong> grain and pinning<br />

textures, qi are weights that define <strong>the</strong> roughening behaviour,<br />

and θ controls <strong>the</strong> effect of glue concentration on<br />

<strong>the</strong> appearance of toes. The lower θ <strong>the</strong> lower <strong>the</strong> glue<br />

concentration needs to be at which point <strong>the</strong> result equals<br />

<strong>the</strong> pinning texture (i.e. with no contribution from <strong>the</strong><br />

grain map any more).<br />

Like with <strong>the</strong> alum texture map <strong>InkPlay</strong> preserves this<br />

procedurally created map for later re-use to allow identical<br />

reproduction of its watercolour effects, if desired.<br />

4.4.7 Pigment advection<br />

The movement of pigments is calculated differently<br />

whe<strong>the</strong>r a site is becoming wet in <strong>the</strong> current simulation<br />

step or was already wet before.<br />

For <strong>the</strong> former pigment concentration newly advected to<br />

site x is:<br />

1<br />

pf *(x) = ρ<br />

8<br />

∑ ƒi pf (x – ei ) Eq. 14<br />

i =1<br />

For <strong>the</strong> latter <strong>the</strong> velocity is back-traced to find out from<br />

where <strong>the</strong> pigment arrived:<br />

pf *(x) = pf (x – u(x)) Eq. 15<br />

At first look back-tracing might not seem like <strong>the</strong> best<br />

approach, but at closer inspection it does make sense:<br />

Every lattice site has exactly one velocity vector assigned,<br />

which is <strong>the</strong> averaged, overall fluid movement<br />

derived from all ƒis. Tracing <strong>the</strong>se vectors forward<br />

would break this 1:1 relationship as not every site will<br />

have one vector pointing to it. Several vectors could<br />

point to one site leaving o<strong>the</strong>r sites as 'holes'. How to fill<br />

<strong>the</strong>m? And with what pigment colour? And if several<br />

vectors point to <strong>the</strong> same site likely some kind of equilibrium<br />

distribution equation would need to be called<br />

first, which could result in velocity vectors pointing at<br />

yet ano<strong>the</strong>r site, and so on.<br />

By back-tracing <strong>the</strong> velocity vectors after <strong>the</strong> ƒis were<br />

streamed <strong>the</strong> 1:1 relationship between a vector and a site<br />

is guaranteed and every site can be assigned pigments<br />

from some o<strong>the</strong>r site, guaranteeing no holes.<br />

Back-tracing will likely point to an origin somewhere in<br />

<strong>the</strong> middle between four lattice grid points. To find out<br />

that positions exact pigment concentration a triple linear<br />

interpolation is done:<br />

Given <strong>the</strong> regular 2D lattice grid points A, B, C and D<br />

(counter clockwise from bottom left) and <strong>the</strong>ir respective<br />

pigment concentrations a, b, c and d, and a point X<br />

somewhere within those four grid points, <strong>the</strong> back-traced<br />

pigment concentration x for point X is:<br />

temp1 = lerp( d, c, X.x - D.x);<br />

temp2 = lerp( a, b, X.x - A.x):<br />

x = lerp( temp1, temp2, X.y - A.y);<br />

Masters Thesis Page 7 of 9 Andreas C. Bauer<br />

MSc Computer Animation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!