Buildpics in Blender

This guide makes the same basic assumptions as the Texturing tutorial, namely that you're familiar with Blender's interface, and that you have the TA textures in Targa (.TGA) format (if not you can download them here (539K)).

The Background

The first thing we will need is a background, otherwise the buildpic will look a little dull. I use Terragen for making backgrounds, but you can use whatever you want. Here's some I made earlier (feel free to use these if you want):

The thing to notice with the 'ground' backbufs is the camera angle - the pitch is at about 20-30° from horizontal, which results in a pic without a lot of sky in it. The backbuf should be very basic, so it does not stand out too much - the idea is to represent the unit, not your background-making skills, after all.

Also remember that the image must be in a format that Blender understands - JPEG or Targa. Blender does NOT understand .BMP files, and besides Targa is better anyway because it supports the use of an Alpha channel, which is handy for transparent textures.

Scene Setup
Now that we have a background, we can load it into Blender. This is done by going to the Render buttons - - and typing in the filename of the backbuf image in the 'backbuf' box (just to the left of the big 'RENDER' button). You can also click on the the little buttons next to the text box to browse for the image. The grey 'Backbuf' button enables or disables use of the background image.

The next step is to set the size of the renders, using the 'SizeX' and 'SizeY' numeric buttons (to the right of 'ANIM'). The render size should be set to the same dimensions as those of the backbuf, otherwise Blender will stretch the backbuf to fit the render, which looks ugly. Shadow casting must also be enabled.

The next thing we need is some light. A common mistake for people new to Blender is to add some objects to a scene, render it, and wonder why the image is totally black. To get the model to look as if it's part of the background, rather than stuck on top of it, we will need 3 lights:

A Spot light: This light will be used to cast shadows, and nothing else, so enable the 'OnlyShadow' option on the Lamp buttons. Because the only lights that can cast shadows in Blender are spotlights, using one with 'OnlyShadow' allows us to use other lights for illumination while still making them look as if they're casting shadows.

The spotlight's 'Bias' setting should be set to 1, and it's 'ClipSta' and 'ClipEnd' setting should be enough so that the line coming from the light in the 3D view covers the whole scene. As you may have guessed, these settings control the light's clipping - if an object is closer than the 'ClipSta' value it won't be lit by that lamp. The same idea applies to 'ClipEnd'.

2 Hemi lights: Hemi lights are, as you may have guessed, hemisphere lights. In other words they illuminate the scene as if there was a giant hemisphere of light around it, the base pointing in the direction of the Hemi light. Perhaps this image may explain things better:

Now, the first Hemi light will be used to simulate the illumination from the sky, sort of like 'ambient' light. This lamp should be coloured slightly blue, and its Energy should be set to around 0.3. The lamp should normally be pointing straight down (since the sky is directly above), but there's nothing wrong with having it point in a different direction if it makes the rendered image look better.

Remember, setting up a 3D scene is like setting up a scene in a studio or on a film set, so don't set things up to copy nature, set them up to produce the right effect. Also, although not really necessary, you should also get into the habit of giving objects in your Blender scenes names. If you want a better explanation of Blender's object orientated approach, take a look at my Objects tutorial.

The other Hemi light will be the Sun. I know Blender has a lamp type called 'Sun', but Hemi lights produce a brighter and more realistic image. The 'Sun' Hemi light should be coloured a very pale yellow, and its Energy should be about 1.3. The direction of this light is important, as it is the main source of illumination in the scene - you should try to get it so it matches the light direction visible in the background image. Take a look at these examples:

The one on the left is wrong because the light in the background looks like it's coming from the right, while the object is lit from the left.

The last thing we will need is a plane, something for the unit's shadow to be cast on. The plane only needs to be big enough to cover the area where the shadow will appear, so for example the scene for the images above looks like this (the lights have been hidden):

Next, we need to give the plane a new material and set this to 'OnlyShadow'. This means the plane is not actually visible, but the shadows cast on to it are, which saves us from having to give the plane a texture and adjust the lights so it blends well with the background. Now, because we have set 'OnlyShadow', any shadows cast on the plane will be 100% intensity regardless of the amount of background illumination and so on. The way around this is simple: adjust the plane material's transparency (the 'Alpha' property). In the scenes above the Alpha is set to 0.6, but you should adjust it so the shadows are of a similar intensity to those in the background image.

To change the camera's field of view, select it and open the Edit Buttons. The 'Lens' property changes the field of view - to convert 'Lens' to field of view, use this formula:
fov = 360 * arctan(16/lens) / pi

Notice also that the camera has 'ClipSta' and 'ClipEnd' properties. These set the clipping range of the camera - ClipSta changes how close objects can be to the camera before they disappear, and ClipEnd changes how far away they are before they disappear.

Importing the Unit Model

For this tutorial, we are going to use the Core Air Repair Pad (CORASP), simply because it's a nice simple model

You will also need a copy of 3DO Builder, so you can see the name of the texure a particular face is using, and so you can export the unit model as a .DXF file which Blender can open. If you have HPI View (which you should anyway) you can open totala1.hpi and extract the CORASP.3DO file yourself; if not, download it here (5.1K).

