Blender/Custom Sword

From the Oblivion ConstructionSet Wiki
(Redirected from Custom Sword in Blender)
Jump to navigation Jump to search

This is a very detailed tutorial showing you how to create a simple sword from the ground up in Blender. It’s quite involved, so anyone who feels they can make it more readable is welcome to edit. That’s what wikis are for. :)

Important Preliminaries: Necessary Tools[edit | edit source]

You will need:

Optional:

  • A graphics editor like the GIMP or Photoshop. This tutorial won’t cover making a custom texture, just tell you how to get one onto the mesh.

Useful Blender Shortcuts[edit | edit source]

This is intended as a reference for the entire tutorial, so you can refer back to it as needed.

  • r: rotates the mesh from whatever direction you are viewing it. Use carefully or the results are very odd.
  • s: scale the entire mesh up or down by dragging the mouse up or down. Also drags the mesh out of alignment with the axes, especially z, so you’ll want to move it around afterwards.
  • ALT-s: shrink or fatten along normals; this may not mean anything to you, but it's actually what you wanted when you chose “s” nine times out of ten.
  • r followed by x, y, or z: rotates the selected mesh or vertices on the x, y or z axis.
  • s followed by x, y, or z: scales the mesh along an axis.
 If you scale a mesh along an axis in Blender, then you need to apply scale and rotation
 (CTRL-A) afterwards because the NIF format does not support non-uniform scaling.
  • g followed by x, y, or z: grab and move selected a mesh or vertices on x, y, or z axis. Again, you can do this without x, y, or z, but you often won't end up with the position you want.
  • z: when used in edit mode, makes every vertex visible and the faces transparent. Very useful for selecting hidden vertices from any given angle.
  • b: a crosshair appears that you can click and drag to create a rectangular selection box.
  • b followed by b: a circle appears that you can scale up or down by rolling the mouse wheel to create a selection area.
  • Mouse wheel: hold down and drag to "roll around" the screen and look at the mesh from different angles. Hold down shift/wheel and drag right or left to move right or left only. Scroll mouse wheel up or down to zoom in and out.
  • Tab: switch between modes. If you're back and forth between Object and Edit a lot, which you will be, this can be useful.
  • w followed by 2 or 3: Used in UV screen. These very useful commands let you snap a row of vertices into a straight line on x or y.
  • numpad 7: Moves the camera to a top position, aligned to the x and y axis.
  • numpad 1: Moves the camera to a front position, aligned to the x and z axis.
  • numpad 3: Moves the camera to a side position, aligned to the y and z axis.


Creating your Sword[edit | edit source]

Choosing your Collision Capsules[edit | edit source]

Blender can import and export collisions at the present time, but it's not within the scope of this tutorial. Take a look at Blender/Custom_Collision if you are interested. I recommend that for this beginner tutorial, you find a sword from the existing game that is close to the shape you want. Don't worry if the size is a little off. Things are easy to resize in Blender and in NifSkope. I recommend you start with a one-handed sword such as the Elven longsword. Claymores and shortswords mostly differ in how you treat them in the Construction Set, which will be our last step.

Import this mesh into Blender. You can do this by clicking File > Import > NetImmerse/Gamebryo. Locate the NIF file and press the import .nif button. Then click on the Advanced button and set the scale correction to 10 (default). If your meshes seem too big or small when exported, this is the setting you change. Go back and click on Import.

Now you're looking at a sword mesh. See how it’s lying flat on the "ground" of the gray Blender interface? Don't move it. It has to be right there for the game to place it properly in characters’ hands.

Starting Out in Blender[edit | edit source]

Here comes the fun part. If your version of Blender has a little cube appear when you open the program, delete that first by selecting the cube and pressing delete or x and click Yes in the menu prompt.

I would suggest creating the new sword in the same plane as the default game one, just off to one side. Then you will be able to slide it into position using the g command later. I will refer to this game mesh as the “reference sword” from here on out.

There are a few different ways to do this. One of the easiest is with extrusion. For that to happen, you’ll need something to extrude from, so I suggest adding an icosphere for the pommel:

 Add > Mesh > Icosphere

or

 press space > Add Mesh > Icosphere

Media:UVSPHERE1.jpg

