Register      Login
Published Date:
AuthorDaniel Sefton
Hyperlinkhttp://www.danielsefton.com/tutorials/blender/intermediate/preparations/
CategoryModeling Tutorials
TitleCreate your own racetrack

TUTORIAL AS QUOTED FROM SOURCE

Introduction

You may have seen the racetracks I created on my 3D Graphics page and wondered how I did it, this tutorial will tell you how. In this multi-part series you will learn how to model, texture, and add final touches like lighting for the best possible realism in a low-poly environment. I will try my best to explain everything in as much detail as possible, however, I would advise that if you are new to Blender read my beginner tutorials, or any other beginners guide so that you have a good grounding ready for the more complex methods and features discussed in this tutorial.

Designing the track

Obviously before we get going, we need to make preparations. To start you need to think about the design of your track, and create a reference image to work from. The following track design is the one I will be using for this tutorial; if you use it or not is up to you, although it would be nice if you could work with your own. You can easily follow from another design.

As you can see the design is fairly basic, I’ve gone with a more natural approach – I’m thinking more towards a countryside setting for this one. It also contains just enough curves for good practice with the bezier tool, which will be explained in the next part of this tutorial.

Importing the design

Once you have your design ready and saved as an image on your computer, we need to import it into Blender. Open the program and delete the default setup. We want the image to display in the background, so, select ‘View’ in the 3D window toolbar and click on ‘Background Image’. You will see a small box pop up. Activate the ‘Use Background Image’ button. It should now look like this:

If you are wondering what the various settings are: ‘Blend’ applies transparency to the image, for blending it into the background, ‘Size’ defines the size of the image, and the X/Y offsets are used to position the image.

Next, click the small folder icon to the right of the ‘Image’ text. You will then see the ‘open dialog box’ which I explained about in the interface tutorial. Find the location of the image you want to use and then press the ‘Select Image’ button in the top right. The image should now appear in the background. Then click the ‘X’ to close the box so that it doesn’t get in the way. The rule you need to remember with image backgrounds is that they only display in a fixed, orthographic view, not in perspective and only in predefined views such as ‘top’, ‘front’ etc.

Conclusion

That’s just about all we need to do for preperations, you can now move onto the next section of this series which will explain how to begin modeling your track.
—————————————————————————————————————-

Introduction

We are now going to start to model the racetrack. In this part, we are going to learn how to use curves to form our basic track shape which is the most efficient way to begin this type of model.

Adding curves 

To start off, we need to add a bezier curve. Bring up the main menu by pressing ‘SPACE’ and select ‘Add > Curve > Bezier Curve’. You will notice a curved line appear in the 3D view. Now, move it to a part on the outside of the track so you can begin to ‘trace’ around it.

To move and adjust the curve simply move the different vertices around (The small dot handles) by right clicking on them and pressing the G key or drawing a movement line. The vertex in the center of the three at each point moves the curve and the two on the outside rotates it.

You can also perform all the other basic transformations like size (‘S’ key) and rotation (‘R’ key). To accurately select the vertices, press the ‘B’ key once for box select and the ‘B’ key twice for circle selection which I find is the best way because you have more control over what you are selecting (use your scroll wheel or +/- to increase/decrease the size of the circle and press ‘ESC’ to exit it).

Tracing the track

Now that you are familiar on how to transform the curve, just start to try and follow the outside of the track with it. You can add another joint by either selecting the center vertex on one of the sides, holding ‘SHIFT’ and again right clicking on the center vertex or by pressing ‘E’ to extrude it. You can disable the transformation widget if it gets in the way by deselecting the hand button in the 3D window toolbar.

If you’re panicking because you haven’t got the hang of transforming the curves, don’t worry, keep experimenting and you will get there eventually, it took me a while to get used to it so you’re not alone!

When you are happy, carry on adding curves right around the track and when you have finished, you will probably thinking “is there a way to join them up?” well yes there is, just press ‘C’ and it will join the two ends of the curves together. However, I advise you don’t do this because it will prove to be a problem when you come to editing the mesh. You can easily join it up when the conversion is finished. Once you are done, it should look something like this:

Adding depth

Now that we have finally traced the outline of the track, we can start to add some depth to it. So, exit edit mode (‘TAB’) and add another bezier curve (‘SPACE’ > Add > Curve > Bezier Curve). This curve is what we are going to use to extrude around the track to form the road. Now, so that the track isn’t all wonkey, we need to straighten the curve by pressing ‘V’ this will turn the curve into a straight line. Depending on what you want your track to be like, you can add more curve joints. This will add another mesh column to your track so you can add things like a track side or barriers. For my track, I am going to add just two extra joints for the inner landmass and the outer landmass. You don’t have to add any joints if you don’t want to, we can do whatever we like with the mesh a bit later on, I just find it quicker to add it with just a few clicks. My curve now looks like this:

Next, to extrude the curve around the track we need to give it a name. Exit edit mode (‘TAB’) and go into the ‘editing’ buttons. In The OB field in the far left box, enter a name, I called mine ‘cur’. Then, select the track curve and again in the editing buttons panel, in the far right box, enter the name you just called your extrusion curve into the BevOB field. If you enter wireframe mode (‘Z’) you will notice that it looks something like this:

Looks slightly messy doesn’t it? To sort out the overlapping all we need to do is increase the size of the track curve. Enter edit mode (‘TAB’) and press ‘A’ to select all the vertices , then increase the size with ‘S’. You can also fiddle about with the ‘Width’ property in the ‘Curve and Surface’ box which acts in a similar manner. When you then exit edit mode from the first method you will notice that the track looks a lot cleaner, as shown here:

Unfortunately, the track is now way too thin. Just have a play about with the track curve until you have it at an appropriate width. Don’t worry if it slightly overlaps at places, we can sort that out when we convert it to a mesh.

We now need to start to take into account that this track is going to be integrated into a game (well not really, but we are assuming so) and the amount of polygons (faces) in the track looks slightly high and we need to reduce them. This will not only help the game performance but it will also make it much easier to close up the mesh later on. Because the track is still in curve mode we can control and adjust it however we want.

In the ‘Curves and Surfaces’ box there is a grey field that says ‘DefResolU:’. At the moment, it is set to 12, so if we reduce that number right down to something like 6 or 7, you will see it automatically reduces the amount of polygons. You may also notice that it has reduced overlapping even further.

Finally, at this point I would begin cleaning up the design. Remember that when in-game you don’t want corners to be too sharp or the road to be a bit wonkey, especially if you are aiming for a ‘real-life’ style of track. At this point it should now look something like this:

Adding elevation

Finally, now that the track design is done you can enter perspective mode and start to add some elevation. Before you can transform the curves in 3D space, you need to enable it. Just below the ‘DefResolU:’ field are three buttons, one of them labeled ‘3D’, select it and then you can begin.

You can switch to perspective mode by pressing ‘Num 5’. To add elevation, just enter edit mode, select the curve joint you want to change, press the ‘G’ key and then press ‘Z’ to move it vertically. You may not be able to make it out too well, but here is what my track looks like with some elevation:

Conclusion

We have now finished with curves, in the next part we will move onto converting the track to a mesh and adding the landmass and start to get it to look like a real race track.
———————————————————————-

Introduction

We are now moving onto the second part of the modeling section. We will now be converting the curves to a solid mesh, creating the landmass and optimizing the model to run smoothly in-game.

Converting to mesh 

To start off we need to convert this track from curve to mesh form. Just as a backup or if anything goes horribly wrong – duplicate the track (SHIFT+D), scale the copy down and move it out of the way. To convert your curves, all you need to do is select the track, press ALT+C and select ‘Convert Curve to – Mesh’. Next, select the solid shading type in the 3D window header:

You should now see a grey shading of the track and when you switch to edit mode you will see a solid wireframe of the mesh:

Mesh cleaning

Now that we have the track converted we can start to fix the track up in a lot more detail. As you can see if you look carefully there are a lot of purple dots, these are just simply the vertices of the mesh and for now we will be adjusting these. Zoom right into where you see a glitch in the track like overlapping, all you need to do to fix it is select and move the vertices in that area until you are happy it looks ok, they turn yellow when active. If by any chance the vertices are hidden under the mesh (due to overlapping) you can switch to wireframe mode (Z) and you will be able to see all the ones behind. Below is an example of a quick ‘before and after’ of one of the corners:

Once you have finished cleaning up all the minor glitches I will show you how to close up the gap in the road. To do this you need to select the vertices/edges you want to close (either a tri or quad shape), and then press ‘F’. Once you have done that it may look a bit strange, again just fiddle about with the vertices until you are happy the shape blends in:

You can now use this technique to remove poly’s as well for the straight parts where a large amount of is not needed. Just be careful you don’t remove too many around the major elevation points. Select the vertices you wish to remove, then press DELETE on your keyboard and press ‘Erase – Vertices’ and join the two remaining sides:

Next it is time to begin closing up the track to add a bit of ‘landmass’. There are several techniques for doing this, but I am going to show you my methods. This is probably the longest and most tedious job in track building but it is worth it. To begin, just start filling the smaller enclosures as they will only require single face filling. Again all you need to do is select the vertices you wish to close (3 or 4) and press ‘F’.

For the larger enclosures you need to use a special method which ‘splits’ the poly’s for easy filling. First of all you need to select the vertices you wish to perform this method on (you can only do this to each enclosure individually) then press ‘E’. A popup should appear, select ‘Extrude – Only Edges’ and then press ‘S’ to size the extrusion inwards.

After you have done that you will notice that the area around the extrusion looks a bit ‘busy’ and quite difficult to close. We need to split the vertices into tri’s, delete every second vertex and begin to fill the poly’s as shown below:


Another method of filling if a clean quad doesn’t fit is to fill triangles around a point. All you need to do is extrude a single vertex to the center of the extrusion area and begin to fill triangles around it, and it should end up like this:

You can continue using the same method throughout the entire track, extruding, splitting and filling. Once you have finished, it should look something like:


That just took me around 30 minutes, so it’s not my cleanest of modeling but this is what you should be aiming for, and as you can see I have used the same methods as I mentioned all the way around the track. It may take some time but eventually you will become faster and produce a much better poly flow. Practice makes perfect!

Finally as you may have gathered, the outside also needs closing. Again, use the same splitting method as mentioned previously, until you have extruded it outwards multiple times. Make sure you pull it outwards quite far and elevating higher each time – you don’t want to see over the edge of the track! Here is what my model looks like with a completed mesh. I used the splitting method multiple times when extruding outwards. Remember that the further away from the track, the lower the poly count:

Conclusion

Once you have perfected your mesh and adjusted the elevation, the modeling of your track is complete! I know it looks dull, which is why in the next part we will learn how to add some textures.
————————————————————————————————————————–

Introduction

So far you have learned how to prepare and model your track, in this tutorial you will learn how to apply texturing. Texturing is technically a very simple process, the only difficult aspect is choosing the right images and applying them appropriately. Hopefully in this instance that won’t prove too much of a problem. Unfortunately I cannot supply you with the textures I will be using, as they are what I use in conjunction with RaceRacer.

Gathering textures

Now, if you haven’t already, you need to decide what setting you are going to have your track in. A few examples include grass, sand, dirt, snow and city. My track will simply be a summer grass track, it’s probably the most appropriate to choose for a tutorial.

You need to now start to gather the textures. The best place to look first is probably Google images – use search terms like ‘grass texture’ or ‘road texture’, you’ll find there is plenty to chose from. Try to gather pre-seamless textures for now, I’ll try to fit in a seamless tutorial in later on, there is a method you can use to convert. I have included a list of resources for free textures at the bottom of this tutorial as well, so I suggest you check them out as well.

Not all the textures you find will be perfect, I recommend you use a program like Photoshop to touch them up, or even make your own. It would be very difficult to find free textures and not have to edit them in some way. If you don’t own any decent graphics application and you’re skint, then I suggest you try ‘The Gimp’, it’s free and has plenty of features to work with for textures (again, the link can be found at the bottom of this tutorial).

