Curved Roads

1
category
General Half-Life 2/Architecture

description
Using displacements to create curved road effects.

keywords
roads, terrain, curved roads, displacements, ramps, ground, curves, advanced, arch, ramp, vertex.

First, I'll clarify on what this tutorial is to be used for. Curved roads, in most cases, should be made of displacements. But when the curve must move up or down vertically while curving, this is the best way to do it.
Image
Ok, I made a tutorial to show the right way to do roads like the ones in the above picture. The problem with using displacements for this is that the two end points can't lie on the same plane as the roads attached to the ramp, meaning no sewing. It is possible to do this with displacements, but you'll end up with cracks and seams and messiness somewhere along the line. So here is how to do it cleanly with brushes:
Image
Make an arch, roads are 512 units wide usually but I made this road 256. I used 1024x1024, any power of 2 will be ok. My arch is made up of 32 brushes.
Image
Clip the arch in half.
Image
Clip every rectangular brush into triangles like so.
Image
Get out the vertex tool and select the first 2 points of the arch using the TOP view. You HAVE to drag and drop to make a box around each square, then hit enter to select it. Hold control to do this multiple times. If you don't do this, you will miss some points because more than 1 brush will have a corner lying on that point.
Image
Move the TOP 2 selected vertices down to where you want the ramp to start.
Image
Now find out how long the distance is between the top of the ramp and the bottom of the ramp is. Mine is 512. Divide that number by the the number of brushes your arch was made up of, in my case 32. 512/32=8. The number you get, in my case 8, is the distance between each level of brushes. Select the next 2 points and move them so they are 8 units above the first set (in my case, of course). The next pair of points will be 8 units above the previous as well, so they'll be 16 units above the start of the ramp. In the screen shot above, I've got 3 pairs of points done. Do all of them so you end up with this:
Image
Here's the finished ramp. You may want to clip the bottom off where the curve starts. To texture it, you'll have to do the rotations by hand for each face and then select them all and align them to the left. STOP CRYING AND POUNDING YOUR FISTS ON THE KEYBOARD, IT'S NOT THAT BAD. I textured and completed this little scene while I was uploading the pictures for the tutorial:
Image
Image
As you can see, lots o' potential for mountainous winding roads.Whatever you do, just MAKE SURE YOU TURN YOUR RAMPS INTO FUNC_DETAILS.

Now, as for adding the cliffs. In the screen shot above, they are brushes and they are ugly. For seamless displacement cliffs, you'll need to:
Image
Start with your ramp. Put a cylinder in the middle that meets all the inside sides of your ramp.
Image
Clip the cylinder in half, then clip from the center of the cylinder to every point on the outside of the cylinder. I also moved the cylinder up a bit.
Image
Using the vertex tool in the top view port, select the outside points of the cylinder one by one and drag them down to match the ramp. When you're done, move the point in the center of the cylinder to half way between the first and last point on the ramp.
Image
Finished! Now clip off the bottom of that mess and TURN IT INTO A FUNC_DETAIL. You now have ground by the road that will prevent seams from forming while you make displacements. Without them, you'd have to push all the displacements into the road to avoid seams. As an alternative, you could just use a displacement and fine tune it to about where the cylinder is now. You won't be able to sew it though, so this won't work in all situations.
Image
Block out your displacements. If you don't know how to do this, take a look at some displacement tutorials on the website. In particular:

http://www.interlopers.net/tutorials/30687
http://www.interlopers.net/tutorials/16891
Image
Subdivide.
Image
Shape your displacements until they look nice and swell.

NOW, this is all well and good for cliffs on the inside of the curve but what if we needed them on the other side of the road? Basically you would do the exact same thing, but instead of using a spiraling cone to cover the seams, you would use another ramp that fits around the outside of your road. Here's how that would look:
Image
Image
The alternative to using brushes, like I mentioned earlier, would be to use displacements under the road and aligning them by hand. Both methods will work in certain situations. Displacements are the better choice when you need to have terrain on the side of the road. Here's how to use displacements for ground under a curved ramp:
Image
Block out the displacements. The six faces on top are the only ones you need, I added the rest for cliffs.
Image
Subdivide. The ground won't be level with the road.
Image
Now the dirty work. Paint your geometry so the displacement sit a little below the road all the way up the ramp.
Image
By request, I'm adding this section on banking roads. It seems like something that would be fairly easy to do with the information above, but there are a few problems you'll come across unless you know what you're doing.

