Exporting World Data in Wavefront OBJ Format

mikeprimm edited this page Mar 8, 2014 · 1 revision
Clone this wiki locally

As of v1.9.3, Dynmap has incorporated support for generating and exporting externally renderable files in Wavefront OBJ format. This feature, inspired by the standalone jmc-2-obj tool, allows operators within the server (or, optionally, from the server console) to select and export portions of their world data as model files that can then be imported into various tools that support Wavefront OBJ format - including Blender (a free, open source rendering and animation suite), Cinema 4D, Maya, 3D Studio Max, and others. These exported models can be render, using these packages, in ways that Dynmap does not support (including advanced lighting, reflections, and the like). As the OBJ output produced by Dynmap is very similar to that which mcobj or jmc-2-obj would produce, guides and wikis for importing and processing output from these tools are likely to be useful for Dynmap OBJ output.

The definition and execution of the export process is controlled using the new /dynmapexp command. This command allows setting of a number of attributes controlling the export:

  • x0, y0, z0 : these are the minimum X, Y, and Z coordinates of the cuboid/rectangular prism to be exported
  • x1, y1, z1 : these are the maximum X, Y, and Z coordinates of the cuboid/rectangular prism to be exported
  • world : this is the name of the world to be exported from
  • byChunk : if set to true, this causes the generation of an object for all the blocks in a given chunk
  • byBlockID : if set to true, this causes the generation of an object for all the blocks of a given block ID
  • byBlockIDData : if set to true, this causes the generation of an object for all the blocks of a given block ID and metadata value
  • byTexture : if set to true, this causes the generation of an object for all the block faces using a given texture
  • shader : This specifies the shader to be used as a source for the textures for the export. By default, 'stdtexture' is used. Only Texture Pack based shaders are currently supported.

The subcommands for the /dynmapexp command include:

  • /dynmapexp set : this allows setting of the export attributes (above). Additional and pairs can be specified on the same command (e.g. /dynmapexp set x0 0 y0 0 z0 100)
  • /dynmapexp radius : this command can only be used by a player in-game: it allows specifying of an export on the current world, with a radius of from the player's current position (in the X and Z axes), and from Y=0 to Y=255 vertically.
  • /dynmapexp info : displays the current values of the export attributes
  • /dynmapexp pos0 : this command can only be used by a player in-game: it sets the x0, y0, z0, and world attributes to the current position of the player.
  • /dynmapexp pos1 : this command can only be used by a player in-game: it sets the x1, y1, z1, and world attributes to the current position of the player.
  • /dynmapexp reset : resets the export attributes to their default
  • /dynmapexp export : this initiates an export, creating a file named .zip in the export directory on the server (this defaults to a directory named 'export' under the dynmap directory, but can be changed using the 'exportpath' setting in configuration.txt). This process runs asynchronously, and can take from a few seconds to many minutes to complete, depending upon the size of the area selected for export.
  • /dynmapexp purge : this deletes an previous export from from the export directory.

Once completed, an exported ZIP file will contain the following:

  • A minecraft.obj file, containing the exported model (this can potentially be VERY big)
  • A .mtl file, containing the material library (corresponding to the minecraft textures) used for coloring the model in minecraft.obj
  • A directory, containing the texture files used by the material library

To use the file, extract the ZIP file and load the 'minecraft.obj' file into the rendering tool.