230 likes | 430 Views
Implicit Surfaces. CS 319 Advanced Topics in Computer Graphics John C. Hart. Implicit Surfaces. f = 0. f < 0. f > 0. Real function f ( x , y , z ) Classifies points in space Image synthesis (sometimes) inside f > 0 outside f < 0 on the surface f = 0
E N D
Implicit Surfaces CS 319 Advanced Topics in Computer Graphics John C. Hart
Implicit Surfaces f = 0 f < 0 f > 0 • Real function f (x,y,z) • Classifies points in space • Image synthesis (sometimes) • inside f > 0 • outside f < 0 • on the surface f = 0 • CAGD: inside f < 0, outside f > 0 • Surface f-1(0): Manifold if zero is a regular value of f f = 0 f > 0 f < 0
Why Use Implicits? • v. polygons • smoother • compact, fewer higher-level primitives • harder to display in real time • v. parametric patches • easier to blend • no topology problems • lower degree • harder to parameterize • easier to ray trace
Conversion • Implicitization: parametric -> implicit • find f given p s.t. f (p(s,t)) = 0 • elimination, resultants [Sederberg 83] • “moving surfaces” method reduces degree • Parameterization: implicit -> parametric • find p given f s.t. f (p(s,t)) = 0 • Creates parametric patches • Polygonization • Texture mapping
Surface Normals • Surface normal usually gradient of function f(x,y,z) = (df/dx, df/dy, df/dz) • Gradient not necessarily unit length • Gradient points in direction of increasing f • Outward when f < 0 denotes interior • Inward when f > 0 denotes interior
Plane x N • Plane bounds half-space • Specify plane with point p and normal N • Points in plane x are perp. to normal N • f is distance if ||N|| = 1 f > 0 p x f < 0 f(x) = (x-p)N
Quadrics f (x,y,z) =Ax2 + 2Bxy + 2Cxz + 2Dx + Ey2 + 2Fyz + 2Gy + Hz2 + 2Iz + J • Ellipsoid (Sphere): Ax2 + Ey2 + Hz2 – 1 = 0 • Cylinder: Ax2 + Ey2 – 1 = 0 • Hyperboloid (Cone): Ax2 + Ey2 - Hz2 + J = 0 • Paraboloid: Ax2 + Ey2 – 2Iz = 0
Homogeneous Quadrics Homogeneous coordinates • [xyzw] • Divide by w to find actual coords: [x/wy/wz/w 1] f(x) = xTQx Transforming quadrics x Q xT = 0, x’ = xT find Q’ s.t. x’Q’x’T = 0 x = x’T* since x homo. x’T* Q (x’T*)T = 0 x’(T* QT*T)x’T = 0 Q’ = T* QT*T
Torus r R • Product of two implicit circles (x – R)2 + z2 – r2 = 0 (x + R)2 + z2 – r2 = 0 ((x – R)2 + z2 – r2)((x + R)2 + z2 – r2) (x2 – Rx + R2 + z2 – r2) (x2 + Rx + R2 + z2 – r2) x4+2x2z2+z4 – 2x2r2–2z2r2+r4 + 2x2R2+2z2R2–2r2R2+R4 (x2 + z2 – r2 – R2)2 + 4z2R2 – 4r2R2 • Surface of rotation replace x2 with x2 + y2 f(x,y,z) = (x2 + y2 + z2 – r2 – R2)2 + 4R2(z2 – r2)
Deforming Implicits • f on undeformed space • Affine • Scale: (ax,by,cz) (stretch, squash) • Shear: (x + ay + bz, y + cz, z) • Non-Affine (Barr S84) • Taper: (z x, z y, z) • Twist: (x cos z - y sin z, x sin z + y cos z, z) • Bend: look it up… ( f T-1)(x,y,z) f (T-1(x,y,z))
Distance Surfaces • Sphere: d(x, point) – r • Cylinder: d(x, line) – r • Sphylinder: d(x, segment) – r • Torus: d(x, circle) – r • Generalize cylinder: d(x, curve) – r • Offset surface: d(x, surface) – r d(x,A) = min {||x-y|| : yA} Parametrics, algebraics not closed under offsetting
CSG f < 0 g < 0 • Assume f < 0 inside • CSG ops by min/max ops • Union: min f,g • Intersection: max f,g • Complement: -f • Subtraction: max f,-g • Problem: C1 discontinuity • Can we smooth the blend crease? f < 0 g < 0
Blending • Smooth surface that interpolates surfaces of two separate shapes • Applications: • Image Synthesis: Blobs, soft objects, metaballs • CAGD: Algebraic, Pseudonorm • Scope • Global: Affects entire shape • Local: Affects bounded region
Blobs • Blinn TOG 1(3) 1982 • Sum of Gaussians ri2(x,y,z) = x2 + y2 + z2 f(x) = -1 + Sexp(-(Bi/Ri2)ri2 + Bi) B – blobbiness (positive) R – radius of blob at rest r – radius function
Soft Objects 1 C(r) • Wyvill, McPheeters & Wyvill VC 86 • Exponential: too expensive, non-local • Approximate exp(-r2) with polynomial C() C(0) = 1, C(R) = 0, C’(0) = 0, C’(R) = 0 C(r2) = -(4/9)r6/R6 + (17/9)r4 /R4 – (22/9)r2 /R2 + 1 C(r) = 2r3 /R3 – 3r2 /R2 + 1 C(r) = (1 – r2/R2)3 (G2 continuity) Pair of quadratics (metaballs) 0 0 r R=1
Algebraic Blends r2 s2 • Hoffman & Hopcroft VC 85 • Blend f -1(0) with g-1(0) • Consider shells f -1(s1), g-1(s2) • Blends occur where f -1(s1) intersects g-1(s2) • Define some h(s1,s2) = 0 • h(s1,s2) = (s1 – r1)2/r12 +(s2 – r2)2/r22 – 1 (ellipse) • Blend: H(x) = h( f (x),g(x)) • If f,g quadric, then H quartic, usually a torus • If f < r1 and g < r2 then return H otherwise return min f,g r1 s1
y Pseudonorm Blend r2 S(x,y) = 1 - [1 - x/r1]t - [1 - y/r2]t • Rockwood Geometric Modeling: Algorithms & Trends 1987, Ed. Farin. • Local blend • r1,r2 extent of blend • t adherence x r1 BU ( f,g) = 1 - [1 - f/r1]t - [1 - g/r2]t BI ( f,g) = -BU (-f,-g)
Blend Normals • H(x) = h( f (x),g(x)) • h(f,g) = A( f ) + B(g) + C, usually • H = A’( f ) f + B’(g) g • E.g. algebraic blend • h(f,g) = (f-a)2/a2 + (g-b)2/b2 – 1 • H = (2(f-a)/a2)f + (2(g-b)/b2)g • Normal of blend a blend of normals
Hypertexture • Noise • Perlin S85 • Smoothly interp. random values • Noise range deformation • f(x,y,z) + N(x,y,z) • Islands of debris can form • Noise domain deformation • f((x,y,z) + DN(x,y,z)) • No debris
Ray Tracing d o • Parametric ray • r(t) = o + td • anchor o • (unit) direction d • Solve implicit function on ray • F(t) = f(r(t)) • Real function of one variable • Zeroes of F implicit surface ray intersections F t
Finding Zeroes • Algebraic surfaces • DesCartes [Hanrahan S’84] • Lipschitz surfaces • LG-Surfaces [Kalra & Barr S’89] • Sphere Tracing [Hart 96] • Any surfaces • Interval Arithmetic [Mitchell 89] • Marching [Perlin & Hoffert 89]