Let’s say two iterations. Seems huge now, doesn’t it? You can scale it down to the right size now, or just create a giant sword and scale the whole thing down later. Either way, things will be easier if you align it to the axes first. Media:UVSPHERE2.jpg You want one endpoint of the sphere to be facing the same direction as the reference sword’s point is facing, along the Y axis. Use the z-key and a bounding circle (press b twice) to select the whole Icosphere, or for a faster method press a. Rotate the sphere by pressing r. Pressing r followed by x will let you rotate on the X axis, r and y on the Y axis, and r and z on the Z axis.

You can hold the mouse wheel (yes, the wheel) down and drag back and forth to rotate the camera and look at the mesh from different angles, or use can use the number keys on the numpad (NOT the ones above the keyboard letters).

Note about Blender: Blender has menus now, but the keyboard shortcuts are still far faster and easier to use when you’re making new meshes on the fly. See the earlier section of the tutorial for a list of most-used shortcuts, to which I will be referring throughout this section.

The Handle (Extrusion)[edit | edit source]

Now, where was I? Yes, extrusion. You should now have the sphere lined up so that it had a middle top vertex facing the same direction as the blade of the reference sword. Enter Edit Mode by pressing Tab, select and delete that vertex (delete or x). See the hole? This is how wide your sword’s hilt or handle will be. If it seems too narrow, select and delete the row immediately around it, too. Then select the row that surrounds the hole. Bounding box may not work well here, so you can use right click to select one vertex and then hold shift and go on clicking to select more vertices.

Once you have the vertices selected, press e to extrude and select "edges only". Now drag the mouse upwards and watch as new faces appear, following your mouse pointer. You can extrude on just one axis by pressing e and then pressing x, z, or in this case y. This will make your handle nice and straight. Notice that you can use s to make the ring of new vertices bigger or smaller, too. When you have them at the size and length you want for your first segment, click the left mouse button to set them in place.

This is a good time to remind you that extruded faces sometimes have messed-up normals, so you should go down to the buttons window and click "draw normals". All the normals (the pointy things) should face outwards. If they don’t, you need to select the face with the bad normal by clicking all four of its vertices and then click "flip normals" in the buttons window. Make sure you only select the faulty faces, or your entire sword will be affected. I usually only turn the normals on for checking up, otherwise they clutter up the view too much.

Okay, now you have something that looks like a badminton birdie. Select the topmost ring of vertices again and extrude it. Keep this up until you have a multi-segmented handle. Try to make the middle segments wider than the end ones (use s to scale the ring of vertices). When your handle is the length you want it to be (again, compare the reference sword for this), you’re ready to create the guard part of your sword.

The Guard (Subdivision, Merging, and Pushing/Pulling)[edit | edit source]

Our first sword here will look more like the Chillrend mesh, which doesn’t have big pointy guard segments, though I’ll tell you how to add those. Accordingly, you want to select your last ring of handle vertices and then click “subdivide” down in the buttons window. Whoa! The number of vertices doubled. This will help your guard section look more round and less faceted. Extrude it upwards a little and examine the results. You can repeat this as many times as you like to get a hemispherical guard section, or subdivide again to get more vertices if you still think it looks too angular.

Remember, the more vertices you create, the more you’ll have to merge in the end. When you get to the top of the guard, you’ll need to merge some of the vertices so your sword’s blade will only have four vertices. You can do this by selecting two or more vertices you want to merge and pressing alt+m then selecting center. Do this until there are just four vertices in a rough diamond shape.

Now, about this guard section. There’s another reason why we want it to have more vertices: that makes it a lot more flexible as to its shape. For example, if you want spikes all the way around, you can select alternating vertices in one row and then scale them outwards until they’re as pointy as you want them. If you want two pointy guard pieces like the steel longsword has, you can select two vertices on opposite sides and pull those out. Experiment with selecting and g and the axis and see what you can come up with. You can also select just the vertices in your guard section and use s followed by z to make it flatter. This works with any part of the mesh, and you can use it to make your pommel more coin-shaped (like the Elven sword’s) and less round if you like.

The Blade (Extrusion and Merging)[edit | edit source]

When you’re ready to do this part, it’s easy. Just select the four vertices of the diamond at the top of your guard section (remember those?) and extrude upward. I recommend doing it through two or three separate extrusions, but not more than that, because you want a smoother length of steel (or mithril or whatever) here. Keep narrowing the shape as you go upward, and then merge the four vertices (again, select, alt+m) into one at the top to make a point.

You can use more vertices and different scaling to create different blade shapes, too, but I’m not going into that here. Just consider the possibilities, and I hope you find them as much fun as I do.

Preparing for a Texture[edit | edit source]

The UV Map[edit | edit source]

Now you need to use the UV window, so divide your 3D view area into two. You can do this by holding the mouse cursor over the line between the 3d window and the buttons window and right-clicking, then selecting "Split Area". Move your mouse until the line is roughly in the middle of the 3D View and press the left mouse button. You now have two 3D View area's. Click the little button in the left bottom corner of right 3D View and then select "UV Image Editor". You should now see a blank grid, because we haven’t changed the main screen to UV Select mode yet!

In the left 3D View click on the button that says "Edit Mode" and select "UV Face Select" (UV Face Select mode doesn't exist in blender 2.46, just stay in edit mode). Press a once or twice to select everything. Your mesh should now look like it’s covered with pink facets and the UV Image area should display a blue triangle. If some of the face on your mesh look transparent, the normals are facing the wrong way. You need to go back to Edit Mode and fix them per the previous section’s remarks.

  • Edit: In version 2.49b UV Face Select has been merged with Edit Mode, select all with a, then press u to unwrap.

Copout or "Every Other Modeling Tutorial in Existence" Method[edit | edit source]

But if that’s not a problem, you’re ready to unwrap. Click on "UVs" in the UV Image Editor buttons, then select "unwrap".

Yikes! Odds are that you’ve got a very bizarre-looking thing in the UV Editor window now. This is what happens when the computer unwraps all those pink facets into two dimensions. Vertices and faces can be selected and moved in the UV Editor just like in the main window, but they’ll only affect the UV map and they only move in two dimensions. I suggest moving the vertices around so that the faces of the sword’s blade are together and don’t overlap anything. This will make texturing easier. Eventually you’ll want a UV map where all the faces are lined up and connected only where the real faces are connected, but that’s a lot of clicking and dragging.

You can leave it this way (if the sword will be all one color, which seems unlikely), you can try to move the faces around until they make sense, or you can do the following.

First, press ctrl+z to undo the crazy map.

The UV Map: Slightly Harder But Actually Working Method[edit | edit source]

You can tell which face is on which part of the UV Map by pressing a in the main window to deselect all the faces, then clicking just one face to make it turn pink. That face will now appear by itself in the UV window. Since it's not unwrapped, it will look like just a plain blue square. Try selecting just one row of the faces on just the blade (remember, hold down shift and click to select more than one face). Then press u (keep your cursor in the UV Select area!) and select "unwrap" from the UV menu prompt. Now just those faces appear on the UV map screen. Select them all - you can select vertices on the UV screen just like on the main screen - and move them off to one side. Now repeat with the row RIGHT NEXT TO THOSE.

Select both of those rows. See? They should come close to lining up on the UV screen. Drag the vertices around until they do. You want them touching vertex to vertex, because otherwise there will be odd overlaps in the texture. Ideally you want them to be rectangular, because texturing will be easier that way. That's why the UV screen has a nice grid on it. You can move vertices in just X or just Y on the UV screen by selecting them and pressing g followed by x or y.

Do this with all of the rows in the blade part of your sword. You didn't know it, but using extrusion made this part much easier, because more of the faces are the same size. See? I tell you these things for a reason. ;)

Now, this is a part where it can actually be useful to add an image in Blender. Next to the UV menu there is a dropdown that says "Image." Click that and choose "open". Here is where you open a random .jpeg image (it can't be a .dds) from anywhere on your computer. It doesn't matter what, because it's only in Blender and won't be on the final product. Once you've opened that, exit UV mode, and enter 3D view mode. Go to the little square up above that shows a solid little cube with odd things sticking off it. Clicking that will bring up a list that says things like "solid", "wireframe", "textured", etc. Click on "textured". (Alternately, you can press ALT+Z) Now your random JPEG shows up on the blade, but only the blade, because that's what you've UV mapped so far. Make sure the image is continuous and doesn't seem to jump around from face to face. If it does, you have something next to the wrong thing and you need to move faces around and fix it.

If not, you're home free and you can move on to UV map the hilt. This won't be as easy, but it's still much easier than if we hadn't used extrusion. This part won't need to be square, but it will need to be the shape of whatever texture you eventually plan to put on it. If you want to, you could select the reference sword and look at it under UV face select to get a vague idea of one way to arrange this. To select the reference sword you first need to go back to Object Mode.

 Using w followed by 2 or 3 lets you make a set of vertices into a straight line on the UV map.
 (If you use one and get a bizarre wad of vertices, press ctrl+z and use the other one instead.)
 I can't even tell you how useful this can be.

Remember: it's possible to drag parts of the UV map off the grid in the UV screen. This can be useful while you're actually mapping, but everything has to fit back onto that grid in the end. This means you might have to shrink and move things around. That's why the textures in the actual game look so odd - they're from UV maps. If you want, you might look at a game texture of a sword in GIMP or another image program to see how Bethesda did their mapping. If you want exactly the same part of a texture on two or more parts of the mesh, you can actually lay those parts of the UV map right over one another (they'll need to line up vertex for vertex, so don't forget those w, 2 and w, 3 commands). Bethesda did this with blades and hilts quite a lot. It's why their textures usually seem to have only half a hilt on them.

Once your UV map is done, go to UV-save UV face layout (in 2.49b it's UV->scripts->save UV face layout). A screen will pop up that allows you to choose the directory in which to save a .tga of the UV map. It doesn't matter where you put it, as long as you can find it later. I always put mine in textures. They're not hard to locate, since the names are generally rather odd-looking. This is what you'll use to make a new texture that will actually fit your new mesh.

(In the new blender the "UV-Save UV face Layout" from above is now UVs > Scripts > Save UV Face Layout)

Helpful warning: Occasionally in Blender I've seen a glitch wherein Blender outputs a blank .tga file with nothing in it instead of the real UV map. If that happens, keep trying. Sometimes you'll need to change the name of your object (from "sphere" or whatever the default name was in Blender down in the edit screen). Sometimes this will also happen if you try to change the strange name Blender gives the UV map before you save it.

To rename objects, see: http://wiki.blender.org/index.php/Doc:Tutorials/Game_Engine/BSoD/Basics_of_the_Blender_UI

Good job! I know that seemed time-consuming, but you'll thank me when you have to make the texture. Trust me on this. There is nothing more frustrating than to make a working mesh that looks lovely in Blender and discover you can only make it look hideous in-game.

You can now close the UV/Image Editor area, you do this by right-clicking on the line between the UV/Image Editor area and the 3D View area and choosing "Join Area's". Make sure the arrow points into the UV/Image Editor area.

Material and Texture[edit | edit source]

Now it’s time to go back into Edit Mode. Click the little circle at the top of the buttons window or press F5. This takes you to the materials screen. Go to the Materials screen by clicking a similar but red circle on the buttons that appeared on the left side. Click "Add New" in the buttons window then click the little rectangular button that says "TexFace".

Now look up where the red circle button was. There should be a button next to it with a little stripey square on it. Click that to go to the texture screen. You may need to click "Add New" to add a new texture. Just make sure you select "Image" from the dropdown menu, then click "load image" on the right. This is a nice feature – you can load your custom texture right from Blender and export with it attached. If you don’t have a texture yet, any old texture file will do. We just need to assign one so that Blender will know the mesh has that property.

Eep! Your texture doesn’t appear on your mesh! Why is that? It's because Blender doesn't support DDS files. You can assign one just for Blender to view through the UV screen if you set the view textured, but it has to be a JPEG and it won’t go on the final mesh at all. In any case, don’t panic. The texture you loaded is there. You just can’t see it.

Go back to the Materials screen by clicking the red circle again. Off to the right you should see a series of tabs, including one that says "Map Input", and when you click on it you will see some buttons saying "UV", "Orco", etc. Make sure "UV" is the one that is checked.

Creating Collision[edit | edit source]

You will need to create a collision mesh for your weapon. One way to do this, is to select your mesh and then click on the grid icon on the options bar (near "view", "select", and "Object"), and click on the "Scripts Window" icon. Then, go to Scripts>>Mesh>>Hull and select "convex", then hit ok. This, however, is a very easy and basic way, and may not create the ideal collision for your weapon. For other methods and information on creating collision, see Blender/Custom_Collision.

Exporting your Mesh[edit | edit source]

Huzzah! We’re ready to export.

But FIRST, make sure your sword is in the right position. Move it over the reference sword so that they overlap, then select the reference sword and delete it. Save. You may also need to select your sword and click ctrl+a to apply scale and rotation. Select your blade and its collision. Now go to File > Export > NetImmerse/Gamebryo, click "Oblivion" as the game, and click "Weapon" under settings. Save your sword’s NIF into the Data\Meshes\Weapons folder.

During NIF export, make sure that scale correction is set to the same value you used during import (which is 10 in this tutorial).

If you later need to make changes to your sword, you can do some small changes with NifSkope.

Optional NifSkope Alchemy[edit | edit source]

Adding/Changing a Texture[edit | edit source]

It’s easiest to do this from Blender and export the mesh with the texture on it, but if that doesn’t look right or etcetera, you can add a different texture in NifSkope.

I'm not going to tell you how to make a texture from scratch here, but once you have one, you've only got to type the texture path into the top of the texture node in NifSkope next to the little flower symbol. It will usually look something like data\textures\weapons\mynewsword.dds. You can also click the icon and browse to your texture. This tells NifSkope where your texture is. For now I'll leave it that the texture must be a .dds file and it must have a normal map, which is called something like mynewshield_n.dds. Also make sure your texture path starts with data and not C:\Program Files\Bethesda Softworks\Oblivion\Data, remove everything before Data.

 Important warning: make sure the slashes in the texture name lean backwards, like this: \ and
 not forwards like this: / or the game will refuse to recognize the texture. NifSkope will
 sometimes try to change this around on you. 

Adding a Scabbard[edit | edit source]

If you also modeled and exported a scabbard (make sure you positioned it right!) open the scabbard NIF file. If your reference sword contains a scabbard rightclick the NiTriStrips of your new scabbard and choose Block > Copy Branch. Go back to the window with the new sword and find the NiTriStrips of the reference scabbard and rightclick > Block > Remove Branch. Add your own scabbard by rightclicking the NiNode block of the scabbard, called Scb and choosing Block > Paste Branch.

If the reference sword did not contain a scabbard, you need to find another reference sword with a scabbard. Open the new reference sword and find the NiNode called Scb; rightclick > Block > Copy Branch. Go back to the window with your new sword and rightclick the NiNode called Longsword, choose Block > Paste Branch. Now follow the instructions above to replace the scabbard with your new one.

Getting the Sword Into the Game[edit | edit source]

Creating a new Sword in the Construction Set[edit | edit source]

Double click on the Construction Set icon on your desktop to load up the CS. If you don't have this icon on your desktop, I urge you to put it there right now. Now wait for it to load. This may take a while, and there will be very few items on the screen. That's because we haven't loaded any data files.

Go to File > Data... in the top menu. You should see a list of all the mods on your computer here. If you don't have any, it'll probably just show oblivion.esm. Click on that so that a little "X" appears next to it and then click "OK."

Now wait for THAT to load. You may want to twiddle your thumbs or go get a beverage or light some candles here, to pass the time.

Eventually it will finish loading and you can see everything that is present in the game. Exciting, isn't it? Find the Object Window, which has a list that says "Actors", "Items", etc. Click on Items to expand it, then click on Weapons.

Now you see a list of all the weapon sets in the game. You can click on one set, say "Glass" or "Daedric", in the left-hand pane and it will show you all the pieces in just that set in the right-hand one.

Choose a sword that has the kind of stats you want. Glass and Daedric are very popular because they are the best light and heavy armor in the game. Remember, if this is a one-handed sword, you need to choose one that is also one-handed as a template. Don't choose one that says "arena" anywhere in the ID, because those have scripts on them that you don't want to mess with. Double click the sword of your choice to bring up its information. Click on the name of the NIF (e.g. glass/longsword.nif). A little window will pop up with the data directory in it. Click through until you find your own new sword mesh. Click on that and click "OK". Your sword mesh name should now appear in the window.

You'll need to do the same with a new icon, which you can learn to make here: Creating Transparent Icons

Now this part is very important. You need to change the ID of the new sword, not just the name. The ID is above the name and looks something like "WeaponGlassLongsword" or "GlasShield". You must change this to a new ID such as "Mynewsword," or you will replace every glass sword in the game with yours. Be sure and give it a unique name, too, so that everyone knows what an amazing sword you've made.

When that is done, click OK. You'll get a message asking if you want to create a new ID. ALWAYS SAY YES.

Adding the Sword to Tamriel[edit | edit source]

Now your sword will appear in the Weapons list. It will be listed alphabetically by its ID, although you can change the sorting method by clicking the headings of the list. Now you can drop it into the inventory of a merchant, into your house, or into the street of a random city. You do this by dragging the sword from the Object Window into the container, NPC or Render Window. Go to File > Save in the main CS menu and give your mod a name. Close the CS. This might take a while.

Now you can playtest. Be sure and check your mod by name in the Data Files list on the Oblivion start menu before you start playing.

Have fun.