22

After researching this question for a few days, I want to post it here so I can share what I learned in an answer, and hopefully learn some new techniques too.

If anyone has found another way to do this, please share! If anyone has used Legolizer for 3ds Max, an answer explaining that process or that has examples of it being used would be useful too.

2 Answers 2

7

You can use Brickify for that. You just upload an STL file and it is converted to LEGO bricks. You don't need the 3D printing part and can go ahead to download the building instructions.

14

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:

Yoshi Lego Sculpture

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:

Nautilus Lego Sculpture

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 > 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:

Nautilus Lego render

5
  • I have had much success with LSculpt and it can create models in great detail unlike your sculpture (although, it runs slower when you do that).
    – rioforce
    Commented May 6, 2014 at 23:57
  • Do you know where Dolphin resides these days? Commented Jul 29, 2015 at 8:21
  • @tommy.carstensen It appears they changed the name of it. Here's the new link lgg.epfl.ch/publications/2013/lego
    – hmatt1
    Commented Jul 30, 2015 at 2:44
  • I know this answer was written and edited a long time ago, but could you suggest an app, preferably OS X, for creating the 3D model files?
    – Craig
    Commented Jan 31, 2016 at 9:27
  • @Craig I haven't done very much 3d modelling, but I think Blender might be a good one to try: blender.org/download
    – hmatt1
    Commented Feb 3, 2016 at 1:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.