Mobs X and B3D files
This subject area:
Introduction
This page is for mobs developers and world hosts. It discusses Minetest mobs models with a focus on ".x" and ".b3d" files.
You should probably look at the Mobs Development page as well.
X and B3D formats
Mob models exist in a source format, typically a ".blend" [Blender data] file, and in a published format, typically an ".x" or ".b3d" file. The source file can't be used directly in Minetest. Somebody needs to use a tool to create a published file from a model source file. The published file can then be used in Minetest.
".x" is an older ASCII format related to DirectX. The format is deprecated because it's very space inefficient. ".b3d" is a newer and preferred model format that is typically much smaller.
Where possible, these days, X published models should replaced with B3D published models.
Replacing X with B3D
Regrettably, there is no simple way to convert X to B3D that preserves animations. The best way to deal with an ".x" file is to obtain the original ".blend" source file and to create a new ".b3d" file from that.
If the ".blend" file can't be obtained, there is an alternative way to convert ".x" to ".b3d" but it's for experts:
One can convert a ".x" file to an intermediate file using -- losing the original animation -- then import that file into Blender and recreate the animation manually. After that, one can export the result to ".b3d" using joric's b3d export plugin. For Blender versions newer than 2.8, the best fork varies over time. For a list of forks and their compared progress over time, click "Insights" then "Network" of any of the root repos such as:
As of Blender 3.4, the best fork appears to be: https://github.com/Kippykip/B3DExport
To convert ".x" to an intermediate file, one can use Poikilos's fork of b3view. Press stop and set frame to 0 first.
An intermediate file means a file that can be used to make something else. In this case, it is a file without animations, generally an OBJ file. In Blender, you must import the file (Click "File", "Import", "Wavefront (OBJ)") then animate the object manually. Tutorials can be found on Poikilos' free books site: https://expertmultimedia.com or various videos and sites online.
In the case of restoring the animations of a previously-animated mob, one must proceed as follows:
- Click the "Output Properties" (printer picture button) side tab on the right. In this panel, change the following two settings:
- Change Blender's "Frame Start" setting to 1 to use the same numbering as Minetest (Lua lists start at 1, and Minetest animations start at 1)
- Change "frame rate" to the "speed" indicated in the Lua file (However, See the "Optimization" section below).
- Each of the animations (walk, run, stand, etc.) must start and end on the same keyframes found in the mob's Lua file. These keyframes in the old file (such as X file) can be visually previewed for reference by opening the old file in Poikilos' b3view fork (This fork displays the frame number and allows using arrow keys or typing to navigate to any part of the animation).
SAM Viewer
For working with player models, which are similar to mobs models, there is a more advanced viewer that can simulate Lua values for testing wield item settings and other settings:
This is by stujones11, long disappeared, and may not work. There is a Poikilos fork that is only a copy of the upstream repo for now (Feb 2020) but may be updated later.