Hopefully you now have a decent collection of textures to work with, just make sure you move them to a folder called ‘textures’ in the same directory as your .blend file and name them with appropriate names (e.g. grass.jpg).

The texturing process

To begin, open up your track file. Change the ‘Draw type’ to ‘Textured’ – this will display any textures that are applied to the track. Now make sure you are in object mode, then select the track object and press ‘F’. You should see that the track now appears white with an outline of the mesh, this is in ‘UV Face Select’ mode.

What we need to do now is first apply the road texture, and insted of having to select every individual face we can use a couple of cheats. In face mode, press ‘TAB’ to switch to face edit mode, here you can apply all of the mesh deformations and all of the select methods. Once in edit mode, hold ‘ALT’ and click the right mouse button on a part of the road. It should loop and select the entire path, if it doesn’t try repeating until it does. Switch back to the normal face mode (‘TAB’) and you should see the track route highlighted.

Now what we need to do is apply the road texture to those faces. On the separator between the button and 3D window, split the 3D area in half. Then click on the ‘Window Type’ button to the left of the new window header and select ‘UV/Image Editor’:

You should see the window appear grey with a blue square in the center. All we need to do for now is open the road texture, so select ‘Image > Open…’:

The open dialog should now appear. Select the road texture and click ‘Open Image’ in the top right. That’s it! You have now textured your road. Press ‘F’ again, and take a look around. You will notice a slight glitch in the way Blender has layed out the texture, some of the road appears to be rotated the wrong way. To fix this, simply enter face mode again (‘F’), select the face texture you wish to rotate and press ‘R’. A small menu will popup, in this case, you need to select ‘Rotate – UV Co-ordinates’:

Usually for the road to flow seamlessly you have to rotate it three times, I’m not sure why. Repeat the process for the rest of the wonkey faces, for quickness you can select multiple faces and apply the same.

At the moment the track looks a bit plain and well, white. Basically the same process applies for any other texture you apply from now on, and I think it’s time to grow some grass. Insted of endlessly trying to select every face, there’s a useful shortcut you can use. Again, loop select the road in edit face mode, then in the Editing window, in the ‘Mesh Tools 1’ box click on ‘ Select Swap’ and you should see the selection invert. Now you are ready to apply your grass texture – same process, make sure you are in normal face mode then: ‘Image > Open…’, select and voalia. Hopefully your track will actually look like a track now, take a look:

Conclusion

Pretty cool, eh? I’ll leave this tutorial at that for now, hopefully you now have enough grounding to apply further textures, maybe a few side textures and rumble strips or even a few gravel traps in there. In the final part of this series I will be explaining how to add a few final touches like a sky, lighting and maybe even a simple testing engine 😉
———————————————————————————————————

Introduction

This is the final part in this tutorial, we have a fully functional track finished but now it’s time to add a few final touches that will hopefully add some realism. Here you will learn how to add lighting, a sky dome. and game logic for trying it out.

Adding a sky dome.

A sky dome. for a track is obviously essential, surprisingly it’s not too hard to add either, you just need to worry about getting hold of the right textures. Again, I have included resources at the bottom of the page with a selection of different skies you could use.

First of all you need to switch to top view (‘Numpad 7’). Then, move your cursor roughly to where you want the dome to appear (at the center of the track), and press ‘SPACE > Add > Mesh > Icosphere’. An icosphere is probably the best to use in this situation, you’ll know what I mean if you try using a UV Sphere.

Now what we need to to is cut the sphere in half, so switch to front view (‘Numpad 1’), enter edit mode (‘TAB’) and preferably switch to orthographic mode (‘Numpad 5’). Next, press ‘Z’ twice, this will enter you into wireframe mode, which is useful for selecting behind vertices, then bring up the selection tool by pressing ‘B’ once. What you need to do now is drag a box around the bottom vertices and release to select them like so:

