Subdivision Schemes - PowerPoint PPT Presentation

About This Presentation
Title:

Subdivision Schemes

Description:

Every edge and every vertex must be part of a face. Also define an 'up' direction ... creating a new vertex. Split a face, creating new edges and new faces ... – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 28
Provided by: Stephen787
Category:

less

Transcript and Presenter's Notes

Title: Subdivision Schemes


1
Subdivision Schemes
  • Basic idea Start with something coarse, and
    refine it into smaller pieces for rendering
  • We have seen how subdivision may be used to
    render parametric curves and Bezier surfaces
  • We will see how it can be used for modeling
    specific objects, and as a modeling scheme in
    itself
  • In this lecture
  • Subdivision for tessellating a sphere, and
    implementation details
  • Subdivision for fractal surfaces
  • Subdivision for B-spline patches
  • General subdivision surfaces

2
Tessellating a Sphere
  • Spheres are best parameterized in polar
    coordinates
  • Note the singularity at the poles
  • Tessellation The process of approximating a
    surface with a polygon mesh
  • One option for tessellating a sphere
  • Step around and up the sphere in constant steps
    of ? and ?
  • Problem Polygons are of wildly different sizes,
    and some vertices have very high degree

3
Subdivision Method
  • Begin with a course approximation to the sphere,
    that uses only triangles
  • Two good candidates are platonic solids with
    triangular faces Octahedron, Isosahedron
  • They have uniformly sized faces and uniform
    vertex degree
  • Repeat the following process
  • Insert a new vertex in the middle of each edge
  • Push the vertices out to the surface of the
    sphere
  • Break each triangular face into 4 triangles using
    the new vertices

Octahedron
Isosahedron
4
The First Stage
Each new vertex is degree 6, original vertices
are degree 4
Each face gets split into 4
5
Sphere Subdivision Advantages
  • All the triangles at any given level are the same
    size
  • Relies on the initial mesh having equal sized
    faces, and properties of the sphere
  • The new vertices all have the same degree
  • Mesh is uniform in newly generated areas
  • This is a property we will see later in
    subdivision surfaces
  • Makes it easier to analyze what happens to the
    surface
  • The location and degree of existing vertices does
    not change
  • The only extraordinary points lie on the initial
    mesh

6
Fractal Surfaces
  • Fractals are objects that show self similarity
  • The word is overloaded it can also mean other
    things
  • Landscapes and coastlines are considered fractal
    in nature
  • Mountains have hills on them that have rocks on
    them and so on
  • Continents have gulfs that have harbors that have
    bays and so on
  • Subdivision is the natural way of building
    fractal surfaces
  • Start with coarse features, Subdivide to finer
    features
  • Different types of fractals come from different
    subdivision schemes and different parameters to
    those schemes

7
Fractal Terrain (1)
  • Start with a coarse mesh
  • Vertices on this mesh wont move, so they can be
    used to set mountain peaks and valleys
  • Also defines the boundary
  • Mesh must not have dangling edges or vertices
  • Every edge and every vertex must be part of a
    face
  • Also define an up direction
  • Then repeatedly
  • Add new vertices at the midpoint of each edge,
    and randomly push them up or down
  • Split each face into four, as for the sphere

8
Fractal Terrain Example
A mountainside
9
Fractal Terrain Details
  • There are options for choosing where to move the
    new vertices
  • Uniform random offset
  • Normally distributed offset small motions more
    likely
  • Procedural rule eg Perlin noise
  • Scaling the offset of new points according to the
    subdivision level is essential
  • For the subdivision to converge to a smooth
    surface, the offset must be reduced for each
    level
  • Colors are frequently chosen based on altitude

10
Fractal Terrains
http//members.aol.com/maksoy/vistfrac/sunset.htm
11
Terrain, clouds generated using procedural
textures and Perlin noise http//www.planetside.co
.uk/ -- tool is called Terragen
12
Terrain, clouds generated using procedural
textures and Perlin noise http//www.planetside.co
.uk/ -- tool is called Terragen
13
Terrain, clouds generated using procedural
textures and Perlin noise http//www.planetside.co
.uk/ -- tool is called Terragen
14
Implementing Subdivision (1)
  • We must represent a polygon mesh
  • Basic operations
  • Split an edge, creating a new vertex
  • Split a face, creating new edges and new faces
    based on the old edges and the old and new
    vertices
  • Questions influencing the data structures
  • Should we store edges explicitly?
  • Should faces know about their edges?
  • How do we access the required information when
    performing the basic operations?

