Papervision 3D Programming Tutorial - Terrain

Posted Feb 18, 2009 by mcasperson / comments 0 comments / Print / Font Size Decrease font size Increase font size

Learn how to create a realistic looking terrain mesh and texture that can be imported into Papervision. Demo and source code included.

VIEW THE DEMO
DOWNLOAD THE SOURCE

There are dozens of ways to create 3D terrain, and there are many examples of this being already being done in Flash. There aren't many examples in Papervision though, nor does Papervision support a standard terrain mesh.

My first instinct when looking to create a terrain mesh was to use a heightmap: a black and white image that defined the height of the terrain, which would then be mapped onto a plane. I then started to look around at optimisation techniques, and came up with a number of impressive sounding acronyms like CLOD and ROAM. A deeper look at the math and coding involved made me change my mind though.

So how do you create a good looking 3D terrain that runs reasonably well in Papervision?

Eventually I settled on simply doing all the processing an optimisation outside of Papervision, and import the whole thing as a simple mesh. You'll need two tools to do this for yourself.

The first is the T2 terrain generator, which you can download here. T2 allows you to create good looking terrain textures, complete with lighting and shadows, using a heightmap to define the topography of the terrain itself. You can then export this terrain to a mesh.

The second tool is Milkshape. Milkshape is a low polygon 3D editor, but I use it a lot for converting mesh formats, and for the plugins. One such plugin is called DirectX Mesh Tools. What it has to do with DirectX I don't know, but it can be used to reduce the number of polygons in a mesh without significantly reducing the quality of the model.

So you create a terrain mesh and texture in T2 and import it into Milkshape where you can reduce the number of polygons and then export it as a COLLADA file for Papervision. The end result is a 3D terrain that looks good and runs well.

In the demo use the WSAD keys to move around, and the R and F keys to raise or lower your height.

Check out more web development tutorials and articles here.

Go back to Papervision Tutorials

Rate this Article:

Be the first to rate me.


* You must be logged in order to leave comments, please login or join us.

Comments

No comments yet.



Bookmark and Share
Sign up for our email newsletter
Name:
Email: