23
Metaballs

Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Embed Size (px)

Citation preview

Page 1: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs

Page 2: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Iso-surface

• 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 function whose domain is 3D-space.

http://en.wikipedia.org/wiki/Isosurface

Page 3: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Iso-surface

Isosurface around Zirconocene molecule. {{CopyrightedFreeUseProvided}} Accelrys (http://www.accelrys.com) is acknowledged as the source

Page 4: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs

• Each metaball is defined as a function in n-dimensions (i.e. for three dimensions, f(x, y, z) ; 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.

http://en.wikipedia.org/wiki/Metaballs

Page 5: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs

• A typical function chosen for metaballs is • f(x, y, z) = 1/( ( p – q )2 ), where p = (x, y, z) and q the center of the metaball.

Page 6: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Examples

Page 7: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs : Criteria for functions

• When seeking a more efficient falloff function, several qualities are desired:

• Finite support. 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. 

Page 8: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs : Criteria for functions

• Finite support. A hierarchical culling system can thus ensure only the closest metaballs will need to be evaluated regardless of the total number in the field. 

f(x, y, z) = 0

f(x, y, z) > 0

Page 9: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs: Criteria for functions

• Smoothness. Because the isosurface is the result of adding the fields together, its smoothness is dependent on the smoothness of the falloff curves.

Page 10: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs

• Examples:(1) f(x, y, z) = (1 – r2)2 is a good choice. 

It’s a quatic polynormial of t.r = (x, y, z)Consider f(t) = (1-t2)2, f’(t) = 4t(1-t2),When t = 1, f’(t) = 0.

(2) f(x, y, z)  = 1/r2

Page 11: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs: Concept

• f(x, y, z)  = 1/r2

• If D(p1, q2) < D(p2, q2)

then E(q1) > E(q2)

p1 p2q1 q2

r

E0

E = 0E = 0

Page 12: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs: Concept• Show that• 1/(x- Δx)2 + 1/(x+ Δx)2 > 2/x2, Given that x > Δx• Left:2(x2+Δ2x)/[(x- Δx)2(x+ Δx)2]= 2(x2+Δ2x)/[(x2- Δ2x)2]= 2(x4+x2Δ2x)/[(x2- Δ2x)2x2]Right:2((x2- Δ2x)2) / [(x2- Δ2x)2x2]=2(x4-2x2Δ2x+ Δ4x) / [(x2- Δ2x)2x2](Left – Right)/2 and ignore the denominator3x2Δ2x - Δ4x 

p1 p2q1 q2

rE0

E = 0E = 0

p1 p2

x

Δx

x

qmidq

Page 13: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs: Concept

• Consider the one dimensional case• Given that x > 0, Δx > 0, x + Δx <= d/2, • ThenE( q(x) ) > E( q(x + Δx) )

E(q(x)) = 1/x2 + 1/(d - x)2

E(q(x+ Δx))= 1/(x + Δx)2 + 1/(d - x - Δx)2

p1 p2

x

q(x) q(x+ Δx)

d

Page 14: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Example

• (1-r2)

p1 p2

Page 15: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Example

• (1-r2)

p1 p2

Page 16: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Example

• (1-r2) E

p1 p2

Page 17: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Newton–Raphson method

• In numerical analysis, Newton's method (also known as the Newton–Raphson method), named after Isaac Newton and Joseph Raphson, is a method for finding successively better approximations to the roots (or zeroes) of a real-valued function.

http://en.wikipedia.org/wiki/Newton's_method

Page 18: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Newton–Raphson method

• f(p) = 1/(p-qi)2 – e

• p = p(x, y, z) = p0 + tu• x(t), y(t), z(t)• df/dt = ▽f(p) ● (dx/dt, dy/dt, dz/dt) = ▽f(p) ● u• ▽f(p) = (f/x, f/y, f/z)• tn+1 = tn – (f(p) /(▽f(p) ● u))

Page 19: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Metaballs

http://davis.wpi.edu/~matt/courses/fire/#metaballs

where a is the value of D(r) at r=0, and b is the root of the equation. For all r>b, the function returns 0. 

Page 20: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Marching along the segments

p1

p2

p3p4

p5

p6

Page 21: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Ray tracing metaball: Advancing Steps• Let the searching range be [t0, t1] and n be the total number of 

steps. Denote δ as the potential threshold . t is the current smallest intersection time. Pseudo code:

tbest = fbest = +∞FOR each step i from 0 to n DO

tt = t0 + (t1 – t0)* (i/n)

q = r.start + r.dir*tt

p = total potential at q

f = p – δ; // f is as near as possible to zero

If ( f is better (i.e., fbest > | f | ) ) {fbest = | f | and tbest = tt }

If ( fbest is smaller than error tolerant (i.e., ep >= fbest )) and t > tbest ) { break; }

ENDFOR

If (t > tbest and ep >= fbest ) { t = tbest }

//Notice: the error tolerant ep is very important. If it’s not chosen properly, the second intersection time is returned instead of the first one.

Page 22: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Total Potential at q

pq = 0

For each charge qiif q is affected by charge qi

 pq = pq + potential(qi, q)

Page 23: Metaballs. Iso-surface An isosurface is a three-dimensional analog of an isoline. It is a surface that represents points of a constant value (e.g. pressure,

Potential at q for a single charge qi:Using (1-r^2)^2 as an example

potential = (1- distance2(q, qi))2  ; if (distance(q, qi) < 1)

potential = 0   ; if (distance(q, qi) >= 1)