VR has a huge potential in every aspect of gaming, especially now that it keeps getting bigger and better improvements. VR racing has been one of the biggest selling points during the early ages of DK1 and DK2. Although VR games back then weren’t so visually pleasing, it still drew people in.

Today we are going to create a specific terrain that is made for VR, and that basically means it has to be very optimized. Performance cannot be low, or else headache may come, which in turn results in motion sickness.

Terrain can be created in various places, but I am using Blender. Blender is a great underrated 3D modelling software than can do lots of things.

Let’s start from the beginning. Warning though, it’s beginner/Intermediate level, so I would advise to know Blender already so it will be easier to follow:

Make a plane

Type Shift+A and then Mesh — Plane.

Usually you want to create a mesh that is similar to the end object. For example, if you want to create a planet, you start with sphere; if house is in the works then cube. In this case, a flat square is what resembles terrain the most.

Then what we need is to add to add a subdivision to two edges. Go into Edit Mode, Ctrl+Tab, select Edge, and click furthest and closest edge with Shift + click. Then W and “Subdivide”.

create terrain for VR racing1Divide your 3D view into two tabs, and then change one of the views into UV Image Editor. UV image editor has given me lots of headaches as I personally dislike unwrapping UV layouts. Luckily, that work is on minimum this time around.

In UV image Editor click on open and select a road texture – The one that you see on the picture (click to make bigger). This texture can be found on textures.com. Once you are there, just search for “road” and you’ll find it somewhere below. Textures site is a solid place to get images for your games, and since most games, especially applications for VR, don’t require high quality images to paste, it is very easy to find pictures of your desire. The only drawback is that there is a limit on how many pictures you can download within a day.

Once the road texture has been opened, go into Edit Mode, select everything with A and then click U — Unwrap. It makes it so you can apply texture onto a mesh. If you click on viewport shading, it shows that road texture in on the mesh.

 

Use Nodes

create terrain for VR racing2Just select 4 edges on the sides and press E to extrude. Extrude it a decent amount like on the picture, and then go into face select, and select all 4 faces that were created. After that click U and “Unwrap”.

Then switch back to Object mode and give your road a material and name it “Road”.

Now you need to switch to another render engine so we can play with nodes. Switch from Blender Render to Cycles Render. Change UV image editor into Note Editor and click “Use Nodes” in the footer menu. Once you see two nodes, click on the first one and Ctrl+T. 3 extra nodes will open, but only if you have “Node Wrangler” add-on installed. Within the “Image Texture” node open up the same road texture you did before.

 

Time to Sculpt

Go into another layer (through footer menu where you see lots of empty gray blocks) and and create a Grid. Grid looks quite similar to plane, so don’t confuse those two. Once it’s created, one the left side you will see X and Y subdivisions: Change them both from 10 to 20. The radius also needs to be changed from 1 to 4. Then go into Sculpt Mode through footer menu and click on “X” and “Y” in the left menu. Don’t forget to turn off mirroring on both axis, otherwise you’ll be sculpting on both sides. Change the strength of the brush to 700 and radius to 90.“User Ortho” view also needs to be enabled by clicking NUMPAD 5 so sculpting is evenly distributed on the surface.

One your desired landscape is sculpted, hold down Shift and smooth out the faces.

Change back to Object Mode.

 

Use Modifiers

create terrain for VR racing4When you are back in Object Mode, click on “Object Modifiers” on the right menu (little gray icon in the middle) and then “add modifier” — “Subdivision surface”

Subdivision surface is one of the most popular modifiers on blender as it lets you add more vertices automatically. It makes your model a lot higher in poly numbers and fixes a lot of issues that can come with lack of polygons like shading, or squarish angles. It’s not used in VR games a lot because at the moment we need to keep the poly amount as low as possible, but for high level modelling it’s a necessity. Don’t worry though, we’ll lower the poly amount to VR standards once this terrain is done.

Change the subdivision view number from 1 to 3, and click “Apply”.

 

Path Designing

Make sure that your 3D cursor is at the center. If it’s not, click Shift+S and then “Cursor to Center”.

create terrain for VR racingThen press Shift+A and Add “Nurbs Curve”. It has an interesting name so it’s hard to miss. Once you have it in the center (very important that it’s there because if it’s not, everything will go wrong from this point), click NUMPAD 7 — TAB — and change into Wire Mode by clicking Z, just like on the picture. That way it will be easier to transform those curves into a road.

