LEGO Spheres
Models of Planets and Moons generated with my own application

Eindhoven, 21 October 2009. A short while ago I came across some pictures of a globe, made out of LEGO! I quickly searched on Google for more structures like this, and was a bit disappointed that there where not much others. I decided to try to write a script to generate a sphere made out of LEGO bricks. After a (very long) evening of scripting in PHP, it did work. A sphere made of LEGO, in any radius you want!
The idea behind it is quite simple: look at a sphere as if it consists of layers, i.e. cylinders with a different radius. If you stack these cylinders, you will end up with a sphere. One has to consider some things, e.g. the ratio of the LEGO bricks (6 bricks next to each other is more or less equal to 5 bricks on top of each other).
The other day I saw another globe made of LEGO, but with an entirely different approach: the general idea was a cube, so six identical faces, with on each face a part of a globe made of LEGO plates. Looks very nice, and it certainly approaches the spherical shape better, or maybe just quicker in the sense of the radius, than the one made of bricks. The only disadvantage is you need quite some plates.
Because the sphere had been an easy project, I wanted to give the globe a try. Little did I know...
The first problem was to invent which brick should represent which part of the world. Thanks to Kohsuke Kawaguchi, who did something similar some ago, I was able to continue.
This main idea is as follows: there is a LEGO sphere, and within this sphere is a bright light, exactly in the center of it. Around the LEGO sphere is another sphere, for example a hollow earth (so, just a shell). Imagine the LEGO sphere entirely transparent, except for one brick (at a random position). Now, the light within this LEGO sphere will cast the shadow of this one brick on the outer sphere, the earth. If this earth is (semi-) transparent, you can see from the outside which part of land or sea is covered by this shadow. Repeat this for every brick in the LEGO sphere, and the globe will be entirely covered in shadow (wow, that sounds dark).

The next question was, "how do I actually calculate this shadow"? One has to realize that the transparent LEGO sphere and shell-earth aren't tangible; they are just visualizations inside your head. The key to creating the shadows is to determine which faces of the bricks are exposed to the outer world. This can be just one face (bottom, top, or side), two faces (two side faces, one top and one side, one bottom and one side) and three faces (one top/bottom and two side faces). There are no other possibilities.
The shadow of the first category is the easiest: it will be a quadrangle. The other categories will both produce a hexagonal (but if there would be a layer ("cylinder") exactly halfway the sphere, the second category could also result in a quadrangle).
To calculate the angular points of the shadows, one has to calculate the angles Phi (φ) and Theta (θ) - spherical coordinates. This is useful because one can equate them with the longitude (-180° to 180°) and latitude (-90° to 90°).
Next step, the decision which type of map to work with. I found out there exist a ridiculous amount of ways how to project a sphere on a map! I chose the simplest, the plate carrée. This one is twice as long as it is high.
Ok, by now the points of the shadows could be projected on the 2D map. But how to make a polygon out of them? This was another task. I do not know how to explain this concise and clear, for which I apologize. Just assume there are polygons already all over the 2D map.
The last to do, is average the color of the area within each polygon. Because you mostly deal with RGB colors, you have to take the mean values of the R, G and B values separately. Unfortunately, there is one drawback on this method: when there are many colors within the polygon, the mean value can be a color that isn't even present in that area. This is the reason why some oddly colored bricks are present in the pictures below.
Of course there where many other problems: how to output a file that MLCAD can read, figuring out the .LDR filetype, check the code why the continents are mirrored and other, often very weird, bugs.
That's it for now. I used the great application MLCAD to open the models and view them. Have fun, and if you have any questions please feel free to send me an e-mail:

Note: One thing to notice are the many colors in the models. I did not yet "round" them to available LEGO colors!

Update: I added a small version of each model.

Earth, a radius of 24 bricks.

Moon, a radius of 18. I have yet to make one for a bigger radius.

Sun with a radius of 36. Because of the fine structure of this star, not much detail is preserved.

Two models of Mars, I used two different maps. Both radius 18.

Jupiter, some detail (great red spot). Radius 18.

Venus, radius 18. I like this one!

Saturn, the radius is 24. No rings yet ;)

Some moons of Jupiter: Io, Callisto and Ganymede, all radius 18.

And the showpiece, the earth with a radius of 54 bricks. Probable impossible to build, because just the outer layer already consists of 26,880 1x1x1 bricks!

An obvious question arises: what radius should one choose for a planet or moon, in such a way that it is still clearly recognizable? The bigger the radius, the finer the mesh (the polygons) will be and thus the better the result. On the other hand, the amount of bricks needed to build it is a quadratic function of the radius. This relation is visible in the graph below (horizontal axis x = radius, vertical axis y = amount of bricks on the outside).

To see what a 18-radius mesh looks like on a 2D map,
click here (high resolution). You might notice the strange polygons in the top and bottom layer; in the models above I have ignored them, so there are 2x2 bricks missing.

With the help of the applications L3P (which converts .LDR files to .POV), PovRay and FFMPEG I created an animation of a rotating earth, with a radius of 36 bricks. It is an .AVI file, click here to view it.

No more models at the moment. Questions, requests, ideas, other things? Feel free to contact me :)