Oblivion Cube Tutorial

Another Insanely Long SickleYield Tutorial 

(As requested by Exanimis from CI.  A primer in creating static/clutter objects with notes on texture creation. )

Introduction

 This is a detailed tutorial that teaches how to create a very simple clutter object for Oblivion, in this case just the plain old Blender cube.  It has information that can be used to adapt it to the making of statics as well as a detailed section on texturing with the GIMP and setting up in the CS with an icon.  This is exaggeratedly detailed and simple, assuming almost nothing about the reader's abilities.  For this reason it is quite long.  Once learned, the process can be used to make statics as well as the world objects for Oblivion's armors.

 Necessary Tools

You will need Blender 2.48a or later.

  NifSkope and the NIF export scripts for Blender can be found here.

I've used the GIMP for texturing, in this case with a Resynthesize plugin.  The instructions here may be a little off for some plugins as there are more than one.

And of course you will need the Oblivion Construction Set and the game TES 4: Oblivion itself.

Part I: Modeling, Mapping and Collision In Blender

First of all, start up your copy of Blender.  Now we're looking at the usual gray cube.  If you've changed the default page setting for your copy of Blender, take a moment to create a simple cube or add it from the list of available primitives.  Try not to make it much bigger than one or two Blender units per side.


First we'll duplicate the cube to create our collision mesh.  Select your cube by right-clicking it.  Press the z key to toggle wireframe mode on and shift+d to duplicate.  I've scaled the duplicate bigger than the mesh for just a second so you can see it; from now on it will be basically the same size and therefore almost invisible.

 

Select this duplicate cube and look down at the edit buttons.  Click the one that looks like three black arrows joined at their origin.  You should see the Drawtype button set near the middle, to the left of the Constraints button.  Set the drawtype to Bounds.  This is always what we'll use when creating a collision mesh.  Now choose the dropdown next to that and select box, because our mesh is a box.  If you are making collision for a sphere or a complex shape, choose sphere or polygon instead.  Always make sure the wire button to the right of these is pressed.  

 This next picture has arrows pointing to the three things you  need to do.

 

That is all it takes to create a collision mesh, bar some export settings we'll get to later.  If you have a very complex mesh, or a hi-poly one, you can duplicate it and run mesh--scripts--poly reducer on it to get a nice lo-poly collision mesh.

Now we're ready to create the UV map.  With a few meshes you can just press ctrl+u and get a good result, but that is seldom going to happen.  Most often you will need to use seams.  This part will seem very simplistic because we're using a cube; it becomes much more useful with complex shapes.

Press tab or use the dropdown to switch to edit mode.  Select two vertices of the cube and press ctrl+e.  A little dialogue appears.  Choose Mark Seam.

The line between the two vertices turns orange, indicating there is now a seam there.  This tells Blender to break the mesh along this line when unwrapping to create the UV map.   Adding some more seams eventually gives us this.

You will probably have to do some trial and error with this part, but it's worth your time.  A good UV map makes the mesh easy to texture, while a bad one makes it impossible.  When I unwrap using my final set of seams, the cube's UV map looks like what you see in the lower left corner.

(I always create a dedicated UV screen by splitting the buttons window.  Right click and choose "split," then click the button in the corner of the window and choose "UV Face Layout.")

This UV does not look like a cube, but it is nice and flat.  It will hold a texture very well.  The fewer curved edges a UV map has, the easier it will be to texture.  This is more difficult with things like character bodies that have lots of organic curves to them, but that is for another day.

Now we need to assign a material and texture for proper export.  If we already had a texture done, we could assign that, but I want to do the texturing with my mesh in NifSkope so I'm going to choose a random one.  Click the shiny sphere that marks the materials button.  Eventually you should get this screen.

Make sure the area that third arrow is pointing at has UV selected and not ORCO.  The NIF scripts will refuse to export otherwise.

Now click on the leopard-print square to the right of the shiny sphere.  This gives us the texture screen.  In the texture dropdown choose image.

Other options appear.  Go all the way to the right and choose "load."  Navigate to a random texture from your Oblivion/Data/Textures directory.  This one is from a plant.

This may not seem the most efficient way, but it is.  Leaving Blender open while we run a memory-intensive program like the GIMP to make our texture is a much bigger drain on system resources than just having NifSkope open.  This may not be an issue for those with more than 2GB RAM, of course.

