PDA

View Full Version : Creating Terrain Model



eskimo
02-23-2004, 05:15 AM
I was wondering does anybody know how I would go about creating a 3d Terrain Model in OpenGL? I have the X, Y, Z data ready that has been extracted from a GIS map. What sort of format should I store the data in so it can be read into OpenGL code?

Any help would be greatly appreciated

Cheers

brcain
02-23-2004, 07:33 AM
The first thing you need to do with the GIS data is to reduce the data such that it can be rendered efficiently. One technique ... use the 8 surrounding points of each point to determine whether it should be included. If the average of the 8 points vary by a threshold more than the center point, then, keep the center point; otherwise reject it. Do this averaging/testing for the whole set of data. What you will end up with is a sparce matrix (good visual representation) of data that will need to be connected together using Delaunay triangulation.

You will find a really fast triangulator, Triangle, at http://www-2.cs.cmu.edu/~quake/triangle.html. It takes 2D points (your X/Y data) to determine how the points connect together. You then use this connection information to render using the Z data for the height of each point.

I've wrapped Triangle to be a little more user friendly. We've used if on a few projects ... been very pleased.

One last thing ... once you get the data to be "connected" you'll still need to do one more thing. You'll need to add hiearchical bounding regions to your database -- for culling.

You can also buy software that builds terrains for you using DTED or GIS data (e.g. MultiGen Creator).

eskimo
02-23-2004, 08:19 AM
The program that I've extracted my data from allows me to interpolate the points I have into Grid form. Is that what you mean by simplifying? The Link doesn't work for me I'm afraid. Thanks for your help, its much appreciated.

brcain
02-23-2004, 12:44 PM
Try the link (without the dot)
http://www-2.cs.cmu.edu/~quake/triangle.html

By simplifying I mean data reduction. Typicaly grided data contains more data than necessary. For example, a relatively flat area in a terrain can be represented with a few polygons. On the other hand, a very dynamic, mountainous, terrain must be represented with many more polygons.

A typical terrain will contain both flat areas and mountainous areas. So, the goal is to reduce points where it's flat so that you don't spend extra processing time and memory -- with no benefit.

brcain
02-23-2004, 12:47 PM
Originally posted by eskimo:
The program that I've extracted my data from allows me to interpolate the points I have into Grid form.

If you don't have access to the code. You may need to write another program that converts the data to a more optimized format.