Native Mesh Format: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
(Created page with "Previously, NIF files were the only way to get models into the game. Unfortunately, the NIF format is proprietary, bloated, and the available exporters are not in a great shap...")
 
(Switched to friendlier redirect)
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Previously, NIF files were the only way to get models into the game. Unfortunately, the NIF format is proprietary, bloated, and the available exporters are not in a great shape. For example, the Blender NIF exporter currently only works with the very old Blender 2.4.
Our Native Mesh Format guide has moved to our official documentation on [https://openmw.readthedocs.io/en/latest/reference/modding/texture-modding/native-mesh-format.html ReadTheDocs]
 
Starting with OpenMW commit e62470d674, we can utilize the OSG native model format. This article will explain how to export a model from Blender to OSG format and then load it into OpenMW.
 
= Prerequisites =
 
* OpenMW commit e62470d67411c665231162959c764c27f4f19e2e or later
* Blender 2.6x (any version of 2.6 should work)
* A blender model you would like to export
 
= Install the exporter =
 
* Download the osg export script: https://github.com/scrawl/osgexport/blob/release/blender-2.5/build/osgexport-0.14.2.zip
* Open Blender and go to ''File -> User Preferences''
* Select ''Addons -> Install from File'', then select the downloaded .zip
* Enter "osg" into the search bar, then tick the checkbox next to the addon
* Now click ''Save user setting'' so the exporter stays enabled when you re-start Blender
 
You can now export your model using the ''OSG model (osgt)'' entry in the ''File -> Export'' menu.
 
= Putting the model in-game =
 
Place the exported model in the ''Meshes'' sub-folder of a data folder recognized by the game, e.g. the Morrowind ''Data Files'' folder, or the local data folder ($HOME/.local/share/openmw/data on Linux). Place all required textures in the Textures sub-folder. Now start OpenMW-CS, create a new addon file and you should see your mesh in the ''Assets -> Meshes'' table. Go ahead and make some object use your mesh. You can now preview by right clicking on the object -> Preview to see what the mesh will look like.
 
<gallery>
File:Buddha_opencs.png|Model preview in OpenMW-CS
File:Buddha_openmw.png|Model in-game
</gallery>
 
= Converting the model to binary =
 
When the model behaves to our liking, we can think about converting it from the "osgt" text format to the "osgb" binary format so that it's smaller in size - and thus faster to load.
 
To do this, simply invoke the osgconv tool. This tool should be included with your distribution of OpensceneGraph.
 
<pre>
osgconv model.osgt model.osgb
</pre>
 
Of course, you can convert the binary model back to text format as well:
<pre>
osgconv model.osgb model.osgt
</pre>
 
= Conclusion =
 
These are the basics of getting a textured, static model from Blender into the game. In the future, we will want a way to add bump maps, texture animations, skeletal animations, separate collision shapes, and some other features that are currently only available via NIF files. We will likely add these features to the native OSG format after OpenMW 1.0.

Latest revision as of 02:09, 20 July 2018

Our Native Mesh Format guide has moved to our official documentation on ReadTheDocs