Go back to object mode.  Select both the cube AND the nearly-invisible collision mesh.  Press ctrl+a and choose the first option as shown.

We need to do this before export from Blender or it may refuse (this is what you haven't done if you get an "apply translations" error message).  Now we're ready to choose File--Export--Netimmerse/Gamebryo.  If you do not have that option visible, you probably have not installed the NIF scripts correctly.

Choose a path and a name for your file.  This one of mine will go in Oblivion/Data/Meshes/Cubetest and be called cube.nif.

Once you decide on that, this screen will appear.

Make sure you have pressed the "Oblivion" button as on the lower left.  I normally turn off smooth inter-object seams but otherwise leave the settings alone for statics.  For Blender to export our chosen collision mesh as a static, we would need to click the Static button indicated above.  Notice the circled BSX flags are set to 2 now, indicating the mesh has collision but not Havok physics.   I've chosen glass because our cube will have a glassy look when done.

If I did that, my work would be done except for placing the cube in the Construction Set.  Because I want to show you how to set up an icon as well, I'm going to click "Clutter" instead.  Once again I'll make sure glass is selected. 

Notice that the BSX flags (circled above) are now set to 3, meaning the mesh now has collision AND physics. We also have some options as far as exactly how those physics go, but at the moment I'm leaving it at default settings of weight=10 lbs. and so on.  If you find the collision mesh too jumpy in game, you may go back and set this number higher.  It's important that you know this because this information can be used to create the placer objects for armors as well as the clutter object we're making.

With the right settings in place, click OK.  Export should only take a few seconds since we're exporting only eight vertices.

Now it's time to do some work with NifSkope and the GIMP.

Part II: NifSkope Properties and UV Export

Find your exported mesh in your Oblivion/meshes folder - mine is meshes/cubetest/cube.nif - and double-click to open it with NifSkope.  This should happen automatically if the program is properly installed.

 

Now you can see the cube with the random floral texture I put on it.  You will know at once if your collision mesh exported properly, because you will see the BSX flags at the top of the list in the Block screen and the BhkCollisionObject right under it.  The NiTriStrips represents your ordinary textured mesh, here called Cube.

If you don't see the collision mesh, make sure Draw Havok is turned on.

Now a faint purple tracery appears on my cube, with one line for each edge of the collision mesh.  Now we know it is both present and displaying properly.

We will need a UV template to start our texture from.  I find this method easier to use than Blender UV export.  Right-click on your nitristrips and choose texture--export UV.

This will give you a dialogue where you may choose a place to save your UV template and how large you want it to be (the default is 512x512, which I'll be using for this tutorial).  Mine is saved to Data/textures/cubetest as cubeUV.tga.

Now we're ready to create a texture.

Texturing From a UV With the GIMP 

Next I will start up the GIMP and open this file.  It should look like a black-on-white version of the UV we created.

This next part is very important because it is so fundamental to working with GIMP.  It will be necessary in almost every texture project, especially the more detailed.  We're going to work with layers.

Click on Layer in the header bar and choose New Layer.

Now we need a layers dialogue.  If one didn't automatically appear when you started the GIMP, you can get one by going to Dialogues and choosing Create New Dock, followed by Layers, Channels and Paths.  Click the Layers tab on the dock that pops up.

In the above image you see the layers dock to the right of the image.  It shows the original image layer with the UV in it plus the new one that we just created with whatever name you chose to give it.  The little pattern of squares is because the new layer is currently empty.  We are going to fill it.

At this point I've decided I want my cube to be glassy.  I'm going to use a texture of lapis lazuli that I got from CGTextures or somewhere like it as a source pic.  Always check your licenses and permissions before using a picture you didn't take yourself for this purpose.

I will leave my UV with its new layer open and open the lapis texture next to it.  It's already a square, so I'll choose Select and All.  

Pressing ctrl+c copies it to my clipboard.  Then I will go back and click the empty layer of my UV file and press ctrl+v to paste it in.

Now all I see is a corner of the pasted layer, because it's too big for the texture.  I will choose Layer--Scale Layer as above and size it to 119x119.  This may make it seem to disappear.  If that happens, press alt+e+t and ctrl+v to cut and paste it in again, which will re-center it.

I want it to be 119x119 because that's the size of one square on my cube's UV.  You can find dimensions like this by using the rectangular select.  Press R and drag the rectangle around the area you want to measure.  The lower left of the GIMP's screen will show the dimensions of the selection.

Now I have a nice tiny square floating in the midst of my empty texture layer.

If I look at the layers dock now, it will show this as a "floating layer."  This means we can still drag it around and edit it before permanently anchoring it to the layer.  If you click on the above pic you will see that I can't actually drag THIS square.  Over on the left in the main GIMP screen you can see three little symbols, and the red square in the center is selected.  If you get to this point and can't move your floating layer, click on the selecting to the far left instead.

Now I want to make our little square seamless. This will eliminate a visible crease at each edge where the UV breaks.  This is very important for those interested in creating walls, ground textures, or other things that need a texture to be seamless so it can be tiled without ugly visual marks where edges meet.

In this case, I will do it using the Resynthesize script.  This is under Filters--Map--Resynthesize if you have correctly installed the plugin.

A dialogue will pop up with options for the Resynthesize script.  Notice that it lets you choose whether you want the selection to be seamless horizontally, vertically, or both.  In this case we want both.  If we had a very detailed wall texture with bricks, we might choose horizontally only in order to preserve as much detail as possible (the script is not kind to fine designs).

For now just click OK.  Here's the result, which you can see is a little different from the way the lapis looked previously.

I've dragged it into the middle of the cube UV where I want it to stay.  Another time I would be more careful to have it go past the edges a little on all sides to avoid texture bleeding (you'll know what I mean when your texture shows blanks at the edges ingame).

Now I will press ctrl+c to copy this resynthesized square and ctrl+h to anchor it in place.  Now I can paste and anchor as many copies as I need to cover the shape of my UV.  The result is not perfectly seamless but it's not bad.

Now is a good time to SAVE THE FILE AS AN .XCF.  This will preserve all the layers in case GIMP crashes on us, which it has been known to do at random.  Notice that the top layer in the layers dock has a dark bar around it, indicating it is selected.  Otherwise we would have just pasted all those square into the UV directly, which we do not want to do right now.

Now let's make this translucent like glass.  Press ctrl+e to bring up the eraser tool.  The main GIMP screen that's usually hidden behind our texture work-in-progress lets you change the opacity and the scale of the eraser.  I'm setting mine to erase about 45% right now.

Now I'm going to use this partial eraser on my glass layer I made with the lapis to make it partly transparent.  When I'm done, I can see through it to the UV beneath:

Click on the UV layer below in the layers dock to select it.  Click the little eye symbol to its left to make it invisible, so we can see what the glass looks like without the UV beneath.  Make sure to select the glass layer again because we're still working on it.

Now it is partially transparent, allowing the gray squares of the background to show through.

Now, just because I can, I'm going to add a decorate border.  I'll do this on yet another layer, so these are still separate for editing if I want to change the colors later or something else.  I can create a layer through the Layer menu again or by clicking the little white piece of paper on the left lower corner of the Layers dock.

Make sure this layer is at the top of the stack.  There are small green arrows in the layers dock for this.

Now select the glass layer again.  This is a very useful selection  method for making borders.
  Press the Z key to bring up the  magic wand and click in the empty space outside the glass.  It should immediately select the whole area.  Now go to the Select menu and Invert Selection.  This gives us a perfect selection of our glass area where normally that would be very difficult given its different colors.

Leave this selection alone and select the empty topmost layer in the Layers dialogue again.  Choose Edit--Fill With Foreground color and watch the selection fill with black.

The black area will blot out the whole of the glass texture as it currently is.  We can shrink the selection and delete the middle part to create a border instead.  To do this choose Select--Shrink.   A dialogue will come up asking how much to shrink the selection by; I arbitrarily choose 15.

 Now it should look like this, with the selection inside the edges of the black area.

Press the delete key on your keyboard to delete this middle section, and voila - we have a black border.  The glass layer beneath is now visible.

I manually drew in some more lines with the paint tool (P key, also can be recolored and resized like the eraser) so that more edges of the cube will have borders.  Then I selected the whole black border area using Z key again.  (If you do not have magic wand mapped to Z, you can choose it manually from the main GIMP screen.  You can see it below on the second row, second from right.)

With this selected, I press L to bring up the Gradient Fill tool.  I select the Shaped--Angular
option and put a check in the box to reverse the gradient (as above), then click inside my selection and drag sideways.

Here is what I get.

I want this to look a little more like rugged metal, so I'll add some noise.  This is under Filters--Noise.  There are several types; I'm choosing RGB in this case.

This will make it much easier for you to add a rough and real look to cloth, metal, and other surfaces that would normally have some static to them.  It unfortunately tends to add color as well.  That can be got rid of using Tools--Color Tools--Hue/Saturation/Value.  In my particular case, I just chose to drag the saturation far left to make it gray again.  If you need to recolor after doing this, you can get nice strong colors using Tools--Color Tools--Colorize.  Experiment with the sliders.

You can add as many layers as you want, with as many kinds of details, colors, different source pics, and variable transparencies as you like.  (Investigate the layer modes on the dock for some mindblowing effects as well.)  Save your image file often and don't be afraid to use the undo (ctrl+z) as much as you need to.  The bigger and more detailed your file, the more likely GIMP will crash randomly and inconveniently.

In this case I'm going to stop here.  When you're ready for your texture to become merged and final, press ctrl+m to merge layers.  I use the following options from the dialogue that comes up.  (Notice the result of noise+desaturation on my metal.)

Your image has now gone from multiple layers to just one merged one.  DO NOT SAVE THE .XCF.  You will lose all your work and not be able to go back and change anything.  Instead, save as a .dds file.  Mine will be called cube.dds and be in that same textures/cubetest file.  Here are the settings I use.  The mipmaps are necessary for distant viewing; without compression they will not show up properly (nor will transparency).

To function in Oblivion the mesh needs a normal map.  I won't go into that here; instead I recommend this part of my large CS Wiki GIMP tutorial.  Suffice to say it should be in the same folder.  Mine is named cube_n.dds.

Now we're ready to set up our new texture in NifSkope. 

Part III: The NifSkope Texture and Alpha Property

View the mesh again in NifSkope.  Under the nitristrips it has a node called nitexturingproperty, and under that is one called nisourcetexture.  Click the purple daisy and navigate to your new .dds texture file.  It should immediately show up on the mesh in NifSkope.

Notice that the texture does not look transparent now.  This is because the mesh is not set up to support it.  We must add an alpha property.  Right click and choose Block--Insert.

A large list will appear.  Chose NiAlphaProperty.  The new node will appear in your .nif file, but has no effect on your mesh yet.  You must copy and paste it directly into the  nitristrips for its effect to appear.

Looking closely, you can see where the texture edges don't quite match up at the seams of the UV.  Enlarging the texture slightly would fix this, but I haven't done it for this tutorial.  Just be aware that it is fixable.

Save the .nif with the new texture path and alpha property and close it.  It is now ready for the Construction Set.

Part IV: The Construction Set and the Icon

Load the TES:IV Construction Set and choose Oblivion.esm in the data files list.  It may take some minutes to load.

When it does, click on the Object window to bring it forward.  Look for the Items tab and MiscItem tab under that.  To the right you will see a list of clutter objects from the game.

You can choose basically anything here as a base for our item, since we're going to create a new reference.  This time, choose ClothBolt01 by double-clicking on it.  A dialogue pops up.  This next part is very important.  CHANGE THE ID AND THE NAME BOTH.  I've changed the ID to AACubeTest and the Name to Test Cube.  If I forgot to change the ID, all the cloth bolts in the game would be replaced by the cube.

Now click on the button that currently says clutter/ClothBolt01.NIF.  This is the path to the mesh.  You can now navigate to the location of your new, textured, havoked .nif and select it.  It will appear on this button in place of the cloth bolt's path.  Now choose OK.  When the following comes up, ALWAYS CHOOSE YES to create a new form instead of replacing the existing one.


The AACubeTest item should now appear in the MiscItem list.

Our cube is now functional in Oblivion, but we still need to create an icon for it so it won't look like a cloth bolt in the Player's inventory (as a clutter object, it can be picked up).  This would not be needed for a static, which cannot be put into a Player's inventory.

Save this as a new .esp by choosing File--Save As.  Mine is called cubetest.esp.  Leave the CS open and open up the GIMP and  your new .nif again one more time.

You can draw the icon from scratch if you're very good.  It must be 64x64 pixels on a transparent background.  I am not a good painter, so I use this method instead.

Open the .nif of your new mesh and move the view until you can see the whole cube in the viewport.  Press the Print Screen key on your keyboard (it probably says Prt Scr).  Nothing will appear to happen, but a screen capture has been added to your clipboard.  Close the .nif.  We are done with it.

In the GIMP choose File--New.  We need the new empty file to get to the menu items we want.  In this case it's Edit--Paste as--New Image.

The screencap you took will appear as a new image.  Press R to create a rectangular selection.  Hold down ctrl and drag around the image of cube to get a perfect square selection with just the cube in it.  

Then choose Image--Crop to Selection.

If all goes well you will get something like this.  You do not want any bits of viewport or desktop showing, just the cube and whatever your NifSkope background color is.

Press Z to bring up magic wand (or use the GIMP main menu screen again to do that) and click on the background around the cube.  It should be all selected very easily.  (It helps that I chose a hideous orange color that is not on the cube normally, so it doesn't merge with the edges.  If I had used dark gray there would be a problem.  You can change NifSkope background color under the Render settings.)  Press delete to delete the background color.  

 Transparency should be left.  We need this because this icon will be seen against the colored backdrop of the inventory screen, and we don't want an obvious big square border around it.  (The red is my GIMP desktop and not part of the picture.)

Now use the Image--Scale Image command to reduce this to 64x64 pixels.  It must be exactly this size to be used as an icon.

Your icon is now ready to save.  Icons normally go in textures/menus/icons.  Mine is in textures/menus/icons/cubetest and is called cube.dds.  To accommodate those using texture size set to medium or small, you can also save an icon in textures/menus50/icons and so on if you wish.

Do not use the mipmaps option with icons when saving; it will be no problem in game, but the CS will give an error.

Now go back to the CS and open the new mesh again.  This time click the LOWER button and navigate to your new icon.  It should now show up like this.

Press OK and save the .esp again, just in case.

The cube is now ready to go but is not in the game anywhere.  Just for purposes of testing, I am going to drop this one into the Anvil Fighter's Guild.   I leave the object window and click on the Cell view.  Interiors should be the first tab automatically, but if not be sure and select it.  The cell I want has the ID AnvilFightersGuild and is relatively early in the alphabetical listing.

Double-click and wait for the cell to load.  On the right you will see a list of items in the cell.  Clicking on them will zoom the render view in toward them, which is a good thing.

Once the cell is loaded, click the render window to bring it forward.  It should show a still picture of the interior of the Anvil Fighters Guild.  Move around inside it by using the mouse, wheel, ctrl, alt, and shift.  To get close to an object or person, double-click him, her or it and press T for instant overhead view.  Expect lags depending on your system specs.

Once you have found a suitable spot, bring up the Object window next to the Render window.  Drag and drop your new mesh into the render screen and it should appear.

There's my cube!

If the CS crashes at this point, I'm afraid it is probably due to a problem with your collision mesh and you may need to redo export.  Otherwise, save your .esp again and prepare to playtest.

Part V: The Playtest

Now I will load up a character, make sure I have the cubetest.esp selected in Data Files or Wrye Bash or OBMM (if you use a program to organize saves etc.), and start Oblivion.  To get to the Fighters Guild instantly, press the ~ key and type coc "anvilfightersguild" and press enter, then ~ again.  

And there's my cube again in the Guild.  Notice that it shows up in the HUD with the name I gave it, not the ID.  

 It shows the weight, value, and whether or not I can pick it up without it being considered theft.  Also notice the cube fell off the chest I left it on, a good sign that the Havok is working.

Now pick up the item and look at the inventory screen.  It should show up under the  "Misc" tab with your icon beside it, as it does here.

Drop the item again and test its Havok by grabbing it with the Z key 0r a telekinesis spell.  It should swing freely through the air when grabbed, not hang rigidly in place or fall through the floor.  If either of those happens, there is a problem with the collision export and it must be redone.

 

When dropped it should bounce slightly depending on its weight.  Since we chose "glass" for the item on export, it should make a glassy clinking noise when it hits the floor.

If we had made and placed a static object it would be quite similar, except that it would be under the Static tab in the CS, would need no icon, and could not be picked up or moved in game.  In that case you could test collisions by running into or over the item with a character and checking whether or not they pass through it.

 And that's it.  Happy modding.