Difference between revisions of "From 3dsmax to Oblivion CS"
imported>Nercury m |
imported>Nercury m |
||
Line 63: | Line 63: | ||
==Exporting part 2== | ==Exporting part 2== | ||
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: | |||
[[Image:Max9ToCSCollision.jpg]] | [[Image:Max9ToCSCollision.jpg]] |
Revision as of 14:18, 30 May 2007
After collecting information pieces from different sources for a month, I decided that it is time for tutorial, so others would not waste so much time like I did :). I will try to cover everything you need to get working model from 3dsmax9 to Construction Set (CS). That includes, basic knowledge how to set up model with collision in max (I assume you can model), how to use existing Oblivion textures, how to import existing models so you can examine how they are made and use them for comparison, how to export, fixing 3dsmax9 collision in NifScope, getting transparency to work, and finally importing to CS.
Different sections of this tutorial may be useful not only for max users.
Before you begin
1. You will need NifScope and NifTools plugin (for your max version).
NifScope. 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 and Nif plugin 0.2.10, copy MaxNifTools.ini to "<drive>:\Documents and Settings\<user>\Local Settings\Application Data\Autodesk\3dsmax\9 - 32bit\enu\plugcfg".
2. Download Oblivion Mod Manager (http://timeslip.chorrol.com/obmm_download.html). 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
First time I was making a model, I had a question: what size does it need to be? Well, it's easy to find out! First of all, in max, click menu Customize->Configure User Paths..., and in "External files" tab add "OblivionUnpacked" folder. Then, click file->import, select "nif" file type, and browse "OblivionUnpacked\Meshes" for some mesh for comparison. I usually choose some house, for example, "Meshes\Architecture\Anvil\anvilhousemc02.nif". Import. If you did everything right, you should see that model in 3dsmax, completely textured!
Now you can see how Oblivion model looks like and how to make it. Every mesh in it has only one texture assigned, and there usually is 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 I won't cover that part. 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):
Exporting part 1
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 following for every mesh:
1. If your mesh is not editable mesh, you can either asign "editable mesh" modifier, or select one of your meshes, go to utilities meniu, select Collapse->Collapse Selected.
This is to make your mesh "editable mesh". You also can use collapse to group different meshes with same texture into one, so there will be smaller node tree in NifScope later. I already did that for my model's walls.
2. Assign Reset XForm modifier. You can also find it in Utilities panel.
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 NifScope later "why my roof is upside down".
3. Collapse again. Now we have clean editable mesh.
Repeat for every mesh.
When you are done, and you don't need collision, you can select all you meshes and go directly to "Finally, exporting" part of this tutorial.
Otherwise, read on, brave one :)
Exporting part 2
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:
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. Nif exporter can export only one collision mesh for model.
2. Reset XForm.
3. Next, click "UVWRemove", select checkbox "Set Gray", then first click "UVW" button, then "Materials".
4. And Collapse again.
5. With collision mesh still selected, click "NifProps". Select "Is Collision Mesh", and adjust other properties as needed.
We are going to use "Export" and not "Export Selected" when exporting with collision, so make your scene clean from anything unnecessary.
Finally, exporting
File->Export. Save as type: NIF:
Notice that i selected "textures\architecture\farmhouse" path, because i know that two of my textures are from that folder.
Fixing collision in NifScope (skip this if you exported without it)
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 NifScope, 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 is fine if 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)
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. A lot of credits goes to Razorwind and his 3dsmax9 (http://www.silgrad.com/wbb2/thread.php?threadid=6977) 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. Also, Node -> AttachProperty -> VertexColorProperty. Select NiVertexColorProperty, and change these settings:
Flags: 40 VertexMode: VERT_MODE_SRC_AMB_DIF LightingMode: LIGHT_MODE_EMI_AMB_DIF
Done.
Now, some explanation.
Right click NiAlphaProperty->Flags. There are basically three ways in which transparency could be done. It depends on mesh which way is better.
Alpha blending without testing
When transparent mesh parts in your model do not usually are behind one another, this mode is best, because it produce 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 bellow, 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:
Now, when everything is ready, save our nif file, and load it in CS. I hope it does not crash for you. Good luck :)