Jonathan Konieczny

Cs5610 – Final Project

"Terrain Mapping and Particle Effects"

 

For my final project, I implemented two different terrain mapping techniques, particles systems (a particle fountain), and some wave effects. This document describes what my original objectives were, what I actually did, and what I would have done with more time. To see about my data structures I used, see finalstructs.doc.

Original Project Objectives: Here’s what I originally planned in a nutshell

  1. Terrain: Implement Bezier Curves for terrain mapping (Not Completed)
  2. Terrain: Add satellite photos to Terrain as texture maps (Not Completed)
  3. Terrain: Create 3 or 4 different Fixed terrains in some way (Completed)
  4. Terrain: Explore other methods of terrain mapping other than Bezier Patches (Completed)
  5. Terrain: Collision Detection (Not Completed)
  6. Terrain: Interactive terrain (Not Completed)
  7. Water effect: waves (Completed)
  8. Water effect: reflection (Not Completed)
  9. Water effect: Blending (Completed)
  10. Water effect: Fountain (Completed)

Items that were finished/new items I created/finished: Here’s the stuff I actually did

  1. Catmull-Rom Spline Terrain: Instead of implementing terrain using Bezier Patches, I instead did it using Catmull-Rom Splines. A Catmull-Rom Spline is a mathematical way of interpolating along a curved line. For a full description of them, go to http://www.lighthouse3d.com/opengl/maths/index.php3?catmullrom (its where I found out about them, and they have a pretty good description of them).
    1. I implemented them using multiple for – loops that interpolated along the spline, drawing triangle strips. It can only be used with a random terrain generator (I don’t have any fixed terrain for this, writing down all the points for it would just have been a pain). The functions I used also calculates the normals for lighting, and allows the terrain size and interpolation level to be changed for more/less accuracy. At high accuracies the terrain generated looks very good.
    2. All terrain I created during this project is texture mapped with a simple "grass" texture (I had a hard time finding any suitably satellite photos, so I canned that idea).
    3. Please see pictures 1a and 1b for photos of the implemented Catmull Terrain (At the end of this document)

  2. Height mapping: The second most major thing I did was Height Mapping. By loading in greyscale images, my program can take the values from that image and convert it into a three-dimensional terrain. I did this by taking each pixels value and translating that value into a y-value. This creates a series of polygons of varying height, which I simply connect together and add normals to.
    1. I allow the user to change the "step size" – how many pixels it passes before getting a new height (this can drastically improve speed, and has only minor image degradation for the most part – see images 2a, 2b, 2c, and 2d)
    2. I also allow the user to alter the change the height of the map – so changes in pixel color amount to more/less of a height change.
    3. I allow for multiple height maps at the same time, so it is possible to create multiple maps, then "paste" them together into a single larger landscape (in fact all 4 terrain height maps are drawn at once in my program)
    4. If you want to get new maps, just create (or find) a .raw image and name it Terrain1, 2, 3, or 4.raw (The program sometimes also works with .pgm files, but it’s a bit finicky, I recommend .raw files).
    5. Pictures 2.* are all examples of the height mapped terrain
  3. Particle Fountain: I created a particle fountain with several extra features.
    1. This is a basic particle engine: I create a series of particles with different, slightly randomized start velocities, and the apply a change function on them over time, until their time expires.
    2. I allow you to see it as either simple colored points or as billboarded quads (the quads really do look a lot better).
    3. I allow you to change several functions of the system, including how many streams of water comes out of the fountain, how many levels the fountain has, the start angle of the particles, and how many particles are drawn (At high levels of all of these, the fountain can really become impressive – see pictures 3.* for examples of the fountain)
  4. Water effects: I added some simple wave and blending effects for water into some of the terrain. I created these by creating a 3-D moving sine wave, and then adding texture coordinates to it, then changing the "disturbance point" of the texture to a place on that texture. The sine wave then moves out from that point.
    1. I allow the user to change both the amplitude and frequency of the sine waves.
    2. I also blend the waves into the surrounding terrain (both the waves and fountain are placed into the initialized terrain map).

-That’s It!

Items I didn’t accomplish/problems I had:

Bezier Curves: I never implemented my original project goal (I asked Aaron, he said it was ok, as long I implemented other stuff instead – so I did catmull-rom curves). This wasn’t really because I had problems with it, it’s because I wanted to implement other things such as the particle fountain, catmull-rom curves, etc. By the time I was finished with the other things, I didn’t have enough time to do a great job on the bezier curves (I could have done a simple version like in the book, but that’s not really of any use). I did, however, study up on them for future reference - http://astronomy.swin.edu.au/pbourke/curves/bezier/beziersurf.html has a good description, and the book was a reasonable source of info on them, too.

Terrain Collision Detection: I really wanted to implement this, but last minute problems in the particle engine made me run out of time.

Water: Reflections – I didn’t implement this because for unmoving water it would have been exactly like mirrors from the last project, and I wouldn’t have learned anything. For moving water it would have required environment mapping, which I had no chance of completing in time (and honestly have no inclination to attempt at all).

Satellite photos: I originally wanted to use actual pictures as the texture, and map the terrain to match (which would have been relatively easy with height mapping). Unfortunately, finding suitable photos proved difficult, so I decided not to waste time on it.

Interactive Terrain: Another thing I ran out of time on (it was low priority and would have been after collision detection, so I barely even thought about it).

What I learned: I learned a ton of stuff doing this project:

How to create particle engines

About Bezier and Catmull-rom curves (and a lot of associated math)

Billboarding

Waves effects (and associated math)

A lot about file types (which is what really killed me time-wise…it took me a long time to sort out how to load and manipulate all the file types I use for this project (rgb, ppm, raw, bmp).

Extensions I would have done with more time:

There is a lot of stuff I would have liked to do with this project (I think I could work for several more months before getting everything done I wanted to).

-That’s It! – see next pages for photos – Have a nice day J

1a (left image)) A low – interpolation catmull-rom terrain. Note how the lighting makes the individual polygons stand out

1b (right image) A high-interpolation catmull-rom terrain. Note how the shading is much nicer.

 

2a (left) A low – precision height map

2b (right) A high – precision height map – Note how the higher precision actually makes errors stand out more in some cases with height mapping

 

 

 

 

 

 

 

 

 

 

2c (left) – A low precision height map w/directional lighting

2d (right) – A high precision height map w/directions lighting

 

2e (left) – A low precision height map of written text

2f (right) – A high precision height map of written text – Note how the higher precision has a clear advantage over the low precision in this case

 

 

 

 

 

 

 

 

 

3a (left) Particle fountain with low mostly low drop frequency and stream number values

3d (right) Particle fountain with high values and from a different angle (note the billboarding effect)

 

4a) wave effect

4b) wave effect with a higher amplitude and frequency

 

Final references: Nehe Productions: http://nehe.gamedev.net http://www.lighthouse3d.com/opengl/maths/index.php3?catmullrom

http://astronomy.swin.edu.au/pbourke/curves/bezier/beziersurf.html

The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.