Start out with a triangulated arch, just like everything else we've looked at.
Image
Using ctrl + drag and drop select all the vertices around the outer edge of your road and raise them to make however steep of a bank you want (but PLEASE keep it on a power of 2 or things will get very messy later on)
Image
The banking road is done, but unless you're making a banking circle you will need to make a transition from a flat road to the banking road. This is where it gets tricky.
Make a UNIFORM 4x4 grid of brushes in the shape you want your transition piece to be. Using the vertex tool, move the outermost points into a slope like this going from the flat road to the top of the banking road:
Image
Now we have one column of the points finished, but we will now be working in rows. The first row that is touching the flat road will be flat. The second row from the flat road needs to be raised into a slope that goes from the first point (on the right in my screenshot) to the far left point which is already raised. To do this, you need to adjust your grid using the bracket keys so that each unit on the grid is one fourth of the height of the far right point on the row. This means if the far right point is raised 32 units up, you will work on a grid of 8. Select the point 2nd from the left and move it up 8 units (in this case) and then select the point 3rd from right and move it up 16 units and so on. You should now have a slope going up the far left column and another slope intersecting the first like this:
Image
On to the third row. This one is a bit trickier, because you need to move each point up an amount that is a multiple of three. All you need to do is adjust the grid so there are 12 grid units between the first and last point on the row's slope. Now you'll move the second point from the left up 3 grid units and the third from the left up 6 grid units, then move the fourth up 9 grid units.
Image
Finish off the fourth row and you are done.
Image
Image
-Corey Androski
- Don't send PM's to this user -

Re: Curved Roads

7
I'm sorry to point this out but it is in fact very possible to still have sewn displacements in 3-space. This tutorial is very handy for lots of architectural needs a mapper may need, but i still have to say, displacements are the way to go.
I can't go into to terribly much detail here, but using vertex manipulation to make the roadway placement then making it all displacement maps still works. If you care to look at the roadway in HL-ep2 that is taken to the launching silo you will see switch back displacement maps of roads almost (if not the entire) way there. Again, thanks for the insightful tutorial.

Re: Curved Roads

8
I never thought of such a thing. It's like you took a brush and manually made it in to a displacement by cutting it in to triangles, very smart idea!

Valve should add a feature where using vertex manipulation on a displacement lets us manipulate each point, rather than the corners of the original brush. That would allow us to save time from having to cut a brush up in to triangles.

There's a program called DispEd that lets you generate perfect corners with displacements, and the texture fits on it perfectly, but getting it to measure out correctly is a pain in the ass. Additionally, certain issues could arise and you might have to ditch the use of displacements to fix this, thus your tutorial is a great alternative.

A brilliant tutorial. Great work, and thanks for sharing.
Sound Cloud Profile

Re: Curved Roads

9
Nub, back in the olden days before displacement brushes in hammer we had to make displacements like this.

I made a map called cs_waterside and it was almost entirely made like this. a ton of triangles and arrows nudging the points. Anyone who mapped back then will agree displacements are a gift for the heavens...
Image

Re: Curved Roads

11
TorQueMoD wrote:No disrespect meant at all as this is a fantastic tutorial but you'd probably be better off making roads like this out of your own custom static meshes. Would likely be a lot faster to put together.
This tutorial is from 2009...

Re: Curved Roads

12
TorQueMoD wrote:No disrespect meant at all as this is a fantastic tutorial but you'd probably be better off making roads like this out of your own custom static meshes. Would likely be a lot faster to put together.

Maybe faster for a modeler. But you'd still run into issues with any Source game before CSGO. Even then it might not. I don't know CSGO too well. But I know that in any other Source game; that static mesh roads, or any large structure the player is close to. Will be poorly lit. The best you can get with static meshes is per-vertex lighting. Only light source that would be usable with it is the flashlight/ env_projectedtexture entity since it can light per pixel.

I do wonder if you subdivided a road mesh enough though. If it would look decent.

Someone want to make me a compiled and textured model of a short road ( maybe like the one in the tutorial?). One subdivided(not more than 75k polygons)
Have a question related to modding or something I posted? Something that needs staff attention? I haven't been active lately, but feel free to PM me or message me on Steam(link below)

Re: Curved Roads

13
I will give it a go, I dont think you can go much above 30k poly anyway, but I know that source has no problem handling highpoly stuff
to make it more interesting I will model it for ep2 and see what happens
I am pretty sure it will take more time to work on collisions than to work on lighting, especially when someone is going for cracks in the road