converting 3D models for building in minecraft using [binvox] and [viewvox]
(if you're looking for a free 3D model converter, try meshconv)
Introductionbinvox and viewvox can be of help when trying to build a voxelized version of a 3D mesh in minecraft.
Executables are available for Linux (32 and 64 bit), Mac OS X (Snow Leopard), and Windows.
Do send me screenshots of the models you have built!
Click on the image on the right to see the gallery in the picasa web album binvox/viewvox for minecraft.
Note to Linux users: I assume you're familiar with the commandline :-) (but do send me a note if something is unclear)
ProcessAssume we have a 3D model like the one at the top left, in a file mug.wrl.
Step 1: voxelize itRun:
./binvox -d 32 -c mug.wrl
which will create a file mug.binvox.
View the result with viewvox:
In viewvox, the x axis is red, the y axis green, and the z
Some models (like this one) use the z axis as the up axis, whereas viewvox
uses the y axis. You can fix this by passing -rotx parameter to binvox,
which makes it rotate the object by 90 degrees counter-clockwise around the x axis,
effectively changing the up axis from z to y:
If your model has no thin features, you can skip this section.
If the model has thin features that are lost in the voxelization, you may want to voxelize
at a higher resolution and downsample:
If the model has features with zero width (e.g. a single triangle/quad/etc.), you could use
both the -aw option ("add wireframe"), which also renders the model in wireframe
(only when carving), which does render zero width triangles seen from the side, and
-dc ("dilated carving"), which doesn't carve away as much (the carving stops one
voxel before the intersection), for example:
How to voxelize only part of the model
Suppose you have a model of a gargoyle, and you want to voxelize just the head:
You can see from the axes in the image that this means we need to limit the voxelization in the z direction.
You can crop the rendering of binvox with the -bb parameter, noting that your model will always be in the
unit cube (i.e. the cube from (0, 0, 0) to (1, 1, 1)).
Examine the whole voxel model (voxelized with binvox -d 64 -cb)
to estimate approximately where you need to crop:
The bottom image shows the voxel model from the top (press y in viewvox
to get the view straight from the top, and possibly p to switch to an orthographic projection).
You can see the head ends approximately 25 voxels from the left. 25/64 is about 0.4, to we'll limit voxelization
to 0.4 in the z direction:
Note: because the exact voxelization method (select with -e) doesn't use OpenGL, the -bb parameter has no effect. Also, you may have to experiment with using the voting method only (select with -v) for example, because cropping a model is likely to make it hollow.
Step 2: visualize slice by sliceRun:
By default viewvox removes the internal voxels (creating a "hollow" model). If you want to keep the internal voxels, run it like this: ./viewvox -ki mug.binvox.
The keyboard and mouse commands available in viewvox are printed in the terminal window you run it from ("cmd" in Windows, "Terminal" in Mac OS X).
Now, typically you'd press s to show one slice of the voxel model, k and j
to show the next slice up and down (the current slice index is shown in the terminal window),
and a to show the voxels with alternating colours,
To better examine the correspondence between successive slices, press n to show the slices above and below the current slice (optionally t to make these slices transparent). The right image shows a top view in orthographic projection.
To build the model in minecraft, I run minecraft and viewvox side-by-side so I can see where the blocks should go.
Obviously many improvements are possible, send me your suggestions.
Some recent additions:
Still on the to do list are:
Do check out...
Last modified: Tue Jan 15 09:40:43 GMT 2013
You are visitor number 69431