Mon 04 Jun 2007
5:00PM
compton
A Simple 2D Terrain Model
I now want to look into how terrain can be modelled in a 3D game. My feeling is that the terrain model must support a couple of functions, as a minimum. These are elevation(x,y,z), which returns the height of terrain below the co-ordinates passed in, and slope(x,y,z), which returns the slope of the terrain at the specified point.
If we consider a simple single-level terrain, then we can say y = elevation(x,z). In other words the elevation function returns the height (y) for a point at (x, z).
The slope at a given point can be thought of as the rate of change of y with respect to x and z, ie the differential of y = elevation(x,z). 2D differentials are fairly straightforward to calculate using Newtonian calculus. I'm not so sure about 3D ones however.
There are other ways to get the slope though. If the terrain is represented as a triangular mesh, which is pretty much the only way to do it, the slope is the slope of the triangle at a given point. The elevation can be found from the mesh also: first determine which triangle is below the specified point, and then determine the height at the point using simple linear algebra.
My plan now is to read up about terrain modelling on the web.
compton
1:54 pm, Tuesday, 5 June 07
|
compton
10:53 am, Wednesday, 6 June 07
|
compton
7:26 pm, Wednesday, 6 June 07
|
|
Related Articles
Tank Wars in G3D
/xkcd/ Geometriphylogenetics