Terrain, Part 3

By Shamus Posted Friday Feb 3, 2006

Filed under: Programming 2 comments

Distance-based polygon reduction

Work continues on the Terrain Engine.

As I mentioned in previous updates, the terrain uses fewer polygons in flat areas and more in uneven areas. This is nice, but we can still do more. For example, Polygon density is the same all over the terrain. A better idea is to have it be more agressive in removing polygons in the distance. Stuff that is far away could be much simpler. Let’s see:

This time, the lower-left shows the normal optimization, and on the upper-right is the one where it removes more polygons in the distance. As you can see, close up they work the same, but in the distance I’m now using a lot less polygons. I’m all the way down to 65,195 polygons! That is a reduction of about 88% from our first terrain. We can see the difference at this point, but the differences are subtle and easily worth the massive savings.

Terrain coloring

I’ve added some code to look at the shape of the land and color it accordingly. The high grass is pale, the lowland grass is deep, lush green. Steep banks are dirt-colored. High banks are grey (rock) colored.

Note that all of this is simple vertex coloring, just to give an idea of how the terrain might look if used in a game of some sort. This is cheap and simple, and will be replaced later in the project by something more robust.

Now it’s starting to look like something. However, the surface is so smooth and the color changes are so gradual that the whole thing looks like dull plastic. That’s not what I want. Let’s give it a texture.

That makes a big difference! The texture I’m using is very simple: it’s just random greyscale noise, like a low-contrast version of television snow. Still, the small variations of brightness really brings the surface to life. All these screenshots so far have been from the same position for comparison, but there is a lot more to the terrain. Let’s look at it from another angle:

I want to point out that I am avoiding adding lots of fancy effects to the scene. I could make this look much more striking by using dramatic lighting (sunrise or sunset shading), adding a proper horizon (so this isn’t a square island floating in space), adding clouds, sun, lens flares or any number of other scene-enhancing effects. Without these, things may look bland, but it also means I won’t be propping up a lame system with a lot of makeup. The time to add that stuff is later.


From The Archives:

2 thoughts on “Terrain, Part 3

  1. Zagzag says:

    This is really good! And really readable! You have a real gift for explaining complicated things without sounding patronising.

  2. Agreed with Zagzag. I have absolutely no understanding of programming, but I’m still fascinated by this entire project.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published.