See what's going on with flipcode!




 


Submitted by , posted on 25 March 2003



Image Description, by


The terrain renderer was written as part of a project thats being worked on by some students of the university of Ulm ( http://www.neverending-odc.de/ ). After not caring about terrain at all I was surprised how well it went and worked on it just for fun every now and then (the total time invested might be about 2 months full of afternoons).

I wanted to write something that wouldnt immediately look like someones first terrain and also something that would avoid the things i hate in games. Sharp edges from low poly landscapes and reloading all the time and having me wait to play on. Also LOD popping is still kind of annoying, though its visible rather on the texture than the geometry. Most problems are probably well known to everybody who wrote a terrain engine: memory is never enough to support to view distance you would want, there's always too few texture units and the result will never look good enough, especially not from far away and close up the same time. And of course, not knowing how much CPU power the rest of the game would need, I wanted to use only the absolute minimum and let the graphics card do the work. Which of course ended with GeoMipMapping and looking for Occlusion Culling that wont require much CPU time or memory (and im still searching).

The result is GeoMipMapping with 5 LODs, a potentially endless world with always 9 heightfields (513x513) in memory and a view distance of about 2km (though after placing the terribly redundant texture coordinates somewhere else i might double this and use 1025x1025 heightmaps). A Quadtree will speed up culling later on (not making much difference with the time for about 600000 squareroots to spare each frame right now). It features a slightly buggy but extremely cheap Occlusion Culling thats using its own low res zBuffer and likes to cull visible parts when the camera gets close to steep walls.

Though the viewing distance is not as far as i want right now it keeps you from seeing the new parts of the terrain being loaded and created (you can though, if you turn off fog and enable far view). It might look like its just moving parts around, because every heightmap is the same but its reading the heightmap and the textures from hard disk and creates the geometry on the fly by only creating a few chunks each frame. There arent many tools yet, just a simple one to create lightmaps and normalmaps from a heightmap and a quick hack to make sure there wont be seams along the edges of the heightmap.

Textures and heightmaps were taken from other terrain engines so i could compare them a little better. The sourcecode is free though as its neither special nor commented, but of course if anybody is interested i wouldnt mind to clean it up and add some comments. Current version and source can be found here: http://festini.device-zero.de/downloads/index.shtml



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.