Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


Here are a few zoomed-out shots of some procedurally generated roads through heightmapped terrain, as part of my ongoing farting around. The roads are randomized as a set of 16 points distributed across the map, equally spaced in the X direction and randomly spaced in the Y direction. Finer-grained starting points result in better contour following. These points are tessellated even further using cubic interpolation to construct a polyline curve across the map.

Once the polyline is built, I construct 2 quadstrips from it. The roadbed quadstrip is constructed to be 15 units wide, and is rasterized into a heightmap buffer using interpolated elevation values. (Hence the causeways and canyons; heightmap values are only sampled from the original 16 points, and generated via interpolation from that set, so large extremes of terrain can be cut off.) The second polyline is generated 5 units wide and is rasterized into a terrain blending buffer to draw the road terrain. (Which, in these shots, is actually my old cliff terrain and not very good road material at all.)

After the elevation quadstrip is rasterized into the heightmap buffer, I apply just a tiny bit of Gaussian blur (1 pass, 5x5 kenel) to soften the sharp edges of the roadbed's shoulders. For as rapidly as I prototyped the system, it works fairly well.

I would like to construct another curve tessellation routine that parameterizes on segment length, so that I can tesselate to fixed-length segments then re-sample the heightmap at these fixed lengths and interpolate road elevations from there. This should eliminate some of the widely varying roadbed elevation cutoffs, and result in fewer deep canyons or tall causeways. Of course, parameterizing on segment length is a little trickier; I'll need to hit Eberly's 3D book again to refresh my memory on how it is done. [grin]

Anyway, the images--

This first one shows an extreme example of causeway building in action. The engineer that designed this stretch of road needs his ass kicked.

This stretch of road worked out pretty nicely, only carving a single shallow canyon. The ascending piece to the left follows the flank of a ridge rather nicely.

This final one shows a little bit of a causeway. Further on, it rises to the top of a tall peak, and loops around the top. This stretch of road actually didn't turn out too badly.

Need to do a lot more work before I'm completely satisfied with it. But I still think it's pretty cool. Roads through randomized terrain are actually a little harder than they seem. [grin]
Sign in to follow this  


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!