CS488 - Introduction to Computer Graphics - Lecture 29
Modelling
Particle Systems
How to use them for visualization.
- Example. For visualizing motion in a fluid
- Add particles upstream
- Let them be carried by the fluid
- Until the fluid flows out of the scene.
Fractal Terrain Generation
What is it?
- A way of getting not-too-regular, not-too-random terrain,
- without positioning every vertex yourself.
How is it done?
- Start with a polygon covering the terrain
- height at each vertex is average height + h(n) with n = 1
- h(n) is a random function with expectation zero
- Divide each edge in two by positioning a new vertex in its middle.
- new vertex height is average edge height + h(n = n+1)
- magnitude of h(n) probably decreases with n
- Add new edges.
- Iterate to 2 until it's good enough.
Tricks.
- Gets expensive fast. Do as few iterations as possible.
- Don't look directly down on it. Why?
- h(n) will need extensive tweaking. Don't get discouraged if you don't
get the results you want right away.
- You could do the first few iterations by hand to control the
large-scale result.
What is it good for?
- Mountains
- Rolling hills
- Sand dunes. You will want h(n) to depend on the direction of the
edge.
- etc.
Polyhedra and Meshes
What is a polyhedron?
- A set of vertices
- Connected by edges
- Which define faces
Ray Tracer format
- Array of edges (3 floats)
- Array of faces (pointers to vertices, needs to know number of
vertices)
- Build the arrays as you read the input.
Disadvantages
- Finding the faces that surround a vertex, or the edges that emanate
from a vertex
- Modifying the mesh.
- Add a vertex and a face, easy.
- Add a vertex, split a face, need to find the face.
- What's hard is finding the face to delete. ( O(nFaces) )
An improved solution
- Build a list of faces for each vertex when reading the input
- Can now find faces from vertices. To split a vertex
- Overwrite the deleted face with one of the new faces
- Add the other new faces to the end of the face array.
- 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
- edges are vertex pairs,
- faces are vertex n-tuples n>2.
And we have been most interested in vertices and faces. Meshes are, of
course, graphs
- not just any graphs but ones that obey constraints
- for every constraint there is
- a conserved quantity, or invariant
- a symmetry
- complete sets of invariants are not known
- but not for lack of trying to find them
Every time we see a graph we should think,
In the dual edges are primary:
- vertices are where edges meet,
- faces are minimal closed paths
Winged edge data structure
- Where does the name come from?
Each edge has
- pointers to the faces it separates
- pointers to the vertices at its ends
- participates in a doubly linked list of edges at each of its ends
Each vertx has
- one pointer to an edge
- Exercise. Why do you only need one?
Each face has
- one pointer to an edge
- Exercise. Why do you only need one?
Issues to consider
- Traversal. Can you find all neighbours quickly?
- Vertex/edge addition. Can you do it in constant time?
- Vertex/edge deletion. Can you do it in constant time?
Splines without Tears
Why do splines exist at all?
- Sometimes we absolutely need curves
- Example: specifiying fonts for SVG
The French curve.
- What am I doing with it?
- Making piece-wise curves
General piece-wise curves
- One example is line segments: you have been making them all along.
When you put them in a mesh there is an extra requirement
Linear curves necessarily give derivative discontinuities (called C1
continuity)
- To get rid of them you need higher order curves.
- Actually third order ones.
- How does this do it?
Is it good enough to get me away from the French curve?
Now you have a way of making smooth-enough curves specified by a small
number of points.
Why is it important to have them available?
Return to: