Roads

Published June 13, 2005
Advertisement
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]
Previous Entry Stuff
Next Entry And more roads...
0 likes 7 comments

Comments

Washu
Any chance of a demo that we can play with?
June 13, 2005 11:48 PM
noaktree
Quote: But I still think it's pretty cool.
I concur.
June 14, 2005 12:11 AM
Mushu
Umm... drools ?
June 14, 2005 12:25 AM
choffstein
Sexyyyyy...
June 14, 2005 12:30 AM
evolutional
Damn, that looks good.
June 14, 2005 02:57 AM
Rob Loach
That is fucking awesome!
June 14, 2005 06:55 AM
poss74
wow!
June 14, 2005 09:55 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement