From 3dsmax to Oblivion CS

From the Oblivion ConstructionSet Wiki
Revision as of 23:36, 27 July 2008 by imported>ShadowDancer (→‎Preparing meshes: typos)
Jump to navigation Jump to search

This tutorial aim to be very practical guide to get static models from 3dsmax 7-9 to Oblivion Construction Set (CS). It is assumed that reader is new to NIF file format, NifSkope, and Oblivion CS. However, this tutorial does not cover 3dsmax modeling techniques, just steps needed to export the model.

Some later sections of this tutorial may be useful not only for 3dsmax users.

Before you begin

1. You will need NifSkope and NifTools plugin (for your 3dsmax version).

NifSkope. When you install it, go to Render->Settings and click "Oblivion" button. That will make it autodetect Oblivion data folder, so you will see textures on your models. Also, you can adjust background color here.

NifTools plugin. Run 3dsmax at least once before installing it. Then, extract NifPlugins.dlu to Max/plugins and MaxNifTools.ini to Max/plugcfg folders. If you are using 3dsmax9, copy MaxNifTools.ini to "<drive>:\Documents and Settings\<user>\Local Settings\Application Data\Autodesk\3dsmax\9 - 32bit\enu\plugcfg".

2. Download Oblivion Mod Manager. Install it. Create new folder, something like "OblivionUnpacked". Go to Oblivion/data folder, and extract "Oblivion - *.bsa" files to "OblivionUnpacked". You do that by opening bsa file and clicking "extract all" button. You may skip "Voice" files, because for everything you would need 5,43GB disk space. Now when you are done (that will take a while), you can add "OblivionUnpacked" path to your NifScope paths list (Render->Settings->Add Folder...).

Making your model

When making a model for the first time for a game, you need to know what scale that game uses, so you get the size right. The best way would be to import some Oblivion model for side-by-side comparison.

First of all, in 3dsmax, click menu Customize->Configure User Paths..., and in "External files" tab add folder, where you unpacked oblivion data files. Then, click file->import, select "nif" file type, and browse "OblivionUnpacked\Meshes" for some mesh. You can choose some house, for example, "Meshes\Architecture\Anvil\anvilhousemc02.nif". If you did everything right, you should see that model in 3dsmax, completely textured!

You can also use such imported models to find out how they are made. For example, every mesh in them has only one texture assigned, and there is usually only one mesh with same texture.

Select all (Ctrl+A), and group it, so you can easily delete it later.

Now, make a model. There are lots of modeling tutorials everywhere, so that part will not be covered here. Use any technique you like. However, you will need "editable mesh" at the end, so optimize your model as needed for minimum polygon count, but good detail. Practice does wonders here ;). For this tutorial, I have made this simple hut:

File:Max9ToCSSmallHutPreview01.jpg

And adjusted size to look good near other oblivion models. My model has 3 meshes: walls, roof, and roof edges:

File:Max9ToCSSmallHutPreviewDivided.jpg

Every mesh has Standard material assigned, and edge mesh, additionally, has opacity map (opacity map just for seeing it in max, it is optional when exporting):

File:Max9ToCSMaterials.jpg

Exporting

Preparing meshes

So, model is textured, everything is ready for export, right? No. This is good point to make backup, in case you will want to fix some mapping coordinates or use this mesh as base for new one. So, save a copy.

Now delete any unnecessary models and objects from scene.

Now we will do the following for every mesh:

1. If your mesh is not an editable mesh, you can either assign an "editable mesh" modifier, or select one of your meshes, go to utilities menu, select Collapse->Collapse Selected.

File:Max9ToCSCollapse.jpg

This is to make your mesh an "editable mesh". You also can use collapse to group different meshes with same texture into one, so there will be smaller node tree in NifSkope later. I already did that for my model's walls.

2. Assign Reset XForm modifier. You can also find it in the Utilities panel.

File:Max9ToCSResetXForm.jpg

Always do this after any modifications to mesh. It resets pending transformations you have done to mesh. So you would not wonder looking to your model in NifSkope later "why my roof is upside down".

3. Collapse again. Now we have a clean editable mesh.

Repeat for every mesh.

When you are done, and if you don't need collision, you can select all of your meshes and go directly to "Finally, exporting" part of this tutorial.

Otherwise, read on, brave one :)

Preparing collision

For collision, make a mesh as simple as possible around your model. I am going to use 4 cubes for that and rotate them as needed. Here is my result:

File:Max9ToCSCollision.jpg

Now, if you have not done so, configure your Utilities panel to contain two additional things: NifProps and UVWRemove:

File:Max9ToCSConfigureButtonSets.jpg

1. Now, collapse your collision mesh together. If you have new NifSkope plugin version, you may use more than one collision mesh, and make them surround different materials (so you can hear stone sound when walking on stone, or dirt on dirt).

2. Reset XForm.

3. Next, click "UVWRemove", select checkbox "Set Gray", then first click "UVW" button, then "Materials".

File:Max9ToCSUVWRemove.jpg

4. And Collapse again.

5. With collision mesh still selected, click "NifProps". Select "Is Collision Mesh", and adjust other properties as needed.

File:Max9ToCSNifProps.jpg

We are going to use "Export" and not "Export Selected" when exporting with collision, so make your scene clean from anything unnecessary.

File:Max9ToCSClean.jpg

Finally, exporting

File->Export. Save as type: NIF:

File:Max9ToCSExport.jpg

Notice that i selected "textures\architecture\farmhouse" path, because i know that two of my textures are from that folder.

Fixing model in NifSkope

Fixing collision

New versions of NifSkope plugin seem to export correct collision, so you can skip this section. However, i leave this text here in case there is still some problems

Open your model with NifScope. If you see your collision in red wireframe where it should be, you did everything right.

Now, we will need to modify some nodes to make collision work (and not crash CS).

Right click root node -> Node -> Attach Extra Data -> NiStringExtraData:

File:Max9ToCSAttachExtraData.jpg

Select it, change name to UPB. Open another NifSkope, and open some other oblivion model, like door. For example, Architecture\Anvil\anvildoormc01.nif. Find NiStringExtraData node in it, copy contents from StringData parameter, and paste it to your model. It seems that no matter what contains in that parameter, it works if that model has collision:

File:Max9ToCSCopyStringData.jpg

Now, adjust the node order to be like this (root node = 0, BSXFlags = 1, NiStringExtraData = 2):

(I usually select "NiStringExtraData", use Ctrl+Up until it moves just after root node, then select root node and click Ctrl+Up few times until it becomes 0)

File:Max9ToCSOrder.jpg

Now expand bhkCollisionObject, and browse until you find bhkNiTriStripsShape. Select it, find NumDataLayers property and change it to 1.

File:Max9ToCSbhkTriStripsShape.jpg

Now right click on DataLayers -> Array -> Update

File:Max9ToCSDataLayersUpdate.jpg

Expand array and find it's first property. Change it to "Static":

File:Max9ToCSChangeToStatic.jpg

Thats all. Now it should not crash and collision should work. Some credit goes to Razorwind and his 3dsmax9 collision tutorial. You can check it out too, if you find any of my explanations not clear enough.

Fixing Texture Paths

Browse for every NiTexturingProperty and check if paths in NiSourceTexture are correct, and if not, change them.

Adding transparency

File:Max9ToCSAddingTransparency.jpg

Right click your mesh part which should be transparent, then Node -> AttachProperty -> NiAlphaProperty.

Additional info about transparency

Right click NiAlphaProperty->Flags. There are basically three ways in which transparency could be done. It depends on mesh which way it is better.

Alpha blending without testing

When transparent mesh parts in your model usually are not behind one another, this mode is best, because it produces smooth and nice edges. However, if you have some heavily transparent object (like plant), you may see sky through some of leaves instead of other leaves. That happens because it seems that this version of engine does not sort triangles before drawing them.

File:Max9ToCSAlphaBlendingWithoutTesting.jpg

Alpha blending with testing

To overcome sorting problem, you can enable alpha testing. Setup it like shown below, and adjust Threshold value until you find optimal result. Threshold means minimum required value for alpha channel to be clipped. So you get some artifacts around edges, but generally meshes are drawn correctly.

File:Max9ToCSAlphaBlendingWithTesting.jpg

Testing only

And then, if you don't like artifacts around edges, you can choose the same method oblivion trees are drawn. Only Testing:

File:Max9ToCSTestingOnly.jpg

Getting it to Oblivion

Now, when everything is ready, save our nif file, and open CS.

Open "File" menu, choose "Data". Any group of modifications to game is called plugin and saved to esp file. If you want just test your mesh, you can create temporary mod by selecting Oblivion.esm in this list and clicking OK. However, if you have existing mod, you don't need any help from me :)

In Cell View select "Tamriel" World Space, then ICWaterfront03 (you will recognize this location).

I assume your mesh already is in some Data\Meshes\Test folder (this is just example). In Object Window, expand "World Objects" -> Static, and select it. Then right click on any object, choose "New". Click "Add NIF File", and browse for your file. When you are done, you can also change ID property in editor. Click OK, and you mesh should appear under Static\Test. Then drag it to render window. Move it with left mouse button, rotate with right, move up/down with Z pressed, rotate view with shift. More information in A beginner's guide - The Construction Set Primer.

Good luck!

File:Max9ToCSsmallhut.jpg