PDA

View Full Version : What is a good way to make a long road way (for a game)



blinblue
06-07-2003, 01:23 PM
I am testing out some different ways to make a road and the terrain around it. But all the ways I have tried would take too long. I need to make lots of country roads with connected landscape so you can go anywhere. So my questions are...
Is there any easy way to make the roads (aka just drawing a 2d line with you mouse (kinda like using the right-mouse-button to do the drag select)?
I want a nice neat terrain (something like a grid) and easy to change around, so what is the best way to have a road+the terrain (I have tried the Drill but it makes the road one big polygon, and not each segment its own poly)?
Does anyone have some tips on large outdoor terrain making?
Thanks in advance (and I hope all I said makes sense)

Mattoo
06-07-2003, 03:02 PM
Currently the game I am working on is using a tile system for the landscape. Squares are built, such as "Road_straight" "Road_corner"..... etc
Using those pieces the level designers build their maps and place buildings.
It sounds like it'll create some very dull and "tiley" fake looking terrain but if the camera never gets more than 10 meters above the ground then it's actually very hard to tell it's tiled.

If that is the case however (such as a flight sim) then a height field generated by a grey scale image is often used (I think there's a tut on the Newtek site for this). However, creating roads to fit on an organic looking height field is a little tricky and all depends on what's available in your game engine.

Elmar Moelzer
06-07-2003, 06:28 PM
Ok, here is what I did for this gamehere:
http://www.mediastudio-graz.com/html/msg_avl_eng.htm

This is not the entire road and some handmade path (because the engine was not able to render out frames during the actual game) which in fact was 8 km long and it took quite some time if one wanted to drive the entire road.

This scene was done it LW5.6 in 2000 and worked on our proprietary 3d- engine.
You might remember that there were no UV- maps at that time in LW. So to get the road textured I had to use a few tricks...

1. the modeling:
Roads will rarely lean to the side, so watch out for that.
To get a curvy road that would also go up and down and that would never lean to the side, while perfectly blending with the landscape I decided to start with the road, and match the landscape to the road, not the other way round.
I started by laying out the road as a splinecurve, then I extruded it downward. The resulting polygons that were going downward were then smoothshifted a few times to get one half of the road and the landscape on one side of it. To save polygons, I smothshifted more the further away from the road I got, knowing that noone would ever be able to leave the road in the final game and therefore noone would ever come close enough to the parts further away from the road to see the missing detail.
After that you will get something that loks like half of your road but only much wider.
I then used magnet and jitter etc to shape the landscape that surrounds the road. Then I did the same for the other half of the road and the other side of the landscape (starting from the very same splinecurve as before. I then merged both halves and started optimizing a bit more wherever possible by welding points (a lot of points).
2. To texture the road:
I separated the road from the landscape again.
Then I straightened it out rotating ever single turn back so it would be perfectly aligned with the z- axis. Then I textured it with a tiling road and road- side texture (just planar from above). Then I morphed it back to the curvy version of it in Layout. Our game- engine would automatically merge all points that shared the same space to avoid breaches in the shading where the road and the landscape met.
That was in the year of 2000 and it was the hard way.
It took me 1 month to do the 8 km long road and all the other objects in that scene (houses trees etc, I also had to watch out for errors with semi- transparent objects).

Today, I would do that a bit differently:
1. Modeling. I think this could be done the same way I did it in 5.6.
with only a few small differences:
1. I would rail- extrude a long and very slim plane along my spline- curve in the beginning, using uniform lengths (instead of extruding the splinecurve downwards. The uniform length will become important a bit later on, so make sure it is checked.
Merge the points of the rail- extruded small plane (so you get a line of 2- point- polygons).
Then proceed as I explained before (extrude down, smoothshift etc).
2. For texturing I would use UV- maps this time (no need for the morph- trick with the straight road anymore).
Use UV- spider to create the UV- map for the road (make sure you do this as long as your road is still made of quads, which would be before you reduce the polycount).
Now you might see why the lengths needed to be equally spaced, as UV_ spider will automatically space your polygons equally over the resulting map. If the polygons of the road did not have all the same length before creating the UV- map, the roadtexture and therefore the middle- stripes would differ in there length later on.
Then in the UV- view stretch the map so that the texture will tile often enough later on.
I know this is all a bit complicated and I have a hard time explaining this here.
I still hope it was somehow understandable.
If not, let me know and I will do a tutorial with pictures (but this will take me some time to do, as I am quite busy lately)
CU
Elmar

Danner
06-08-2003, 05:56 AM
The last time I had to do a mountain road I used a displacement map, I had the geographic data of the mountain in an nice grey scale image. the hard part was correctly painting the road on the displacement map. I painted it, cut the section out, blured, smeared and all that fun stuff to get the road area to be an average height of the surounding area, and flat too.. then I used a traced version of the road layer to slice a subdivided plane so the edges would deform better and to give it another color texture, and finally, displace-mapped the greyscale image to it. It was like 4 months ago and I have the distinct notion that I figured out a better way of doing it after I was done but I can't rememer now =)
The nice part about doing it this way was using subdivision surfaces, wich made the object relatively small and flexible in the level of detail. In the final render I used bump displacement on the non road part of the object. Of course for most game engines you would have to freeze it at some point.. and maybe do a queemloss on it, but you could do a high detail render and bake the texture to use it on the low-res version of that road segment.

MentalFish
06-08-2003, 07:40 PM
I used Terragen to genreate a naturally shaped mountain, found a section of the terrain i liked, and cut away the surrounding areas (polys). I then selected a band of polygons that was going to make up the road and made sure they were all quads (4 point polygons), and aligned the points vertically so the road became flat (not sloping down the side of the mountain). Then there is time for some UV Band Mappin magic :)

http://downloads.laffeycomputer.com/bandmapper/

This plugin enables you to genrate a UV Map for the roadtexture (You can use the UV Spider too, but i just like this plugin quite alot)

I would love to see a LScript that takes a banked road (selection of polygons along the mountain side), and "flattens" it, in such a way that all the banking disappears, but the ups-and-downs of the road remains...

A Shockwave demo of my terrain can be found here:

http://petter.ms/cardemo/

Use arrows to steer (you might have to click the 3D view to make it react)

Elmar Moelzer
06-09-2003, 08:49 AM
Hey Petterms, what si the difference between the UV_ bandmapper and UV_ spider?
Does the bandmapper take the length os the polys in account?
CU
Elmar

blinblue
06-09-2003, 02:35 PM
Thanks a lot, really helpful

MentalFish
06-11-2003, 03:14 AM
>Elmar Moelzer

As far as I can remember, the Spider ended up making a UV map with all polygons squashed inside the UV texture square, (but I guess that could have been a wrong setting). I then had to scale the UV map vertically, so that the length became right.

The bandmapper gave me what I wanted, a good representation of the actual polygon length inside the UV map: See Pic (http://downloads.laffeycomputer.com/bandmapper/Image7.jpg)

So if a polygon in the terrain was long, so would it be inside the UV Map be. Result: very nice road texture :)

P