15
Implementing Subdivision (2)
  • Split an edge, create a new vertex and two new
    edges
  • Each edge must be split exactly once
  • Need to know endpoints of edge to create new
    vertex
  • Split a face, creating new edges and new faces
    based on the old edges and the old and new
    vertices
  • Require knowledge of which new edges to use
  • Require knowledge of new vertex locations
  • Note Everything works from edges!

16
Implementing Subdivision (3)
  • Should we explicitly store edges? Yes!
  • Easy to step through all edges and split them
  • Each edge can store the edges that will replace
    it
  • Each face can point to its edges, so it knows the
    location of new vertices and edges
  • What does each vertex need to store?
  • What does each edge need to store?
  • What does each face need to store?
  • Answers are in C, but converting to C classes
    is easy

17
Vertex Data
  • Vertices need to know where they are, and they
    will be copied as part of the algorithm
  • For rendering, may want
  • Per-vertex normals Compute at the end by
    averaging normals from faces that share the
    vertex
  • Texture coordinates

struct Vertex float x3 float t2 float n
3 int num_faces
18
Edge Data
  • Need to know endpoints, new vertex when split,
    and new edges when split
  • Store pointers as indexes into a list
  • Also want to identify boundary edges, which
    should not have vertices perturbed when split

struct Edge int v_start // Index of start
vertex int v_end // Index of end
vertex int v_new // Index of new
vertex int e_start // Index of one
sub-edge int e_end // Index of other
sub-edge bool boundary
19
Face Data
  • Faces are triangles that need to know
  • Edges, in a fixed order for rendering
  • Complication Some edges point forward around the
    face, some point backwards. Store this info.
  • Normals, for rendering or computing vertex
    normals
  • Compute at the end

struct Face int edges3 bool forward3 fl
oat n3
20
Mesh Data Structure
  • Mesh stores
  • Vertices, edges and faces
  • The up direction for offsetting vertices

struct Mesh int num_vertices struct
Vertex vertices int num_edges struct
Edge edges int num_faces struct
Face faces float up3
21
Fractal Terrain Algorithm
  • The hard part is keeping track of all the indices
    and other data
  • Same algorithm works for subdividing sphere

Split_One_Level(struct Mesh terrain) Copy old
vertices for all edges Create and store new
vertex Create and store new edges for all
faces Create new edges interior to
face Create new faces Replace old vertices,
edges and faces
22
General Subdivision Schemes
  • Subdivision schemes can also be used where there
    is no target surface
  • They aim to replace a polygonal mesh with a
    smooth surface that approximates the coarse mesh
  • There are many schemes
  • Butterfly scheme (for triangular meshes)
  • Catmull-Clark subdivision (for mostly rectangular
    meshes, converges to B-splines in uniform
    regions)
  • Loops scheme (for triangular meshes)
  • Modified butterfly scheme (for triangular meshes)
  • Many more

23
Butterfly Scheme
  • Subdivides the same way we have been discussing
  • Each edge is split
  • Each face is split into four
  • Rules are defined for computing the splitting
    vertex of each edge
  • Basic rule for a uniform region
  • Splitting an edge with endpoints that have degree
    6
  • As before, all new interior vertices will have
    degree 6
  • Take a weighted sum of the neighboring vertices
  • Weights define rules
  • http//www.gamasutra.com/features/20000411/sharp_0
    1.htm

24
Butterfly Scheme (1)
b
c
c
a
a
d
d
b
c
c
  • Multiply each vertex by its weight and sum them
    up
  • w is a control parameter determines how closely
    the shape conforms to the original mesh

25
Modified Butterfly Scheme
  • The butterfly scheme must be modified to deal
    with edges with an endpoint of degree ? 6
  • In that case, compute new vertex based only the
    neighbors of the extraordinary vertex
  • If an edge has two extraordinary endpoints,
    average the results from each endpoint to get the
    new endpoint
  • The modified butterfly scheme is provably
    continuous about extraordinary vertices
  • Proof formulates subdivision as a matrix operator
    and does eigen-analysis of subdivision matrix

26
Modified Butterfly Scheme
e3
e2
e1
e0
v
eN-1
eN-3
eN-2
27
Modified Butterfly Example
  • Notes
  • The mesh is uniform everywhere except the
    original vertices
  • It interpolates the original vertices
  • It has smoothed out the underlying mesh
Write a Comment
User Comments (0)
About PowerShow.com