SketchUp Models in Minecraft

Importing SketchUp 3D Models into Minecraft

Most people like to build their Minecraft worlds the old fashioned way, brick by brick.  For those that are interested in automating some of the building process, this tutorial describes how to import models from the SketchUp 3D warehouse into your Minecraft world. This exercise is an excellent way to develop an understanding of computer graphics coordinate systems

Following the steps in this tutorial, you will learn:

  • The standard conventions for computer graphics 3D coordinates, and the different ways that the 3D axes are oriented between SketchUp, object file space, and in the Minecraft world.
  • How to rotate the axes during the model import process to get the result facing the right way up.
  • How the scale and resolution of a 3D vector models is distorted when it is converted to voxels (3D pixels).
  • How to adjust voxel conversion settings to get the proper scale for your model in the Minecraft world.

3D Axes Direction and Orientation

In SketchUp, the 3D axes are oriented the way that is common to most mapping and positioning software.  In this space, the horizontal plane is is on the X,Y axes, and the third dimension is Z.  Imagine that your map is a flat piece of graph paper on the table;  the Y axis points north (top of the map), the X axis points to the east, and the Z axis goes straight up out of the page.

SketchUpAxes

SketchUp Coordinate Directions

In an object file, the 3D axes are oriented the way that is common to most 3D computer graphics programs.  This convention is different because in computer graphics, the X and Y axis are usually relative to the screen. Therefore, while the X axis still points ‘east’, the Y axis points ‘up’ and the Z axis points ‘north’

computerAxes

Standard rule for 3D graphics

In a Minecraft world it is similar to the computer graphics convention, with a change in direction of the Z axis..  The X axis still points east, and the Y axis still points up, but the Z axis points south instead of north.

minecraftCoords

Minecraft Coordinates Explained

When you are using a SketchUp model in a Minecraft world,  you must handle the different directions of the axes, or your model will come in upside down and backwards.  The next section describes how to change the orientation of your model through each step of the process so that it appears right side up in Minecraft.

Export Object File – Swap YZ

When you use SketchUp to export an object file to use with binvox, you must swap the Y and Z axis so that Y is pointing up and Z is pointing north.  When exporting the object file, select the [Options] button to open the export settings:

SketchUpExportSettings

Select “Swap YZ coordinates (Y is up)” and tap [OK].  When you export the object file, it will be in the correct orientation for the binvox software to convert to Minecraft.

For example:

Starting with this model in Sketchup:

simpleHouseSkp

You need to make the SketchUp up axis (Z) the binvox up axis (Y) to get your model to look like this:

binvoxD128Down1

Export an object file without swap YZ, in to binvox, it will look like this:

Screen Shot 2014-07-17 at 9.48.26 PM

Converting to Minecraft Schematic

When converting to the Minecraft .schematic file, you need to fix the axes again. Remember that in Minecraft, although Y is up, Z points south instead of north. If you don’t fix this, your model will get flipped upside down.

When you convert your object file to .schematic using binvox, add the rotate about Z parameter to the command line:

$./binvox -c  -d 128 <b>-rotz</b> -t schematic -bi 1 simpleHouseMetricSwapyz.obj

2014-07-19_22.10.50

The house on the left was created using the -rotz parameter, the house on the right was not rotated during conversion.  You can see from both houses that their scale in the Minecraft world is huge. The next section describes how you can modify the binvox input parameters to control the scale of the model created for the Minecraft world.

Model Size and Scale

Getting the model to have the correct scale in the Minecraft world is a bit trickier. The problem is that in order to turn vector surfaces into blocks, you have to have to create blocks at some sample resolution  The higher resolution the sample, the more accurate the model will look.  However, a higher resolution sample also creates a larger model in the Minecraft world, because in Minecraft all blocks are a fixed size.

Change Scale with Voxel Size

For example, starting with this simple house model, which is 11.4 m along the side:

simpleHouseSizeSkp

If we voxelize this with binvox using a the default voxel size of 256:

$ ./binvox -c  -<b>d 256</b> -t binvox simpleHouseMetricSwapyz.obj

We get a house that is 260 blocks long.  Given that one block is about one metre in Minecraft, this small house would be a huge palace next to Steve.

binvoxD256

You can change the resulting dimensions of your model by converting it with a different voxel size. If we convert the same house using a voxel size of 128, the result is a house that is half as long as the previous one.  However, at 130 blocks long, this house is still much larger than actual scale in the Minecraft world.

$ ./binvox -c  <b>-d 128</b> -t binvox simpleHouseMetricSwapxy.obj

Screen Shot 2014-07-19 at 9.02.01 PM

Unfortunately, as the voxel size decreases, so does the quality of the model conversion. For example, if we convert this model with a voxel size of 64, you get structure that is about 65 blocks long, but it loses too much detail and looks like a weird mess:

$ ./binvox -c  <b>-d 64</b> -t binvox simpleHouseMetricSwapyz.obj

binvoxD64

You can decrease the size without losing as much quality if you use a larger voxel size and then downsample the result.  For the next test, we used a voxel size of 128 and downsampled the result once:

$ ./binvox -c  <b>-d 128 -down</b>  -t binvox simpleHouseMetricSwapyz.obj

You get a house the same size as you did using a voxel size of 64 voxel size result, but you retain much more detail from the original model.

binvoxD128Down1

You will have to experiment with voxel size and downsampling to try to get your model as close to the correct scale as possible when imported in the Minecraft world.

Scale is Related to Model Size

Interestingly, when converting models of larger objects from the real world, the result in Minecraft is closer to the actual scale.  For example, this model of the Eiffel Tower which is 118 m tall was converted with voxel size of 512 and downsampled once.

skptomcr

 

The result in Minecraft is 209 blocks high, which is just under twice as big as the model scale.  Remember that the small house converted with these same settings was over 10 times its actual size in Minecraft.

Changing Units in Export Settings

When you export your object file from SketchUp, you can select different units for the numbers to write into the object file. Because numbers in the object file are defined without units, we expected that changing the units on export would change the size of the resulting model.

The models below were exported in metres and feet. When opened with this standard object file viewer, you can see that the imperial model is interpreted as three times larger than it should be.

objFileMetresobjFileFeet

However, when binvox converts these models into schematic files, they both have the same size. Binvox appears to ignore the actual scale of the numbers. This is similar behavior to the Eiffel Tower example, where the scale of the voxelized model is relative to the source model, and not to absolute scale of the model.