Blender/Chair

From NifTools
Jump to: navigation, search

In this page we will create a very simple Blender model and export it to a NIF file. Here and there you will find some more advanced remarks that do not apply if you simply apply this tutorial, but which could apply if you create your own more advanced models. They are indented and indicated by italics.

Contents

The Basics

Creating a Mesh

Morrowind chairs have their seating level between 3 and 5 Blender units from the ground. That gives you a rough idea about the scale in Blender. Let's make a dwarf chair. Start with making a 3x3x0.25 cube for the seating, add a 3x3x3 cone below it to support the seating, and add a 0.25x3x3 cube as a back support. You should have something looking like this.

Make sure all face normals are pointing to the outside of your model. This is a very common pitfall, and the result of bad face normals is that some faces of your exported NIF file won't show up in the game. You can check the direction of the face normals by making Blender draw normals in edit mode: toggle the "Draw Normals" button under the "Mesh Tools 1" tab; the blue lines are the face normals. You can automatically recalculate the normals of the selected faces by pressing CTRL-N in edit mode. You can also flip face normals of the selected faces by pressing the "Flip Normals" button under the "Mesh Tools" tab.

Applying Materials and Textures

Now, let's apply texture to this fancy chair. First, make sure every mesh has a material applied to it. Next, make sure that every material has a texture, with texture type 'Image', texture map input 'UV', and texture map output 'COL'. Load textures from the "c:\mwbsa\textures" folder. I selected "C:\mwbsa\textures\tx_bamboo00.tga", and I applied the same material to all three of the meshes to save myself some work.

Observe that tiny little button next to the "Reload" button in the Image tab. If you click this button, the texture will be embedded in the NIF file. This is not recommended, as it is rather memory consuming not to share textures over different NIF files. Also, enabling this will drastically enlarge your file size, because textures are not compressed when included in a NIF file. But, anyhow, if you want to embed your textures, you can do it.

Another thing to be aware of, especially when you work on imported NIF files, is that the textures you see in the 3D view are not the one that are exported. The texture in the 3D view is only there to let you see the current texture you may be working on. In general, however, a material can have multiple textures, such as one for specularity, one for emit, one for normal mapping, one for colors, one for alpha, etc. You need ot make sure the image you load into the realtime view, and the image you apply as a base texture, are the same. (thanks to NeOmega for this explanation)

mwtut_chair01a.png

mwtut_chair01b.png

mwtut_chair01c.png

mwtut_chair01d.png

Making UV maps

NIF files only supports UV mapped textures: we must tell which points of the texture are mapped onto which vertices of the chair. Select a mesh, split the main window, go to UV face select mode in one window, and bring up the UV image editor in the other window. Make sure you have all mesh faces selected in the UV face select window. screenshot

Method 1: Cube Projection

For cubes, this method works very well. Simply run the following script from the Unwrap menu: go to edit mode, select all vertices (Blender < 2.45: go to UV face select mode), and press U in the 3d view. Select "Cube Projection" and a UV map is created.

Method 2: Smart Projections

Again, you can simply run this script from the Unwrap menu. Do the same as above, but now select "Unwrap (smart projections)" to create the UV map. This script usually works like charm, but if it doesn't you can use the following method.

Method 3: Seams

This method is well explained in this tutorial.

After unwrapping, the result should be something like this.

Now do the same for the other two meshes: screenshot, screenshot.

That's it! You have created a simple textured chair.

Press F12 to get a render.

Export to a NIF file

To export our model to a NIF file, select all three meshes that make up the chair, and run the NIF export script from the File->Export menu.

Save your NIF file in the right place for your game to find it. For Morrowind, this should be somewhere in Morrowind's "Data Files\meshes" folder.

Now you probably want to import your chair into your game: Morrowind/Import chair.

Creating Custom Textures

If you want to create a custom texture, the "save UV face layout" Script is a useful tool. Be sure to select texture width and height that are a power of two. For Civilization IV, the texture size is limited to 256x256, anything larger will result in texture mapping errors; but Morrowind should be able to handle larger textures if you really want to (no upper limit has been reported so far). Save your texture somewhere in Morrowind's "Data Files\Textures" folder (NOT in "c:\mwbsa\textures").

screenshot

Hit the export button, and open up your texture with a 2D paint program, such as the GIMP, or paintbrush. Once you have painted your texture, don't forget to load your new texture in Blender.

Tuning Material/Shader Parameters

The following material parameters are exported (between brackets are typical values):

  • Ambient, through "Amb" scrollbar (1.0)
  • Diffuse colour, through "Col" scrollbar (1.0 1.0 1.0)
  • Specular colour through "Spe" scrollbar (0.0 0.0 0.0)
  • Emission, through "Emit" scrollbar (0.0)
  • Shininess, through the "Spec" scrollbar (0.0) and the "Hard(ness)" scrollbar (50). Note that specularity is ignored in Morrowind.
  • Transparency, through "A(lpha)" scrollbar (1.0), the "Map To Alpha" button, the "Var" slider, and the "Use Alpha" button - either set A to 1.0 for non-transparent materials, or set to 0.0 for transparent meshes and use the "Var" slider to control the overall transparency of the texture. Also enable "Use Alpha" in the texture buttons (F6) to tell Blender to use the alpha channel of the texture.
mwtut_chair02e.png

Smoothing

Solid and Smooth faces

You can change smoothing of faces in edit mode under the editing tab (F9). Select faces, and use the "set smooth" and "set solid" buttons to change their look. You can also use the "Autosmooth" button, for quick results.

Emulating Smoothing Groups

Unlike 3DS Max, Blender uses per face smoothing instead of smoothing groups. Sadly so, because smoothing groups give you finer control over seams. Fortunately, there's a simple way to emulate smoothing groups, giving you more control over the seams.

Go to Edit Mode. For this method to work perfectly, you should first select all vertices (press A once or twice), remove doubles (press Rem Doubles under Mesh Tools), and enable smoothing on all faces (press Set Smooth under links and materials). screenshot

Still in Edit Mode, make sure you are in "Face select mode", and select the faces you want to form part of a grouping. Then "Split" them by pressing "Y" in edit mode. Repeat for each smoothing group you need (each side of a sword blade for instance).

You can find more explanation and screenshots here.

Subsurfacing

Subsurfacing will make your model smoother by adding polygons; you can use the crease function (Shift-E) to change the smoothing radius on selected edges.

Collision

For Oblivion, you need to hull your model in collision objects for the physics to work.

Personal tools