Is there a way to convert a 3D model into a lego sculpture?
I found a few ways to convert a 3D model into a Lego sculpture. The first is a program called Dolphin Brickr. It works very well, as you can see in this image of Yoshi:



The downside to this program is that it only runs on Macs, This runs on both Windows and Macs now and the output format is a series of images, one for each layer. So you can't import it into MLCAD or your favorite Lego building software. I was looking for something that uses the .ldr format.

Another program is LSculpt. This worked okay but I couldn't seem to get great results.
I'll been using a 3D model of Nautilus for my examples. Here is a picture of the LSculpt results:



The black version was created from LSculpt and the blue version was creating using my alternate method. It is also worth mentioning there is another technique, a 3ds Max script called Legolizer. Unfortunately, I don't have 3ds Max so that wasn't an option for me. I wanted to do this using only open source software on Windows. Here is how you do it:



Step 1 - Scale your 3D model

You need to scale your model down by a factor of .833. I used MeshLab and the process that it described in the Dolphin manual.

Step 2 - Convert a 3D model into a binvox file

This is done using a program called binvox.exe. You can read about it and find the download link on this minecraft wiki. All you need to do is to download binvox.exe and then copy your 3D model into that folder. Open command prompt, cd into that folder, and run a command that looks something like this:

binvox nautilus.obj -d 128 -rotz -rotz


nautilus.obj is the name of my 3D model, -d 128 specifies the size (128 x 128 x 128 voxels), and -rotz and -rotx will rotate the model. You will have to experiment to get the right rotation, or your bricks won't face up at the end. You might want to start with -d 32 to speed up the process until you get the orientation right, which you won't find out until the end. The output from this is a file with the name nautilus.binvox.

Step 3 - Install Cygwin (optional if you know what you're doing)

I would recommend installing cygwin for the following steps, since that is what I used, but you don't necessarily need it. You just need a way to run c++ and Perl programs. When you install it you can select packages, make sure you install the package named perl and the package named gcc-g++.

Step 4 - Convert the binvox file to a readable txt file using read_binvox

Download this program called read_binvox. Make sure it is saved as read_binvox.cc. Then copy your .binvox file into the same folder. Open Cygwin and cd into that folder. Then run

g++ read_binvox.cc -o read_binvox


to compile the program. Next, you can run it with

read_binvox nautilus.binvox


This will create an output file called voxels.txt.

Step 5 - Convert voxels.txt into your .ldr file

I wrote a program in Perl that will convert the voxels.txt into a .ldr file. Create a new file named binvox2ldr.pl in the same directory as your voxels.txt file. File it with the contents from this pastebin.

Then go back to that directory in cygwin and run the command:

perl binvox2ldr.pl voxels.txt &gt; nautilus.ldr


This may take a while to run, depending on what size you made the sculpture. The program uses a very basic algorithm for combining bricks together. It may have floating bricks, so I wouldn't recommend just using the parts list from that and expecting a secure, perfect model. But I think it could be a good way to start a design for a sculpture. The script could definitely use some more improvements, but it's a basic start.

Step 6 - Editing and Render

You can use these instructions from ldraw.org installing some tools for editing and rendering the sculpture. I used MLCAD to change the color and then rendered it using POV-RAY. Here's what it looks like: