A Programmer's Guide to Vehicle Modeling

This is not a tutorial. Rather, think of it as a public notebook documenting the process of creating a 3D model of a car in Blender. This is the first car I’ve modeled in Blender — actually, it is the first thing I’ve modeled in any software — so I’m not qualified to tutor anyone. I am learning as I go (which is always the most interesting way). I will undoubtedly do stupid things, so I am counting on you folks to set me straight. I will keep refining the process, just like the model, based on the feedback I receive.

It is quite possible that I am going about this the entirely wrong way, and will have to throw it all out start again, a little older and a little wiser.

My goal is to model my own car, a 2001 Saab 9-3 SE hatchback. In addition to the visual model, I would like to get enough of the physical properties together to import it into a racing sim and give it a proper drive. I am looking for an approach that allows me to build a model iteratively, just like agile development of source code. I should be able to get a usable (if very ugly) model quickly, then refine it using a simple, repeatable process.

I’ll use Blender for the modeling and GIMP for the texture work. Both are free, open source, and available for Windows, MacOS X, and Linux, making them available to just about everyone. I imagine that all of the concepts I use here also exist in other tools, but then I’ve been known to imagine all kinds of things.

Modeling Approach

A high-level description of the approach I plan to take in creating and revising the model, in the hope of getting some feedback before I actually get started, in case I’m totally on the wrong track.

Here’s what I’ve got so far…

  1. Start with a box the same cardinal dimensions as my car.

  2. Split the box lengthwise and mirror it, so I only have to model one side.

  3. Place blueprints as background images in each view.

  4. Cut some seams for LSCM and unwrap the box

  5. Apply some blueprints or photographs as placeholder textures.

  6. Turn on subsurface modeling.

I’m not sure how subsurface works with the mirroring; I’ll have to experiment and see (there are some tips here). Once I’m gotten this far, I think I can gradually refine the mesh by using the Knife tool to cut edges, then push them around to fit the shape of the car. I’m hoping that my seams and texture coordinates will stay roughly correct as I add detail.

Once I’ve got sufficient level of detail, then I can look into slicing apart the individual parts (doors, etc.) and applying the same approach to modeling the interior.

Again, the approach I want to take is to get something ugly quick and refine it over time.

The Tools

While I am doing this to teach myself 3D modeling, I’m obviously hoping I can help a few other people follow along (all part of my plan for world domination). To that end, I’ve chosen tools that are both free and available for all of the major operating systems. Just because they are free doesn’t make them toys though — you can create some truly amazing things using these tools. Right now I’m barely scratching the surface of what is possible.

The GIMP

GIMP (which stands for GNU Image Manipulation Program) is a general purpose image editing application similar to Adobe Photoshop. I’ll be using it for preparing the blueprints on which my model will be based, and later for painting the textures (I think - I haven’t actually done much with textures yet).

Blender

Blender is a 3D modeling application, similar to 3D Studio Max or Maya, with a high-quality renderer and even an interactive game engine. Take a look at the Features and Gallery page for a better appreciation of what Blender is all about.

Make Backups!

In the course of climbing this learning curve I have occasionally painted myself into a corner. And so I learned — the hard way — that a complete history of my work is invaluable. Not just the last two or three or ten versions, but everything. If, like me, you are new to all of this, do yourself a favor and learn from my mistakes.

Your work history can be as simple as copies of the file made at regular intervals and stuffed into a folder somewhere. Giving your copies descriptive names like “Finished box setup” or “Ready to start texturing” will make it all the more useful. If you are diligent about taking snapshots you are going to end up with a lot of files, which can be hard to keep organized. Splitting them into dated subfolders, maybe one for each week depending on your pace of work, can help.

In the software development world we use revision control software to do the work for us. You add your file to a “repository”, which is a bit like a database. You then take snapshots of your work (the more the merrier!) by “checking in” or “committing” the file, at which point you can enter a complete description of what you’ve done to it since the previous snapshot. If you find yourself in a bind, you can revert back to the last snapshot with a click of the mouse. Or, if you find yourself at a dead-end, you can browse the full history of your work to find a good place to restart.

For my own work, I set up a Subversion repository on my MacBook, and I put everything in it. Subversion is available for just about every platform out there, and it’s free. Windows users can even go one better and use TortoiseSVN, which makes it all almost as easy as managing your local files. Mac OS X users have SCPlugin which, while coming along nicely, has a ways to go to catch up to Tortoise.

(Linux users, of course, don’t need no stinkin’ UI. The Subversion command-line client is available in every major distribution.)

For more information, see:

Blueprints

In order to model accurately I need reference images illustrating the shape of my vehicle from the cardinal directions: front, back, side, top, bottom. Blender allows me to put these reference images into the background of the editing views, helping me precisely shape the model.