Obviously you now need to erase them for the dome shape to appear – press ‘DELETE’ then select ‘Erase – Vertices’. The sphere is now in dome form. Finally position and scale it appropriately, it needs to be very large in comparison to the track.

Now that the dome is in position and ready for texturing, we move straight into face mode. The first thing that you will notice is that the ‘normals’ are facing the wrong way (outwards). The way the normals face depends on which side the texture appears – if you zoom into the track the sky dome. appears transparent from inside. To fix this, enter edit mode (‘TAB’) and then select every face (‘A’). What you need to do now is press ‘W’ to bring up the ‘special’ menu . This contains the tool we need to use, so press ‘Specials – Flip Normals’ – the problem has now been fixed, enter face/object mode and zoom into the track to see what has happened. The sky is white!

Adding a texture to the sky dome. is similar to what we talked about in the last section, but with a slight twist. Again, enter face mode, split the screen and open the UV/Image Editor – this time though, make sure you are in front view (‘Numpad 1’). Select all the faces (‘A’) and then open up the sky texture you wish to use (‘Image > Open…’).

The twist is, that we need to use a different UV calculation, it looks a bit strange with the default setting. What we need is a continuous ‘wrap’. Make sure all of the faces are still selected and press ‘U’, then press ‘UV Calculation – Cylinder’. Yes, it does look even worse now, but what you need to do is scale down the texture ‘net’ so that it fits around the dome.

Drag the UV window further out so you have more room and then zoom out via either the scroll wheel or ‘Ctrl+MMB’ until you have a full view of the net. Then select the entire thing (‘A’) and scale it down vertically so press ‘S’ and then ‘Y’ and drag. It scales it down to the center, so just move it down to the texture by pressing ‘G’ and then ‘Y’ and moving your mouse. Zoom back in and try to scale it until it perfectly fits the box:

As you can see, the net is slightly wider than the texture, you need to do this due to the nature of the shape of the sphere, if you don’t then an ugly overlapping will form:

Lighting

Lighting isn’t too difficult in this situation, we are going to use a dynamic method that projects the sunlight directly onto the texture.

First off we need to actually add a source of light, namely the sun. Make sure the default ‘lamp’ setup is deleted then position the cursor around to where you want to place your sun. Press ‘SPACE’ to bring up the shortcut menu then go to ‘Add > Lamp > Sun’. You should see this element appear:

A couple of changes need to be applied to the sun’s properties in order for better results, and because I have chosen a ‘day’ track I need the energy of the light to be increased. I have used ‘1.200’ and enabled the ‘No Specular’ button (this stops the ground reflecting the sun):

Now we need to enable the track textures to allow lighting. To do this you simply switch to face mode (‘F’), select every face (or the ones you wish to support lighting), go to the ‘editing’ buttons window and under ‘Texture face’ press the ‘Light’ button then ‘Copy DrawMode’. Copy DrawMode copies the setting across all of the faces you have selected.

You should notice that shading has been applied to your track. To change the source direction rotate the sun (along the Z axis) and the shading direction changes.

Final result

So, after all of that you’re probably eager to know what my track now looks like. First of all you should know that my poly count is around 950 faces which is extremely low and should run smoothly on most low-spec machines.

The shots below are all taken with MIP Mapping disabled. You can access the option by pulling down the ‘User Preferences’ bar, selecting ‘System & OpenGL’ then disabling the ‘MIP Mapping’ button. I won’t go into detail, but you’ll know what I mean when I say it improves realism for still shots. Take a look:

Conclusion

Not bad is it? I think considering the poly count and simplicity it looks quite effective. With further detail and textures it could look even better, but as far as this tutorial goes I’ll leave it at that for now. In the very final part of this tutorial I will explain the process of setting up your own track testing engine.

Rating: 5.0/5. From 1 vote.
Please wait...
NoImage
Comments
One Response to “Create your own racetrack”
  1. Mudball says:

    Can you link a place to download the track? 🙂

    Rating: 5.0/5. From 1 vote.
    Please wait...

Comments

Leave your reply