See what's going on with flipcode!


Submitted by , posted on 27 October 2000

Image Description, by

This image is of an idea I had for terrain rendering using heightmaps. I'm not sure if this is used already. I would hope it is because it is so simple and works so fast. There is also limited overdraw (anything that is overdrawn wouldn't be worth culling out) and it lends itself VERY well to seamless, non popping LOD (I'll post separetly on this if anyone is interested). The image on the left shows a view of the heightmap (512x512). You start with a point (your current location #1) and then calculate points #2 and #3 based on HFOV and viewing distance. These three points form a triangle of heights on the heightmap to be rendered. Now for the easy part. Going through old programming books I came across triangle scan conversion. I thought this would apply very well to this situation. For you old school programmers, this is how you drew polygons to the screen before OpenGL and hardware rasterizers. Divide the triangle into a top and bottom triangle (green and blue - each has a perfectly horizontal side) and scan convert each triangle. Thats it, you can adjust (I use sliders) your viewing distance, HFOV, all kinds of stuff and watch it in action. It's kinda neat.

I'm positive this is commonplace as it seems so natural and easy so this likely won't impress anyone. The only downside is if you are high above the landscape and look down you can see missing polygons. I've fixed this with using a compensate factor which moves your location back and that reduces this problem.

If anyone is interested I can post another solution to this which shows off the very fast and accurate LOD, as well as a permanent solution to the above problem but it should be obvious extending what I've done here. The pics on the right are images of the rendered landscape. The polygon count is pretty high and it runs pretty well. I have a Celeron 300 and Geforce256. I can send a demo and put up a page if anyone wants to try their fps on a faster and better machine.

Again, I appologize if this idea is old and lame and no one is impressed, I've just never seen it done before. Seems to me a great way to speed up an engine and a lot quicker and more accurate than quadtrees (and the such).

You can't read it in the pictures but its about 10 fps for 181,216 triangles. I have also done zero optimizations so take that into consideration. I am wanting to increase the map size, but just scaling everything up doesn't seem to work as it looks the exact same. Any suggestions (the polygons are very small)?


Image of the Day Gallery



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