Once your desired little piece of road is done, select everything while in Edit Mode, and raise it up a notch, about 3rd of its size. It’s also important to do it while in Edit Mode because we don’t want to change the origin point of said Nurbs Curve.

 

Use More Modifiers

Once it’s up, change back to Object Mode and go into Modifier section and click on “Shrinkwrap”. Now do the following things:

  1. Change “Target” tab to “Grid (You should see the curve hugging your grid now)
  2. Mode from “Nearest Surface Point” to “Project”
  3. Check “Direction” to “Negative”
  4. Click on “Z” Axis
  5. Apply

Create a Road Path

Add another plane, just like in the beginning, and then give it a material. Change the Viewport material color to whatever color you want, that way it’s easier to see.

Now scale this plane down to 0.2 of its original size and when you did it, click S and lock it on X axis by clicking X. Scale it down to 0.5. After that, CTR+A and “apply scale”, otherwise you will have problems with exporting that mesh into Unity. Unity is a good and free Game Engine that keeps getting better and better with each update.

After scale is applied, give it an “Array Modifier” and change “Fit Type” to 200. Don’t click apply yet. After that, add a “Curve” modifier that will basically curve your array onto that “Nurbs Curve” you created earlier. For that to happen though, you’ll have to change the “Object” into Nurbs Curve. This is how it should look on the picture.

There is a problem though. This curve modifier twisted our mesh so it looks a bit unnatural. We can fix that by clicking on “Nurbs Curve” again and going into “Object Data” that is next to Modifier tab. In there, find a Twisting tab and change it from Minimum to Z-Up. That will eliminate the unnecessary twisting.

Click on the road plane now, the one where you changed color, and send it to another layer by pressing M and whatever layer you choose.

Now it’s time to mess with the terrain itself. Click on the terrain, add a “Shrinkwrap” modifier, choose “Plane.001” (unless you changed the name) and then change the “Mode” from “Nearest Surface Point” to “Project”. If everything is done correctly, it should look like this (image).

Then check the “Negative” check-bar also so it creates roads inwards also.

Here comes the fun part. Click on curve endings and add roads by extruding those points with “E”.  Make the road as zig-zaggy as you want.

 

Add That Road We Made

All you need to do to see your road and terrain at the same time is to click on both 1 and 2nd layer through shift.

Select the road you gave a road texture; scale it down to 0.05 of its original size, and give it an “Array” modifier. Make about 50 of them.

If you go into Material tab, you’ll see that image texture is pasted at the wrong axis. Just select the road again on object mode. rotate it down 90 degrees, press CTRL+A and then “Apply Rotation and Scale”. It should be fixed now.

Add this road a “Curve” modifier so we could add that road to our “Nurbs Curve” path. Once the road is on the path, just add more arrays till your road either connects with the beginning, or end wherever you chose. It should look like this.If you see some paths being blocked by terrain, all you need to do it to raise the road a tiny bit. Make sure that the end of the road doesn’t stick out. It has to be connected to the main grid.

Once it’s done, apply all the modifiers to your mesh (only when you are satisfied with your road), and then start smoothing.

 

Polishing Up

Once modifiers are applied, add another subdivision surface modifier to your grid so when you look at the vertices count, it’s around 90,000.

After applying that modifier, change to sculpt mode, hold Shift, and go through all the edges so they look smooth.

Adding the smoothness effect will also help when you change shading from flat to smooth.

Now the only problem that’s left is lowering the poly amount.

1. Go to Sculpt Mode again

2. Lower the brush strength to 0

3. Turn on Dyntopo

4. Go through every spot around the road so that everything would be low poly except the area close to road. That way I lowered my poly amount from 90,000 to 30,000.

Apart from that, there isn’t much to add. If you want the road to look like this:1) Change back to Blender Render

2) Change light source to point

3) Lower its strength to 0.7

4) Distance to 1

5) Click on the road and turn off “Use Nodes”

6) Add texture to road and open the same road texture we used before

7) Scroll down to bottom and check “Geometry — Normal”

8) Lower the value to 0.1

 

That is it. We will be doing a lot of tutorials regarding the VR development in the future, so feel free to follow us on social media. We’ll also be doing Youtube tutorials probably, as they are much easier to follow. That way you’ll be able to learn how to make VR games from the absolute 0.

This road and the VR racing game will be used in one of our projects that we’ll give away for free in the near future. So I’d advise you to be up to date by following us.

 

If you liked this post, feel free to share and like!