The best format for reference images, if you can find it, are blueprints. In theory, you can also use well-framed photographs, but in my (limited) experience blueprints are easier, as they don’t suffer from perspective (shapes getting smaller with distance from the camera). Here is my current collection of blueprint hosting sites. If I’ve missed any please leave a mention in the comments; and if any have stopped working also let me know so I can remove them.

This article on BlenderNation lists additional reference image sources for everything from spaceships to cartoon characters. You can also try using Google to search the listings of the US Patent Office. And if you have any good tips for taking photographs that can be used for modeling, please pass them along in the comments and I will include them in the article.

You will also need some specifications for the car. Width, length, and height and a minimum for modeling. If you plan to import your model into a simulation and actually drive it, the more information you can find the better. Here is a specification sheet I found for my car.

Preparing the Blueprints

The blueprints need some prep work before they can be used for 3D modeling. To start, they need to be cut up into individual views (front, side, top). Each individual image will then be associated with a corresponding view in Blender. Also, most blueprints have been manually scanned from paper and as a result are not entirely straight.

I’ll be using GIMP to manipulate the images.

Cut It Up

The crop tool, in Gimp 2.4

GIMP’s Crop tool is used to extract a portion of a larger image. In my case, I want to extract a single view of the car from a larger sheet containing multiple views. Cropping works like a rectangular selection tool: click and drag to select the region you want to keep, then use those big boxes in the corners of the selected region to adjust the boundaries as needed. When it looks good, double-click inside the box to make the cut. Everything outside the cropping box then gets discarded, and you are left with just the selected region.


Cropping a single view in Gimp 2.4; the dark grey areas will be removed.

Try to get the car roughly centered in the box, and leave some room around the edges.

Now File > Save As… to save the single view to a new file. Important: don’t hit Save and overwrite your full sheet! (I only did that a couple of times - doh!). Save the image in the PNG format, with the default settings.

Reload the main sheet and repeat until each view of the car is in a separate file.

Straighten It Out

Most of the blueprints that I have looked at online are not quite straight, presumably because they were manually scanned from paper. To make everything line up nicely in the modeler they need to get squared off.

Load one of the individual view images into GIMP. You might find it helpful to zoom in a couple of times, which will make any misalignment more visible.

Check to make sure that the image is in “RGB” mode by selecting Image > Mode > RGB from the menu. Images in “indexed” mode will rotate very poorly.

To check the alignment of the image use the Rectangular Selection tool as a straightedge. Place it along straight lines in the blueprint and look to see if it is tipped one way or the other. If so, use the Layer > Transform > Arbitrary Rotation tool to correct the image: positive values turn clockwise, negative values counterclockwise. Just guess a number and see how it turns out, and use [Ctrl+Z] to undo and try again. Learn from my mistake and take your time on this step as it will make your life a lot easier later.


This image required a rotation of -0.4 degrees to straighten.

After you rotate there will be some transparent areas around the outside of the image. Crop the image again to get the edges nice and square. Repeat the process for each of the views.

Flip It

The side view of the car should pointing to the left. The top view should be pointing down. Use the “Flip Vertical” and “Flip Horizontal” tools to flip the orientation of your images if necessary.

Blender Setup

…where I split Blender’s main window into multiple views and assign background images.

[MCLICK] on 3D window boundary and choose “Split Area”. Do it on top, left, and right edges to get a four-pane view. This feels claustrophobic to me; I wish I work with just one or two views and switch between them. Unfortunately the background image does not follow the view, making switching impractical. Bummer. I’m trying to work with a three-pane view right now, front view in the top-left corner, side at bottom-left, and top to the right.

Box Setup

Where I size my starting shape — a box — to the exact dimensions of the car, and mirror it.

Will consider one Blender unit to be one meter. This, best I can discern, gives me a maximum resolution of 1mm, which should be fine for my purposes. If you needed better resolution, scale up.

Splitting the Box

Cars are laterally symmetrical — the left side is the same as the right — so I can save myself some work by modeling just one side. I can set this up right from the start by splitting Blender’s default starting box in half and applying the mirror modifier, so that changes made to one side are automatically applied to other. To split the box, I’m going to use the Knife tool, which I expect to be using a lot when I get to the mesh refinement stage.

We’re editing, so make sure you are in Edit Mode (TAB). We need to edit the entire box, so make sure that “Limit selection to visible” is turned off (that’s the cube next to the vertex/edge/face selection buttons).

(put an image of the “limit selection” button here)

In the top view (the view with the X-Z axes), select the entire box (AKEY for “select all”). Press KKEY to bring up the Knife menu. Choose “Knife (Midpoints)”, since we want to slice the box right down the middle, and then click-and-drag a line right down the middle of the box, from top to bottom. The line does not have to be exact. Press ENTER to make the cut.

