# Nanoblock modeling in POV-Ray

## Introduction

The instructions for building a physical Nanoblock model are relatively easy to translate into a 3D model in POV-Ray. As an overview, a Nanoblock model generally consists of layers of tiles, where each tile is either a simple 1×1 cylinder or an `L`×`W` rectangular brick. All tiles have the same thickness.

This article describes my approach to modeling Nanoblock in POV-Ray and how the scene description code works. It features my completed virtual version of the Kaminarimon (雷門) and alpaca models.

## Modeling

First we set up a 3D coordinate system. Because the official instructions are given mostly in terms of 2D planes, we will use the

`x`- and`y`-axes to represent the ground plane. We define the positive`x`direction to point right on the page and the positive`y`direction to point down on the page – this corresponds to the axes convention for computer images (but differs from the convention for mathematical graphing). The positive`z`direction shall point up out of the page, so higher layers have higher`z`coordinates. Overall this is a left-handed coordinate system, which corresponds with POV-Ray’s convention.For convenience, we make one

`x`or`y`unit correspond to one tile length, and we make one`z`unit correspond to one layer thickness. In the real world, the smallest Nanoblock tile has dimensions 4 mm × 4 mm × 3 mm (with the thickness being the shorter dimension).We define a macro

`Barrel()`

that makes a 1×1 cylinder that spans from (`x`,`y`,`z`) to (`x`+1,`y`+1,`z`+1).We also define a macro

`Brick()`

that makes an`L`×`W`×1 tile that spans from (`x`,`y`,`z`) to (`x`+`L`,`y`+`W`,`z`+1).To keep the code organized, for each step in the official instructions we will group all the tiles produced and assign the object to a variable named like

`Step1`

. This makes it easier to isolate and check each step; we can compare the instructions and the virtual model one step at a time.Building the model can get tedious in the real or virtual world, but sometimes we can take shortcuts in the code. Not only can we copy and paste lines of code, but we can also take advantage of symmetry: We only explicitly define one side and then duplicate the subobject within POV-Ray and apply reflections and translations to the copy.

Finally, we add the other components of the scene and do some tweaking on the model. We set up the camera, lights, bottom plane, and miscellaneous configuration. We normalize the scale of the model to 1×1 in the

`x`- and`y`-axes and center it at (0, 0). We also shrink the`z`-axis to make the tile aspect ratio physically accurate.

## Pictures

## Source code

## Room for improvement

Add studs on each unit length of every tile by changing the macros.

Get textures for the Kaminarimon lantern stickers.

Implement the

`L`×1 brick with rounded ends tile type.

## Notes

Remember that POV-Ray is a 3D modeling programming language, not an interactive visual modeler program. When writing and manipulating the scene code, it is essential to be able to mentally visualize the scene and the coordinates in order to understand what is going on in the scene description.

Modeling Nanoblock kits seems to be easier than modeling the vast majority of Lego kits. So far I’ve encountered only 3 different tile types in Nanoblock, whereas a Lego kit can have tens of item types. However, it is true that reproducing Lego models that only use rectangular prism bricks – such as models of large-form Lego art – is as straightforward as Nanoblock.