Rolling Line – Guide to Importing Generated Terrain

This is a guide on how to take what you’ve made in a terrain generator and import it into game. You will already need two parts for this guide that most terrain generators export. You will also need at least a basic understanding of how to use Blender. This is not a guide on how to generate terrain and I’m not here to endorse any particular terrain generator.

Importing Generated Terrain Guide

The Guide

You will already need two parts for this guide that most terrain generators export. You will also need at least a basic understanding of how to use Blender.

Color map

Terrain map

Follow this Blender tutorial on Youtube, except for the last few steps. Meaning that we don’t need to worry about how it’s lit and we will create the edges for RL below as we have nothing special prepared like their example. When you finish this step, you should have something close to what you’d like to see in game.

Save a backup version here before you apply modifiers. This way if you want to redo something later you will not have to retrace all your steps. As for subdivision I will be using 10 here, even though such detail can cause an issue with shadows, and I’ll reduce faces later, but 9 might be safer if you don’t have a lot of detail.

Apply the modifiers (Save as original file so you do not keep saving over your backup).

In my case I get some ‘artifacting’ around the edges where the outside vertices are significantly higher or lower than the inside neighbor. Some will be below; these are above:

The fix to this we go into edit mode and select each outside vertex. Make sure you are in Edit and vertex selection mode, select the vertex in one corner, hold control and click another outside vertice along one edge up a way and it will auto select those between. The auto select will try to cut the corners so you must select the corner vertices. Be careful of when it switches from above to below, it is easy to miss! Undo History is in the Edit menu and counts selection.

Make sure that you selected all the outside vertices desired:

Now if you were to do this technically correct, you would first delete these and once again re-select the next set of outside vertices before our next step and extrude from those to create a side perfectly vertical. But I’ll just be using these as I’m lazy and nearly vertical is good enough for me.

Hit these keys in order: S > Z > 0 (not O)

This scales everything to the same Z height. You can then use the Move tool to lower all of these vertices way down the Z axis.

Technically you only have to go as far as it will be off the floor, but if you skipped the ‘delete and re-select step’ like me, the further down you go the closer that angle is to vertical, but don’t go crazy. If you did not skip that step, hit E (to extrude), Z (lock axis) and move mouse down to create your siding. Now we have our sides, but we need to separate them from the terrain:

Switch to face selection mode. Use control again to click around and select all the sides. Hit P and click Selection to separate this into a separate model that we will export later.

The texturing will look messed up, this is fine, but we will have to adjust to this looks correct in game. If the UV map of the sides is on the right side, it will reflect the nearby hues/saturations and we just want a flat color.

In object mode make sure you have the edges object selected (not your terrain) and switch to edit mode.

Hit A to select all vertices, U > Unwrap.

Go to the UV Editing tab. On the left side use the scale tool to scale your unwrap way down and move to move it to the left side, mines way up top:

Side note on this step: if you read the section in the in-game mod menu about paintable models you will know each 1/16th of this invisible UV map is a different hue/saturation based on what you color paint.

Here is where you will want to make any final adjustments to your terrain.

My terrain is still at 1 million faces which is too much, but I have a lot of flat ground wasting faces for no reason. I am going to apply a Disintegrate modifier at 0.2, which is a bit strong. You should play with the number before applying to get a lower face count without sacrificing too much detail. Down to 422k faces, better, but still tough on performance.

This is also the time for any minor adjustments. On Mountain Meadow I found myself coming back multiple times to sculpt the terrain out of the way of the tunnels. Today I will be hand modifying some of the mid-height peaks created, so the tops are flatter and rock like, just like the ones in the image I’m using to source my terrain. There is no ‘right way’ other than to make something that meets your goals. You might find as you are laying track that you wished something were a little different and come back to this step but trust me you want to find and make those adjustments before you get details placed.

We are ready to export and test!

We need to export each model separately, so delete the sides, export terrain, undo the delete, then vice versa export sides. When exporting out of Blender hit File> Export> Wavefront (.obj) – I like to use scale of 0.1, but you might want to play with it. But 1 is almost always way too big in my experience.

Make sure both of the .obj files and the color map are in your custom assets folder:

  • SteamsteamappscommonRolling LineModdingcustom assets

Start up Rolling Line, open a new empty layout, and open the Modding menu. Add New mod, give it a name.

Click into the ‘main’ mesh, select your terrain .obj and your color map for texture.

Add another mesh for your sides, select your side .obj and make it paintable. I like to paint with darkest default black (page 2, top row). Uncheck casts shadows.

General Options make it part of the Room layer

Collision Options, Mesh, point to your terrain .obj

Now, if you skipped the step where I changed the sides UV map, you’re going to get some odd coloring on the sides, go back to that step, shrink your UV map and move it, then re-export the sides.

Finally, we should have something, that short of the shadows, we can be proud of:

Advanced

What if we don’t want a square shape? What if we want a backdrop? While I am not here to teach you Blender and how to make shapes (Google & Stack Exchange are your friend on how to learn things) below is how I’ve modified my terrain and hopefully it gives you some ideas.

What I’ve done in the below is taken a cube and added a Bevel modifier on it. I plan on using this shape to cut the terrain (we’ll have to make new sides) and to create a backdrop.

To be honest I thought it would be more oval shaped than this (increase Bevel width), but I’ve been trying not to cut one of the ‘towers’ in half. You’ll find your own style choices as you go through the process.

We add a Boolean modifier to our terrain object, with Intersect for the Operation and the cube for the Object, to chop down our terrain to the new shape.

I then actually selected some of my cube and separated it into another object to use as a backdrop, then deleted the remainder of the cube. If you have a plane (like the backdrop) that is facing the wrong way in game go into edit mode with all the faces selected and go to Mesh>Normals>Flip. Once UV mapped and imported to game:

Recommended for You