After exporting the model as a .DXF in 3DO Builder, go to Blender and press F1 to display the Open File window. Find the CORASP.DXF file (it won't have a little yellow square next to it, but don't worry) and open it.

The first thing you will notice is that the model is both too big and at a funny angle. In addition the model is back to front, although this is not so important for symmetrical units like the repair pad.

Rotate and scale the model until it is in the right place, then press Tab to go into Edit Mode, then press A to select all vertices. 3DO Builder's export function is not very efficient - it creates 4 separate vertices for each face, rather than sharing them between faces. This is not just ineficient, it makes selecting specific faces very difficult, so to fix it we will use Blender's Remove Doubles function. This simply finds vertices that are within a certain distance of each other and 'fuses' them together into a single vertex.
The Remove Doubles button is on the Edit Buttons page - . Make sure the mesh is in Edit Mode, and that all vertices are selected, then click the button. Alternatively, you can press W then select the Remove Doubles option from the Specials menu.

Texturing

Now that we have the unit model imported and ready, it's time to start texturing it.

This is quite a time-consuming part of the process, because there is no automated way to get a textured TA object into Blender (unless somebody who knows Python fancies writing one?).

Now then, on to actually texturing the model...
First, you should split the view into 2 parts, like this:

The left-hand pane has been set to show the UV texture editor - move the cursor into the pane and press Shift+F10 to set it like this. Now in the right pane, press Alt+Z to switch to textured view. At the moment the model will simply turn black (or magenta or white), because it has no textures.

When the model is newly imported, it will have a single material, called 'Grey'.
Now, there are two ways to give objects textures in Blender - by assigning lots of materials to a mesh and linking each material to a texture, or we can tell Blender to use the UV texture editor settings as texture information. This is the method we'll be using, because it is a great deal faster and easier to implement.

To tell Blender to use the UV texture info, enable the purple 'TexFace' button, under the material colour sliders:

Now to actually start assigning textures to faces. First off, drag the bar under the menu down a bit, and you should see something like this:

Notice the Textures text button - this sets the default directory Blender looks in when you open a file selection box to pick a texture. Setting this now saves having to go through the directory structure each time you want to choose a new texture.
Once this is set, drag the bar up again. Select the mesh (if it isn't already selected), and press F to put it in Face Select mode. The mesh will turn white and each face will have a dotted outline, showing it's selected. Press U and choose Standard 1/1 to set the default UV mapping mode so that the texture for each face is stretched to the shape of the face.

Because it's a bit hard to see individual faces when the mesh is plain white, it's a good idea to set every face to use the same texture to start with. In the UV Editor pane, click the thin grey button next to the orange 'Load' button, and choose a texture. It should now be easier to identify separate faces on the model.

In case you were wondering, the orange 'Load' button can be used to load the texture, but it displays a file selection dialog with thumbnails of each image, and it takes a long time to generate ~500 thumbnails. Plus, you're already going to know what the texture is called, so the thumbnails are unnecessary.

Now switch to 3DO Builder, and look at the name of the texture assigned to selected face:

Using the right mouse button, select the same face in Blender, and again click the small grey button next to 'Load' in the UV Editor. Either scroll down the list to choose the texture, or just type in the filename (not forgetting the extension).
If the UV Editor pane is too narrow, you can scroll the toolbar by dragging it with the middle mouse button.

All you need to do now is repeat the above process for each face on the model, although there are a few things to know that might help:

- You don't actually need to texture EVERY face, only the ones that will be visible in the final render.
- To reduce confusion, you can hide selected faces by pressing H. To unhide faces, press Alt+H, and to hide all faces except the selected ones, press Shift+H.
- Exiting and re-entering Face Select Mode will re-show all faces.
- To reduce clutter, I strongly recommend you make use of layers. To move something to a new layer, select it, press M, select the layer you want to move it to, and click OK (or press Enter). To quickly jump to a layer, press the number key associated with that layer. Note that you can hold Shift while pressing the number to toggle the layer's visibility. A good use of layers is to put all lights and the ground plane on layer 2, leaving the camera and the model on layer 1.

Another thing to note is that when you want to assign a texture you've already used, you only need to select it from the dropdown list in the UV Editor pane, rather than loading it again.

Texture Rotation
Once you have textured the top faces of the repair pad, you may end up with something like this:

This is easy to fix. Making sure the model is in Face Select mode, select the 4 pad top faces. Select all the vertices by pressing A, then press R to begin rotating them. Rotate the faces by 180°, holding Ctrl to snap to 5 degree increments.
You may notice that after rotation the vertices in the UV Editor window are slightly mis-aligned. To fix this, press S and scale the vertices so they lie a little outside the texture image, then click the Clip UV Textures button:

Finishing Up

Once you have finished texturing the unit, tweaking the lighting and generally making it look right, it's time to save the render. I suggest you render the image at 256×256, then save it in Targa format, which is non-lossy (unlike JPEG). Press F3 to save the rendered image. I have written a Photoshop action which will automatically convert any square image into a 64x64, 256-colour pic complete with '3D effect' borders. Here's an example of an input and output image:

Download the Action here.

Well, that's the end of the tutorial - hopefully it's enough to get you started! If you have any questions, e-mail me at the address below.

Main Page | Tutorials
e-mail: caer@planetannihilation.com.