1 Subdivision. 2 Subdivision for game Why? Large model require many memory for storage Need to...

Post on 18-Jan-2016

219 views 0 download

Tags:

Transcript of 1 Subdivision. 2 Subdivision for game Why? Large model require many memory for storage Need to...

1

Subdivision

2

Subdivision for game Why?

Large model require many memory for storage Need to dynamically tessellated during game play Make surface modeling easier

How to method Convert surface patches to a set of triangles

3

Classify of surface patch Rectangle patches Triangle patches Cylinder patches Spheres or ellipsoids

Two variations of subdivision Uniform Non-uniform

4

Subdivision of Bezier rectangles patches Uniform subdivision

Subdivided by uniformly tessellating the parameter space to a specified level L>=0

Total vertex number :

Total face number:

L=0 L=1

Parameter space for a rectangle patch

L2T 4

2)1 L(2 V

5

Subdivision of Bezier rectangles patches Non-uniform subdivision

Problem recursive uniform subdivision Ignores two important aspects of rendering surfaces

Patch may be flat in some sub-blocks Surface might be far away from the eye point

Using the Non-uniform subdivision If Second derivatives is large, applying subdivision If second derivatives is small, not applying subdivision

6

Subdivision of Bezier rectangles patches Adjustments for the camera model

To decide whether or not to subdivide Test the lengths of the nonlinear terms V If surface is near the eye point accept subdivision If surface is far from the eye point don’t accept subdivision

Heuristic method (by Sharp, 1999) To get an estimate of the length of the projection of into screen

space Select a slice and compute the width of that slice compute length of the projection of Compute the ratio of the length of to the slice Compare ratio to a tolerance, if small, subdivision accept

V

V

V

7

Subdivision of Bezier rectangles patches Cracking

Because allow for neighboring blocks to be subdivided to different resolutions

Occur the T-junction marked with a solid dot

Contain the crack

Solve

“Sharp(1999)”

Has no cracking

Solve : Collapse the midpoint vertex to a corner vertex

8

Subdivision of Bezier rectangles patches Two processing for non-uniform subdivision

To generate the vertices of the final mesh Using depth-first traversal of the quad tree

To fix the cracking

Subdivision that contains more complicated cracking

9

Subdivision of Bezier rectangles patches Partial subdivision

By user definition Don’t want to subdivided the right edge (1) Don’t want to subdivided the right and bottom edges (2) Don’t want to subdivided the top and bottom edges (3) Only want to subdivided the top edge (4)

(1)

(2)

(3)

(4)(1), (2) : Continue partial subdivision

(3), (4) : don’t continue partial subdivision

10

Subdivision of Bezier Rectangles Patches How to calculate information for subdivision

A B

C

D

Order : ABDC

L block : first traversal

L block determine subdivision, compute A

R block also subdivide ,

compute B and compute A

If C is subdivided,

first tinge need to compute D

After compute D, compute C

11

Subdivision of Bezier Triangle Patches Bezier triangle patches

More difficult to subdivide than Bezier rectangle patch more complicated indexing

Uniform subdivision Total vertex number

: Total face number

:L=0 L=1

Subdivision of parameter space

for a triangle patch

LT 4

)12)(1 1 LL(2 V

12

Subdivision of Bezier Triangle Patches Non-uniform subdivision

Use the equivalent of a symmetric triangulation for quad tree blocks

A vertex dependency structure

Subdivision corresponding binary tree

13

Subdivision of Bezier Triangle Patches H-adjacency

Two adjacent triangles share the same hypotenuse If want to subdivide H-hypotenuse, the one must also. Apply the following relationships

1. 2.

adjacenctHA andA silbing,: A and A i 12i1ii :42

adjacentHA andA adjacent,-H : A and A j 4iji :544adjacentHA andA also, j 4i :445

14

Subdivision of Bezier Triangle Patches Pattern for non-uniform subdivision

Number of vertices for L

Number of triangle for L T = 2L

odd L

even L

odd L

even L

k

kV

L

LL

k

kL

L

,)12(

),12)(12(

,)12(

,

22/)1(

12/2/

12

1

12

12/)1(

2/

15

Subdivision of Bezier Cylinder Surface Only the curve boundary need to be subdivided Uniform subdivision

Parameter space L(curve direction), M(extruded direction)

Similar Bezier rectangle patch Vertex number : , Triangle number :

Non-uniform subdivision Cylinder surface which include two boundary curves

The boundary curve : Non-uniform subdivision Extruded direction : uniform subdivision

L

M

)2)(12( MV L )1(2 1 MT L

16

Subdivision of Spheres and Ellipsoids Parameter surface

Start inscribed convex triangular mesh an inscribed octahedron mesh with equilateral triangular faces

Each triangle produce four triangle Insert midpoint on edge Midpoint move onto the sphere Projection midpoint through the ray on sphere

The ray : from the centroid of polyhedron to midpoint

Initial mesh

centroid

Projection processing

17

Subdivision of Spheres and Ellipsoids Data structure

typedef struct { float x, y, z; } Point3;

typedef struct { Point3* point;

int numEdges;

struct Edge ** edge; }Vertex;

typedef struct { struct Vertex* vertex[2];

struct Triangle * triangle[2]; } Edge;

typedef struct { struct Vertex* vertex[3];

struct Edge * edge[3];

struct Triangle * adjacent[3]; } Triangle;

typedef struct { int numVertices;

Vertex * vertex;

int numEdges;

Edge * edge;

int numTriangles;

Triangle * triangle;

Point3 centroid; } ConvexPolyhedron;

Goal - to have no reallocations of memory - to update the data structures in place(efficiently using memory)

18

Subdivision of Spheres and Ellipsoids Algorithm

Calculate the centroid of the convex polyhedron Average of the current vertices in the polyhedron :

Compute the midpoint of the edge Projecting point along the ray between centroid and midpoint o

n the sphere The ray :

New vertex location occur where the ray and sphere intersect Location for the new vertex : : parameter value at the intersection > 1 and the squared length of : 1 Root of quadratic equation :

sv

jjPC

0

M

)()(

CMtCtX

DtCP

t )(

tX

t

2

2012

1

2

4

a

aaaat

19

Subdivision of Spheres and EllipsoidsRelationship vertex, edge, triangle

Working set of vertices, edges, triangles Subdivided triangle

0i ,4τ τ,τ2ee ,evv i1iii1iii1i