[Blender] Mountain Roads With Tunnels And a Constant Slope

The information and techniques to create a mountain road, a tunnel, with a constant slope, seem to be scattered around the internet. In this article, I collect them all together.

The outline of this article is:

  1. Create a basic mountain
  2. Create a road
  3. Dig a tunnel

The slope of the road will be fixed as a constant, which eliminates bumping. (Great!)

Create a Basic Mountain

Select Edit->Preferences->Add-ons, search A.N.T Landscape, and install it.

Create a mountain at your will.

Scale up the mountain to match the real-world scale of a mountain should be.

To avoid viewport clipping, increase the View->End, say, to 10000.

Create a Road

Let’s go to the top view by pressing the 7 on the keyboard, and adding a Bezier curve.

Extend, rotate, and adjust the location of the segment points.

Make sure the curve is totally flat so that the road we create will have a constant slope.

Also make sure the Twist Method of the curve is Z-Up.

Then, add a road plane, with a slope you want. Here, I use a slope of 12%. (the road will elevate 12 meters for every 100 meters).

Note that the origin is at the lower side of the road plane. (which can be achieved by placing the 3D cursor with Shift+S, and the menu Object->Set Origin->Origin to 3D Cursor.

Now, place the road plane at the beginning of the curve, by selecting the curve, enter the edit mode, and press Shift+S, select Cursor to Selected.

Then select the road plane, Shift+S again, and choose Selection to Cursor.

Add an Array modifier (with both x and z offset selected), and a Curve modifier (select the curve).

The scene now looks like this:

Notes:

If the orientation of the road does not follow the path, it may be due to, the rotation of the road plane. Try to rotate the road plane by 90 degrees along the z-axis.

Also, if the handles of the curve are not flat, it may lead to strange results like this:

Make sure you have no issues before proceeding.

Next, select the mountain, add a Shrinkwrap modifier (Wrap Method->Project, Axis->Z, both Negative and Positive, Target->the road plane).

The higher part of the landscape will be cut through by the road, and the lower part of the landscape will be added up to match the height of the base of the road.

This video shows this technique in detail:

Dig a Tunnel

First, select the vertices on the path that you would like to be the path of the tunnel.

Shift+D to duplicate.

Press P to separate.

Shift+D again, and grab this curve up, over the terrain.

Add a Shrinkwrap modifier, and project along the z-axis to the road plane.

I found it would be strange if I applied the modifier here.

So, do not apply the modifier here.

Convert the curve to mesh, and then converting it back to curve will lead to a correct result.

Next, select the bevel setting, and change the Depth and the Resolution, to create a tube.

Shift+D (to preserve the original curve, for later use to extend the road beyond the tunnel), and convert it to a mesh.

Add a boolean modifier to the landscape to subtract the tunnel shape.

But it seems no effect, why?

Because both ends of the tube are not closed, let’s fix that.

Go to edit mode, select the outermost rim, and press F to create a face.

Same as the other side.

After that, we should have a tunnel.

Then, to create the road inside the tunnel, select the vertex at the beginning of the tunnel, and move the 3D cursor to it.

Shift+D to duplicate the road plane, and move to the 3D cursor.

Select the Curve Object to the tunnel curve (that which is on the ground, not the curve we use to create the tunnel mesh to cut the landscape).

Note that the origin of the reference curve on the ground should be at the location of the first point of the curve. (see the 3D cursor below)

After that, the road should be in position.

There is still one issue that needs to be solved, the base of the tunnel road should be filled, too.

Add a Shrinkwrap modifier to the landscape, and project along the z-axis, with only positive direction selected.

Done! The base is filled.

Note that our tunnel has a beautiful constant slope going up, which is awesome!

Notes

To extend the road after the tunnel. First, separate the road segment after the tunnel.

Move the 3D cursor to the beginning of the road segment (the endpoint of the tunnel mesh curve).

Duplicate the road plane, and use the separated path in the curve modifier.

And add another Shrinkwrap modifier to the landscape.

Done!

Finally, if you would like to increase the resolution of the road, you can select the faces that the road passes through, and subdivide them. (instead of using a subdivision modifier on the whole plane, which may hit the performance)

Go to edit mode, and choose Face select.

Press C to select the faces that the road passes through.

And subdivide those faces.

I think 3 cuts are enough.

The blender file can be downloaded here:

TunnelTutorial.blend

Thanks for reading!

Published by

getabyte

An Electrical Engineering student who likes to learn new things.

Leave a comment