Landscape to fly over
Members - Reputation: 125
Posted 01 September 2012 - 05:14 AM
I am an absolute noob when it comes to graphics programming, but to get started all I want to do is to create a 3D landscape that I can "fly" over.
What are the steps involved in accomplishing something like that?
Members - Reputation: 255
Posted 01 September 2012 - 05:24 AM
i don't know how specific you need your bullet points, but steps involved would be something like this:
- initialise your graphics API of choice
- create a landscape (procedurally or from a source like a height map)
- implement navigation
Members - Reputation: 125
Posted 01 September 2012 - 05:30 AM
The first one I have covered.
My noobness lies with the 2nd one. Since I have no idea how to create one, or even know what an vertex shader is, I guess I need to do some reading first. Any sources/tutorial that can help me with creating landscapes specifically?
Moderators - Reputation: 8342
Posted 01 September 2012 - 10:07 AM
Or you can use procedural methods, such as Perlin noise or diamond squares.
There are a couple of main ways you can implement a terrain.
A heightmap terrain is based upon an evenly spaced grid of squares (think of it like a piece of graph paper). Each vertex of the grid is displaced up or down by some value, depending on the value for that location in the heightmap. A heightmap is basically a black and white image, where fully black pixels represent 0 displacement, and fully white pixels represent maximum elevation displacement. Heightmaps can be constructed procedurally, using a dedicated heightmap editor like HME above, or even edited using an image editor like Photoshop or the Gimp, by drawing black and white areas and saving the image. Doing it in an image editor is somewhat tricky, though, since it is difficult to visualize the final result.
A heightmap terrain can easily be texture mapped by treating the terrain as if it were a flat plane, and stretching/tiling the terrain texture(s) across it. However, this method may render poor quality on terrains that have extreme height differences and steep areas, resulting in a lot of texture stretching.
Heightmap terrain has the advantage of being very easy to implement. There are plenty of algorithms that operate on heightmap grids for the purpose of Level of Detail (LOD) in order to boost the rendering performance of large landscape grids viewed at a great distance. However, heightmap terrain has the disadvantage of being unable to implement perfectly steep terrain, overhangs, or anything like that. There are hacks you can perform, though, that displace the grid in X and Y after the vertical displacement is done, but they might possibly break other things.
2) Triangle soup
Voxel terrains and other free-form terrains are commonly implemented as a triangle soup, rather than a regular grid of squares. The term triangle soup isn't official or anything, but it is an apt description. The terrain is just a collection of triangles, not particularly tied to any kind of grid. Or they might be grid-based (as in a terrain surface constructed via an algorithm such as marching cubes) but "messy". They lack the neatness of a grid of faces, and thus can tend to complicate things such as LOD determination.
Texturing a triangle soup type of mesh is less flexible and more complicated than a simple heightmap. A common technique to use is tri-planar texturing.
Triangle soups have the advantage that any terrain shape can be represented, including overhangs, cliffs, caves, etc... The disadvantage is the vastly increased difficulty in managing the data, implementing LOD as needed, and texturing. Constructing the terrain can also be problematic, unless procedural methods alone are used. Dealing with these sorts of terrains usually amount to exercises in creative data management. The solutions for heightmap terrain are very well known and well documented, but voxel terrains and other volumetric terrains are less exhaustively documented and implemented.
I recommend, if you're just starting out and learning, to go with a heightmap. After you gain some experience, then you can try to tackle terrains of greater complexity.