CS488 - Introduction to Computer Graphics - Lecture 19

Comments and Questions


Texture Mapping

  1. Basic
    1. Start with a 2D image: pixellated or procedural
    2. Map 2D image onto primitive using a 2D affine transformation
      • Simple if the surface of the primitive is flat
      • otherwise, ...
      • Texture pixels normally do not match display pixels, so some image processing may be needed.
    3. Backwards map intersection point with ray into the image to get the surface properties
  2. Solid Textures
    1. Solution to mapping texture onto curved surfaces, or onto surfaces where you see more than one side
    2. Usually procedural
  3. Normal Mapping (Bump mapping)
    1. Start with a difference surface, defined with respect to the surface
      1. Where does the difference surface come from?
      2. Geometric models
      3. Meshes,
      4. Scanning
    2. Calculate the normals to the difference surface and map them onto the surface of the primitive
      1. How do you calculate the normals?
      2. Geometric models: differentiate analytically
      3. Meshes, scanned models: differentiate numerically
    3. Use the mapped surface models for lighting
    4. No occlusion, shadows are wrong, silhouettes are wrong, nobody notices!
  4. Displacement Textures
    1. Solution to mapping texture onto curved surfaces
    2. Usually procedural

Modelling

Particle Systems

What are they?

  1. Collections of particles that taken together represent something
  2. Each particle has
    1. an initial state
      • position
      • velocity
      • size
      • colour and/or luminosity
      • etc
    2. an update function
      • changes the state
      • can die
      • can have random perturbations
      • can leave stuff behind
  3. Dynamics has

How to use them for animation.

  1. Something starts emitting particles at time t0
  2. At each subsequent time step
    1. Existing particles are updated
    2. Dead particles are removed
    3. New particles are created
    4. All particles are rendered.
  3. Until it stops emitting particles at t1.
    1. Updates continue until they are all dead

How to use them for visualization.

  1. Example. For visualizing motion in a fluid
    1. Add particles upstream
    2. Let them be carried by the fluid
    3. Until the fluid flows out of the scene.

It's obvious how they are used for animation. They are also useful for still images. How?

Two ways

  1. Let the particle system get into a steady state, then freeze and put into the scene.
  2. Accumulate the path of each particle, then use it as the shape of a linear primitive

Requires either garbage collection or good memory management.

Fractal Terrain Generation

What is it?

How is it done?

  1. Start with a polygon covering the terrain
  2. Divide each edge in two by positioning a new vertex in its middle.
  3. Add new edges.
  4. Iterate to 2 until it's good enough.

Tricks.

  1. Gets expensive fast. Do as few iterations as possible.
  2. Don't look directly down on it. Why?
  3. h(n) will need extensive tweaking. Don't get discouraged if you don't get the results you want right away.
  4. You could do the first few iterations by hand to control the large-scale result.

What is it good for?

  1. Mountains
  2. Rolling hills
  3. Sand dunes. You will want h(n) to depend on the direction of the edge.
  4. etc.

Compound Modelling

Use several techniques together. For example,

  1. Model a terrain.
  2. Cover it with grass using a particle system.
  3. Render it.
  4. Use the rendering as a texture for a distant landscape.

Polyhedra and Meshes

What is a polyhedron?

  1. A set of vertices
  2. Connected by edges
  3. Which define faces

Ray Tracer format

  1. Array of edges (3 floats)
  2. Array of faces (pointers to vertices, needs to know number of vertices)
  3. Build the arrays as you read the input.

Disadvantages

  1. Finding the faces that surround a vertex, or the edges that emanate from a vertex
  2. Modifying the mesh.
    1. Add a vertex and a face, easy.
    2. Add a vertex, split a face, need to find the face.
    3. What's hard is finding the face to delete. ( O(nFaces) )

An improved solution

  1. Build a list of faces for each vertex when reading the input
  2. Can now find faces from vertices. To split a vertex

General deletion is still hard, unless you are willing to tolerate holes in the array.

Winged Edge Data Structure

When we talk about polyhedra & meshes it seems most natural to talk about vertices

And we have been most interested in vertices and faces. Meshes are, of course, graphs

Every time we see a graph we should think,

In the dual edges are primary:

Winged edge data structure

Each edge has

  1. pointers to the faces it separates
  2. pointers to the vertices at its ends
  3. participates in a doubly linked list of edges at each of its ends

Each vertx has

  1. one pointer to an edge
  2. Exercise. Why do you only need one?

Each face has

  1. one pointer to an edge
  2. Exercise. Why do you only need one?

Issues to consider

  1. Traversal. Can you find all neighbours quickly?
  2. Vertex/edge addition. Can you do it in constant time?
  3. Vertex/edge deletion. Can you do it in constant time?

Return to: