Go to file
random-geek b8a53fa65b materials.py: Only modify selected object(s), various code maintenance
See issue #9
2021-12-30 22:11:57 -08:00
.github/workflows Add GitHub workflow and LuaCheck (#5) 2020-09-05 18:39:34 -07:00
locale Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
textures Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
.luacheckrc Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
LICENSE Initial commit 2019-06-27 21:53:58 -07:00
README.md Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
export.lua Various plantlike fixes 2021-08-08 23:22:25 -07:00
init.lua Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
materials.py materials.py: Only modify selected object(s), various code maintenance 2021-12-30 22:11:57 -08:00
mesh.lua Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00
mod.conf Fix misspelled "description" 2020-09-30 23:21:47 -07:00
nodebox.lua Add numerous features, refactor extensively 2021-07-05 01:05:06 -07:00
parse_obj.lua Add numerous features, refactor extensively 2021-07-05 01:05:06 -07:00
screenshot.png Add everything 2019-06-27 21:56:35 -07:00
utils.lua Improve area selection, add translation support. 2021-07-14 12:18:06 -07:00

README.md

Meshport (Minetest Mesh Exporter)

Build status ContentDB License

screenshot

Meshport is a mod which allows easy exporting of scenes from Minetest to .obj files, complete with materials and textures. These models can be imported directly into Blender or another 3D program for rendering and animation.

This mod is still in the beta phase; certain texturing features and node drawtypes are not yet supported.

Usage

Only players with the meshport privilege are allowed to select areas and export meshes. This privilege is granted to singleplayer/admin players by default.

To export a mesh, first select the area you want to export. There are two ways to do this:

  • Use the Meshport Area Selector tool. Left- or right-click on a node or object to select either corner of the area. Hold sneak while clicking a node to select the node in front of the face you clicked on.
  • Or, use the /mesh1 and /mesh2 commands to set either corner. You can specify a position (e.g. /mesh1 -24 0 24) or leave the argument blank to use your current position (e.g. /mesh1).

After selecting an area, use /meshport [filename] to export the mesh (filename is optional).

The /meshrst command can be used to clear the current selection.

Folders containing exported meshes, including .obj and .mtl files, are saved in the meshport folder of the world directory.

Importing into Blender

Once the model is exported, you can import the .obj file into Blender with default settings. Make sure "Image Search" in the import settings is selected to ensure textures from the .mtl file are imported as well.

Fixing materials

Upon importing the file, Blender assigns basic materials to the model which are inaccurate and not very usable. By default, these materials appear blurry and lack transparency. The materials.py script is included in the mod to fix these issues. Open the script in Blender's text editor and run the script with the mesh selected.

Meshport does not handle texture modifiers or node coloring, so some materials will probably still need to be fixed by hand after running the script.

Other fixes

Some mesh nodes may not have any vertex normals, which can lead to lighting problems. To fix this, what I have found to work is to select the all the problematic nodes (either manually or by selecting by material in edit mode), mark the selected edges as sharp, and average the normals by face area.

Some animated textures may also appear incorrect. Meshport tries to scale texture coordinates of animated textures to fit within one frame, but some nodes (especially flowing liquids) can exceed this boundary. If this is an issue, switch to a non-animated texture and scale up the affected UV maps to match the new texture.

Additional tip: Use an HDRI sky texture (such as one from here) for awesome-looking renders. ;)

Supported features

The following node drawtypes are currently supported:

  • Cubic drawtypes, including normal, allfaces, glasslike, and their variants (see below)
  • glasslike_framed
  • liquid and flowingliquid
  • nodebox
  • mesh (only .obj meshes are exported)
  • plantlike and plantlike_rooted

Meshport also supports many of Minetest's relevant features, including:

  • Most paramtype2s (note that color is ignored for colored types)
  • visual_scale
  • World-aligned textures
  • Animated textures (only one frame is used)

Some special rendering features are unsupported, including texture modifiers, overlay textures, and node coloring.

Notes on cubic nodes

Drawtypes allfaces_optional and glasslike_framed_optional are output the same as allfaces and glasslike, respectively.

Due to the differences between Minetest's rendering engine and 3D programs such as Blender, it is impossible to exactly replicate how certain cubic nodes are rendered in Minetest. Instead, Meshport aims for a compromise between accuracy and simplicity of geometry. In certain cases where two cubic nodes are touching, one face may be offset slightly to avoid duplicate faces while still allowing both faces to be visible.

License

Textures are licensed under CC BY 4.0. Everything else (including source code) is licensed under the GNU LGPL v3.0.