DestinedToDie's 3D Model Import/Export Guide

From OpenMW Wiki
Jump to navigation Jump to search

Blender 2.49 tools installation

  1. Download and install Python 2.6 http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
  2. Download and install Pyffi http://sourceforge.net/projects/pyffi/files/pyffi/2.1.10/PyFFI-2.1.10.2c30444.win32.exe/download
  3. Download Blender 2.49B http://download.blender.org/release/Blender2.49b/blender-2.49b-windows.exe
  4. Download this Nifscripts zip https://github.com/niftools/blender_nif_plugin/releases/download/blender-2.5.9/blender_nif_scripts-2.5.9.77b0815.zip
  5. (Optional) Now if you want to view your nifs in Nifskope, then download and install it https://github.com/niftools/nifskope/releases/download/nifskope-1.1.3/nifskope-1.1.3.36ebfdd-windows.exe

Install.bat doesn't work for me, so this is what you need to do for a manual install. You need to find blender/.blender/scripts and dump the scripts from your zip in there. However sometimes the scripts folder is not even located in the program files Blender directory.

If it isn't in there, look for users/myusername/appdata/roaming/blender foundation/blender/.blender/scripts.

Nifskope is kind of like a limited tool that lets you view your files easily, as well as play around with /texture locations, make rectangular collision boxes, change how your mesh interacts with lights and edit the little numerical values you wouldn't normally be able to see in Blender.

Alternatively, you can use this link. http://www.nexusmods.com/oblivion/mods/40980/ I have not used it myself, but Linux/Debian users John_D and Psi29a vouch for it.


Blender NIF exporting

So first things first. You want to test it out, see if the nif exporter works. You select File->export->NetImmerse/Gamebryo (nif, kf, egm), select Morrowind as the nif version you want to export to and... get an error about map import UV something something. See this screenshot for the correct map input:

caption

When exporting, make sure that you have your mesh selected. Blender nif exporter only exports what is selected.


Blender NIF collision

If you were just introduced to Blender, don't bother with this yet. But somewhere down the line you will want to think about object collision. If a mesh has no collision, then the OpenMW engine simply generates it based on mesh polygons. However some meshes have a looooooooooooot of polygons. Colliding against 10 000 surfaces can confuse the engine and make it go slow for a bit, or even let you pass through the object. For this reason you might want to add a simplified version of the mesh from which the collision will be generated.

NPCs and Creatures currently only have 1 rectangular collision box. Rectangular collision boxes can be added in Nifskope. Here's how:

caption

As you can see, it is extremely tedious to move the rectangle around. You have to insert coordinates by hand. But what if your mesh is more complex than a rectangular collision box can represent? Then the collision model has to be done in Blender and as a separate object from the actual mesh:

Step 1
caption
Step 2
caption

When you want to export it, make sure you select BOTH the collision mesh and original mesh. Blender will only export what is selected.

Blender NIF/KF animation

I'm not going to teach you how to animate, you can learn on your own on Youtube. However I am going to let you know how the OpenMW engine interprets these animations. You see, there are things such as animation groups. Refer to the link here: http://www.preik.net/morrowind/animationgroups.html

In order for OpenMW to know from which keyframe your character starts walking, and at which he stops, you need to go into text editor, make a txt file named anim (important) and write the keyframes together with animation groups. See example here:

caption

When exporting your animated mesh, be sure to export nif+xnif+kf.

caption

Nif contains the mesh, together with animation and everything.

xnif contains the mesh, but without any animation.

kf contains the animation, but without the mesh.

Store them all in your data files/meshes.


OSG Tools installation

  1. Download and install one of the newer versions of Blender http://mirror.cs.umn.edu/blender.org/release/Blender2.76/blender-2.76b-windows64.msi
  2. Download https://github.com/OpenMW/osgexport/archive/master.zip and put the osg folder into blender foundation/blender/2.76/scripts/addons.
  3. Launch Blender and do the following:

caption

You can now export osgt files by going to file->export->osgt in Blender.


OSG Export

Just like nif, OSG export has its own quirks. First of all, it exports everything in the scene. This includes the light source. So if you have a light source that you do not want to include along with the model, delete that. I don't know if the camera is included as well, but delete it just in case it adds anything to the file size.

When exporting to osgt, you need to make sure that your blender file and image file are in the same folder, like in this screenshot:

caption

When done, a textures folder with your .tga texture will appear. Put it in your game/data files/textures folder and the osg file to game/data files/meshes.

OSG exporter works with the following image formats: BMP, IRIS, PNG, JPEG, TARGA, TARGA_RAW, AVI_JPEG, AVI_RAW, FRAMESERVER

Yes, you read that right. There is no support for .dds format yet. So how to switch to it? Start with converting the image file to .tga and replacing whatever format is used in the mesh. To do so, find the textures tab in Blender:

caption

Then switch off specular, normalmaps. For whatever reason specular makes the mesh black and normal makes it pure white, so I got rid of them. Switch the image to the .tga version of it:

caption

Now use the OSG export. You will get a meshname.osgt file. Go edit it in notepad or whatever pleases you. Lines like these must be changed to use .dds:

caption

Now save it, put it in /meshes, put your .dds image in /textures, load it up in OpenMW-CS and see if the preview looks correct:

caption


OSG collision

No idea how to do these. If anyone knows, write instructions and I'll include them here.

OSG animations

Osgt files currently do not support animations in OpenMW.


Uploading to Redmine

Make sure you're including the original files (.blend, image files, etc).

caption

It should also be apparent where the model came from if it isn't your making. If your source is stated in the issue comments, I think that's enough. The source must be CC BY 3.0 or CC0.

If you upload your own work to Redmine, you should state that you are releasing them under CC BY 3.0. This means others will be able to freely use your files without copyright trouble as long as you get attribution. You still retain copyright ownership of the files.