Now select everything on the left half of the box (BKEY and drag). Press XKEY to delete and choose Faces. You should now have one half of the original box, the left side of which is open.

Mirror the Box

Switch to Object Mode (TAB). The box should switch to a pink outline to show it is selected; if not, select it now.

Switch to the Edit Buttons ((image) or F9). On the Modifier tab, choose “Add Modifier”. Select “Mirror”. You should now see two boxes in all views, replacing the half that we cut off earlier. Select “Do Clipping”, which will make sure that we don’t accidentally move any vertices over the mirroring axis.

Sizing the Box

This is getting long…I should split it into multiple pages

The process to place vertices exactly is as follows: select the vertices to move. Press GKEY to grab them. Press XKEY, YKEY, or ZKEY to constrain the move to a particular axis (you can use the little axis diagram in the bottom-left corner of the view to help decide), then type in the distance to move the vertices along that axis.

Before starting, make sure that you are in vertex select mode.

I’ll start by resizing the box to the length of the car: 4639mm, or 4.639 meters. Switch to edit mode, and put the cursor in the side view. Press BKEY to start box-select mode. Select the two vertices on the right side. Now press GKEY to “grab” them. Press YKEY to constrain motion to the Y-axis. Then type “-1” and ENTER to move that side back to the origin. Now, press GKEY and YKEY again, and enter one-half the length of the car, which in my case is 2319.5mm, or 2.319 meters, so I enter “2.319” and ENTER. Finally, press AKEY to deselect the vertices.

Repeat the exact same procedure for the left side of the box, but reverse the sign of the numbers (replace positive numbers with negative, and vice versa). Then move onto the other views, and repeat the process for the width and height (using the front view).

Now might be a good time to use the mouse wheel in each view to zoom in a little. Press [F12] to render your new vehicle. Swanky!

Thanks for Robert Burke and BlenderArt Magazine #11 for the tip on exact vertex placement.

Adding the Blueprints

Might be better to do blueprint sizing/rotation/etc. here instead of in a separate step. Easier to see misalignments during this phase.

Switch to wireframe views.

In each panel, choose View > Background Image. Load the appropriate image (side, front, etc.) for that panel. Then use the Size and Offset values to fit the blueprint image exactly inside the bounding box I created.

I ran into both rotation and sizing issues. Make adjustments to the image in GIMP, save, and then use the “Reload” button in Blender’s View > Background Image dialog to check it. Make liberal use of Undo in GIMP to experiment with changes to fit the image as closely to the box as possible.

To use GIMP to scale in just one dimension, use Layer > Scale Layer and click the chain button to break the link between the X and Y dimensions. If the blueprint starts to hang off the edge of the image, choose Image > Fit Canvas to Layers to fit the image area to the scaled layer area.

Again, take time to do it right as it will save time in the end.

Next Steps

Here is what I’m working on now.

I’m currently playing with texture and materials, and trying to figure out the best way forward. Do I refine the mesh to roughly the right shape, and then texture? Or go ahead and texture now and then refine the mesh in a repeatable way (which I need to figure out anyway if this is going to work)? And what happens when I slice the parts up later? Will I need to remap them, or is it better to keep them all in one big map?

It would be helpful if I knew more about the actual rendering process, like how I might apply a detail or damage texture, for instance. But I’ve got more projects on my plate than I can handle so I’m just going to keep plowing ahead the best I can.

Comments and suggestions are very welcome, especially from people who actually know what they’re doing. I’d like to know if I’m heading down the wrong path.

Credits

Some resources that helped me out along the way:

Prototype Notes

Some notes for stuff I’ve experimented with but haven’t made “official” yet.

Initial split and shape

In top view, extrude two equal size boxes above and below initial box (select side vertices with "limit selection to visible" off, E, hold Ctrl, drag). End up with five boxes in a row, oriented vertically.

Drag vertices around to roughly fit shape of car, switching views as necessary. Actually this might be a good point to explain window splitting, set up and save a four-panel view. Show how to switch between configured views (once I figure out how to do it).

Adjust view to see front, back, and rear of car. K for loop/cut menu, knife midpoints (also experiment with loop cut, which cuts the entire model nicely), then place line segments to split all the way around the side, enter to create new edges. Drag to fit model. Do the same along the top (be careful with the bottom faces).

Wheel Wells

Make sure “limit selection to visible” is enabled for this bit. Select a column of vertices that fall in the wheel well area, and merge them (Alt+MKEY). From the bottom view (how to easy get to this view?), switch to edge mode, select and knife cut the internal edges, and then drag the vertices to the back of the well. Refine as needed.

I think I should do the wheel wells by tessellating the side panel, putting the vertices along the edge of the well, and then deleting the polys inside the well. Then select all of the edges and extrude them back into the body. I think.