Korea University Jung Lee, Computer Graphics Laboratory 3D Game Engine Design David H. Eberly 8.3...

15
Korea University Korea University Jung Lee, Computer Graphics Jung Lee, Computer Graphics Laboratory Laboratory 3D Game Engine Design David H. Eberly 8.3 Special Surfaces 2001/11/13

Transcript of Korea University Jung Lee, Computer Graphics Laboratory 3D Game Engine Design David H. Eberly 8.3...

Korea UniversityKorea University

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

3D Game Engine Design

David H. Eberly

8.3 Special Surfaces

2001/11/13

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

2

Korea UniversityKorea University

Bezier Rectangle PatchesBezier Rectangle Patches

Popular with game programmers

• Mathematical simplicity

• Ease of use

Equation :

• (0 i0 n0, 0 i1 n1) : 3D control points

• The first-order partial derivatives of the patch

0

0

1

1

1011000 0

,,, )()(),(n

i

n

iiiinin ptBsBtsx

10iiP

))(()(),(10

0

0

1

1

101100 ,

1

0 0,1,,10 ii

n

i

n

iiiinins pptBsBntsx

))!(!/(!);(

)1();()(,inininC

ttinCtB iniin

))(()(),(10

0

0

1

1

101100 ,0

1

0,1,1,1 ii

n

i

n

iiiinint pptBsBntsx

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

3

Korea UniversityKorea University

Bezier Rectangle Patches Bezier Rectangle Patches EvaluationEvaluation

Trade-off of speed vs. accuracy Bernstein polynomial computation

• n0+1 evaluations of Bn0,i0(s)

• n1+1 evaluations of Bn1,i1(t)

• n0n1 multiplications for pairs of the evaluated polynomials

de Casteljau algorithm• Repeatedly computes convex combinations• Generally stable• Use more floating-point operations

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

4

Korea UniversityKorea University

Comparison For Bilinear Comparison For Bilinear InterpolationInterpolation

Case where n0=1 and n1=1

Bernstein form

• 2 subtractions, 9 additions, and 16

multiplications

de Casteljau form

• 2 subtractions, 9 additions, and 18

multiplications

1,10,11,00,0 )1()1()1)(1(

pstptsptspts

))1(())1)((1( 1,10,11,00,0

ptptsptpts

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

5

Korea UniversityKorea University

Degree ElevationDegree Elevation

Degree-elevated to (n0+1, n1)

Degree-elevated to (n0, n1+1)

Degree-elevated to (n0+1, n1+1)

• Degree-elevated control points

1

0 0,1

0

0,

0

0,,1

0

0

1

1

10101100 1)1

1()()(),(n

i

n

iiiiiinin p

n

ip

n

itBsBtsx

0

0

1

1

101011000

1

01,

1

1,

1

1,1, 1

)1

1()()(),(n

i

n

iiiiiinin p

n

ip

n

itBsBtsx

1

0

1

0,,,

0

0

1

1

101100)()(),(

n

i

n

iiiinin qtBsBtsx

1

11

111

1

1

1

1

1,1,1

1,,

0

0

0

0,

1010

1010

10

n

in

i

pp

pp

n

i

n

iq

iiii

iiiiii

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

6

Korea UniversityKorea University

Degree ReductionDegree Reduction

Let the degree-reduced surface• m0 n0, m1 n1

• Constraint The endpoints of the two curves are same Two choices for the extension to rectangle patches

The four corner points match between the two patches Least-squares fit to construct the remaining control points

• Process Degree-reduce the four boundary curves first Compute the remaining interior control points

Least-squares fit

0

0

1

1

1011000 0

,,, )()(),(m

i

m

iiiimim qtBsBtsy

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

7

Korea UniversityKorea University

Bezier Triangle PatchesBezier Triangle Patches

Slightly more complicated than Bezier rectangle patches

Useful for creating models of arbitrary complexity

Equation :• (i0, i1, i2 0, i0 + i1 + i2 = n)

• Evaluation

• Computing the coefficients To minimize arithmetic operations by saving

intermediate products and sums

nI

IIn pwvuBwvux ),,(),,( ,

210 ,, iiip

210

210

!!!

!

),,;(),,(

210

210,

iii

iiiIn

wvuiii

n

wvuiiinCwvuB

1,0,0,0,),,,( 210210 wvuwvuiiiIiiiI

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

8

Korea UniversityKorea University

Degree ElevationDegree Elevation

Multiply the original patch by

• Degree-elevated patch

Degree-elevated control points

wvu 1

nI nI

IInIIn qwvuBpwvuBwvuwvux1

,1, ),,(),,()(),,(

)(1

11,,2,1,1,,10 210210210

iiiiiiiiiI pipipin

q

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

9

Korea UniversityKorea University

Degree ReductionDegree Reduction

Let the degree-reduced surface• m n

• Constraint The endpoints of the two curves are same Two choices for the extension to triangle patches

The three corner points match between the two patches

Least-squares fit to construct the remaining control points

• Process The boundary curves are reduced first Compute the remaining interior control points

Least-squares fit

mI

IIm qwvuBwvuy ),,(),,( ,

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

10

Korea UniversityKorea University

Bezier Cylinder Surfaces (1 / Bezier Cylinder Surfaces (1 / 2)2)

Bezier rectangle/triangle patches

• More curvature variation than is needed Cylinder/developable surfaces

• Curved in 1D and flat• Two choice of generation

Taking a curve and linearly translating Sweeping operation

Taking a line segment and moving it One endpoint is constrained to the originally specified curve

• Evaluation, degree elevation/reduction can be applied to

Initial curve for cylinder surfaces Boundary curves for generalized cylinder surfaces

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

11

Korea UniversityKorea University

Bezier Cylinder Surfaces (2 / Bezier Cylinder Surfaces (2 / 2)2)

Cylinder Surface :• Bezier curve :• Linear translation :• The first-order partial derivatives :

Generalized cylinder surface• Specifying two Bezier curves

With the same number of control points• Blending between the two curves• Equation :

Control points : for 0 i n

• The first-order partial derivatives

n

i iin puBuy0 , )()(

D

Dvuyvvux )()1(),( ]1,0[),( vu

yDxyvx vuu ,)1(

n

i

n

i

n

iiiiniiniin qvpvuBquBvpuBvvux

0 0 0,,, )1()()()()1(),(

ii qp

,

1

011,1 )())(1()(

n

iiiiiinu qqvppvuBnx

n

iiiinv pquBx

0, ))((

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

12

Korea UniversityKorea University

Nonparametric B-Spline Nonparametric B-Spline Rectangle PatchesRectangle Patches

How to interpolate a rectangle lattice of scalars for 0 i0 n0, 0 i1 n1

• Componentwise interpolation B-spline polynomial of degree d

• for 0 k0 d• for 0 k1 d• : intermediate tensor

For applications• The intermediate tensor can be cached

),,(1010 iifii

d

j

d

j

d

k

d

kkkkjkjjdijdiii tXsXMMftsB

0 0 0 02/)1(,2/)1(

0 1 0 1

101100110010)()(),(

0

0)()( 0k

k issX 1

1)()( 1k

k ittX

11001100 2/)1(,2/)1( kjkjjdijdi MMf

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

13

Korea UniversityKorea University

Quadric SurfacesQuadric Surfaces

Discussion of the general quadratic equation

• A : 33 nonzero symmetric matrix

• : 31 vector

• c : scalar

• : 31 vector that represents the variable quantities A = RTDR

• D : diagonal matrix Diagonal entities are the eigenvalues of A

• R : rotational matrix Rows are corresponding eigenvectors

0

cxbxAxTT

b

x

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

14

Korea UniversityKorea University

EigendecompositionEigendecomposition

Rewritten quadratic equation• , ,

• Characterize the surface type based on the number of nonzero eigenvalues

Three : elliptic cone, ellipsoid, hyperboloid Two : line, union of two planes, elliptic cylinder,

hyperbolic cylinder, hyperbolic paraboloid One : parabolic cylinder

• Determine that the solution is degenerate from Point, line, plane

0

cyeyDyTT

eD,

xRy

bRe

Jung Lee, Computer Graphics Jung Lee, Computer Graphics LaboratoryLaboratory

15

Korea UniversityKorea University

Tube SurfacesTube Surfaces

Swept surface• Sweeping a region of space by a planar object

along a specified central curve Most common planar object : circle

Radius varies with time : r(t) Resulting surface is called a tube surface Equation :

: columns of an orientation matrix R(t) pp.286

t : curve parameter [0, 2)

Surface of revolution The central curve is a straight line

)(tx

)sin)(cos()(),(

BNtrtxtS

BNT ,,