From 2D to 3D: Turning Images into Objects

Some of the most unique historical artefacts are held in protected collections that are difficult for historians or their students to access. Some artefacts have degraded over time, while others have simply been destroyed by accidents or acts of war.  Many of these, however, have been preserved and publised as printed images or engravings. Luckily, these images or engravings can be employed to create three-dimensional models. These models can be manipulated to restore an artefact to a version its original state, or printed out to give students access to a tangible version of the items they are studying.

This tutorial will take you through the steps of turning a grayscale image into a 3D object using Blender, an open-source 3D modelling program. This tutorial will be working with a set of images that was provided to registered participants.

The Basics of Blender

After downloading, installing, and launching the program, Blender will present you with a welcome menu:

blender-1

The welcome menu is the black box with the cartoon figures. This menu useful when returning to work on files that were accessed recently. To close the welcome menu, just click off to the side.

With the welcome menu closed, you will see a grey cube in the middle of the work space:

blender-2

There are some default settings to be aware of. Because the program is designed for sculpting objects, a cube is provided as a kind of block of clay for users to start sculpting. This is a good opportunity to learn how to navigate the Blender work space. There are some lines to orient you. The grid provides a kind of floor, the red line shows the x-axis, the green line is the y-axis.

blender-3
Default settings: Object Mode; display as Solid; Pivot around Median Point; and, Translate

You can see in the bottom left-hand corner that Blender is in “Object Mode,” where we can manipulate whole objects. The next menu on the right controls the display mode, the default setting is “Solid” to make the object look like a solid, rather than – say – a wire frame.

You can only edit or manipulate an object when it is selected. The cube’s outline appears in orange to indicate that it has been selected. The default setting is to use right-click to select or de-select an object. If you are working on a one-button mouse, you can go to the file menu to open the user preferences. In the user preferences, select the ‘input’ menu and see that the ‘Select With’ can be set to either left or right, depending on which mouse button you prefer to use. If using a one-button mouse, change the ‘Select With’ to ‘left.’

blender1

Next on the right is the control to change the pivot point for your point-of-view. The default setting is to pan around the centre of the work space. You can pivot your point of view by clicking and holding your mouse scroll wheel and moving the mouse cursor. (If you’re working on a laptop or a mouse without a scroll wheel, hold alt+left click).

The next menu on the right controls a series of four “manipulators.” The default setting is the “Translate” manipulator, which is indicated by the blue, highlighted arrow. While the “Translate” option is selected, Blender will show three arrows radiating from the center of the cube. These can be used to drag the cube along the corresponding axis. Try to left-click-and-hold the point of the green arrow and dragging your mouse left to right to move the cube along the y-axis. The same can be done for the red or green arrows to move the cube along the x- or z-axis. If you shift-left-click on an arrow head, you can move the object in any direction you drag the mouse. I find this last option of moving an object difficult, so I prefer relying on moving an object along a single axis.

To the right of the “Translate” option is a button to “Rotate” the object.

blender-5
Selecting the “Rotate” option

 

Clicking on this button will turn the three arrows into a series of interlocking circles. You can use these circles to rotate the object around a particular axis. Left-click-hold on the green circle to rotate the object around the y-axis by dragging the mouse.

To the right of the “Rotate” button is the “Scale” button.

blender-6
Selecting the “Scale” option

Clicking on this button will produce three lines coming out of the center of the object, with square ends instead of arrowheads. A left-click-hold on the square end of the green line will scale the object along the y-axis as you drag the mouse cursor. The same can be done along the other axes. An object can be scaled uniformly along all three axes by pressing the “s” key, while the object is selected. Dragging the cursor away from the center of the object will increase the size, moving it toward the center of the object will shrink it.

blender-7
Scaling an object

Those are some of the basic commands to manipulate objects in Blender. Because we will not be working with a cube (or at least not yet), we can delete the cube. Ensure the cube is selected (indicated by the orange outline) and press the “delete” key. Blender will provide a prompt to confirm you want to delete the cube.

Turning a 2D Image into a 3D Object

This tutorial will turn a 2D, grayscale image into a 3D object by raising lighter sections of the image and lowering darker sections of the image, thus creating a texture that reflects the lighting of the image. To achieve this, we need to follow a simple workflow:

  1. Import an image
  2. Divide the image into smaller sections
  3. Elevate lighter segments, and lower darker sections of the image

Step 1: Import an image

So the first thing we need to do is import an image into Blender. This capability is not included in Blender’s default settings, but we can fix that fairly easily by activating an add-on. Under the “File” menu, select “User Preferences.” A new window will open.

blender-8

Use the tabs at the top of the window to navigate to the “Add-ons” menu. Use the search bar in the upper right corner to search for “import images as planes.” When the add-on appears in the main window, click the box on the right to activate it, then click “Save User Settings” in the bottom left corner.

Under the “File” menu, use the “Import” drop-down menu and select “Import Images as Planes.”

blender-9

Follow the prompts to locate the file “image-2-grayscale” and import this image as a plane. The image will appear as a flat, grey rectangle in the work space. We can move the image to the center of the work space and enlarge the image using the “scale” command learned above. We can also make the image visible by changing the display option from “Solid” to “Texture.” Ok, that’s step 1 of the workflow complete.
blender-10

Step 2: Divide the image into smaller sections

Because we are going to edit the object, we need to switch from “Object Mode” to “Edit Mode.” Switching to “Edit Mode” changes the options on the menu bar on the left side of the screen. Clicking the “Subdivide” button will divide the plane into four squares, by adding extra vertices and edges. Instead of having one rectangle, we now have a rectangle made of four faces, which can be manipulated independently.

blender-11
Adding additional vertices by clicking “Subdivide,” while in “Edit Mode.”

If we think ahead to step 3 (elevate lighter segments, and lower darker sections of the image) we can imagine that the darkest of these four faces will be lowered, while the lightest will be raised. With only one subdivision, this will make for a pretty poor model. We can click “Subdivide” again to subdivide the four face into four smaller faces, dividing the original rectangle into sixteen faces.

Because we are trying to create a model by raising and lowering faces, the most accurate model will be created if there are as many subdivisions in the plane as there are pixels in the original image. The challenge of excessively subdividing the image is that it becomes taxing for Blender. The more vertices in an object, the more processing power it takes for Blender to manipulate that object. Clicking “Subdivide” a total of seven or eight times will produce tens of thousands of vertices, certainly enough to produce a decent model of our image. Dividing the plan into smaller components requires more processing power from your computer. If you find your computer getting sluggish after this many subdivisions, you can use the “ctrl+z” to undo some of these divisions. When you have a satisfactory number of divisions, switch back to “Object Mode” and we’ll move on to Step 3.

Step 3: Elevate lighter segments, and lower darker sections of the image

Once back in “Object Mode” we can use something called a “Modifier” to raise and lower segments of the image according to their relative shading. On the menu on the right, select the icon that looks like a wrench, the “Modifiers” menu. Once this is selected, you can choose from different “Modifiers” by clicking on the “Add Modifier” drop-down menu. Select “Displace.”

blender-12
The “Displace” modifier, in the “Modifiers” menu.

 

The “Displace” modifier will raise and lower the different faces of the texture, based on their relative shading. When working in the “Displace” menu, the first thing to do is select the object that will be displaced, in this case it will be the plane called “image-2-grayscale.”

blender-13

Once the texture is selected, you can alter the “Strength” of the displacement by using the text-box in the lower right corner. You can click and drag the “Strength” text box and drag your mouse left or right to lower or raise the intensity of the displacement, or your can click on the box and type in a value.

blender-14

You might notice that the areas raised do not correspond to the shading of the image. This can be changed by selecting “UV” in the “Texture Coordinates” menu.

blender-15

After a bit of tweaking, adjusting the “Strength” to around 0.05 or 0.075 seems to produce a decent-looking model. We can get a better idea of what the final product will look like by switching the texture back to “Solid” so that we don’t see the image any more.

blender-16

Once we are happy with the shape of the model, press the “Apply” button to complete the modification from flat plane to a textured relief of the original image. The image looks a little rough, but this can be addressed using the “Smooth” modifier.

blender-17blender-18The “Smooth” modifier offers a few parameters to adjust. “Factor” adjusts the intensity with which Blender flattens angles between vertices. Adding a value to the “Repeat” option will increase or decrease the amount of times that the smoothing value is applied to the selected object. You can also deselect any or all of the axes to stop this modifier from working along that axis.

Start by raising the “Repeat” value by ones to see how this works. If you find the smoothing is diluting too much of the detail, you can always decrease the value to return to the original appearance. You can also try raising the “Factor” by increments of 0.5 and repeating the process a few times to get a sense of how that works. Play around with the values, when you are happy with the smoothing click “Apply.”

If you want to save the textured plane, open the “File” menu and use the “Export” drop-down to select the type of file you want to save the plane as. I usually export as a .stl file. You can use the “Import” drop-down menu to import the plane back into Blender later on.

Could we do Better?

You might find that the plane we produced looks a little rough and the smoothing was not capable of fixing it to the extent that we might like.

We might be able to generate a smoother model by adding a few subdivisions to increase the number of vertices and faces that will respond to the “displacement” modifier.

Considering that the “Displacement” modifier functions as a product of the original image’s shading, we can also try altering the shading of the original image to see how this would affect the models we produce. The image we used for this demo was just the grayscale version of the original image. I also prepared versions of the image with higher (left) and lower (right) contrast settings.

graphics-3952-b  graphics-3952-c

 

Which do you suppose would produce a better model? Select one of the images, work through the steps again and see how the contrast settings affects the models produced.

We can also use Blender’s sculpt features to smooth out the model manually, but I’m going to save that for another workshop.

Turning a Textured Plane a Printable Model

At the moment, the textured plane we produced is just a flat plane with texture, but no depth. Because the object has no depth, it cannot be printed by a 3D printer. To fix this, we can add some depth by merging this with a cube.

We can create a cube by using the “Create” menu on the left and selecting “Cube.” A new cube should appear in the work space.

blender-19

Using the “Translate” and “Scale” commands (learned in the first part of this tutorial) translate the cube so that it intersects the plane, and scale it so that it adds a bit of depth to the plane. Ideally, the borders of the plane should extend beyond the edges of the cube, while the bottom face of the cube should be fairly close to the underside of the plane. The thickness of the model is a judgment call that will be determined by your printing capabilities. Thin prints can warp if they are printed on lesser-quality printers (like mine) while  a thicker base will mean using a lot of filament as the printer produces bulkier model.

blender-20

Next, we will use another modifier to cut the top of the cube, using the plane as a guide. Because we are modifying the cube, ensure that the cube is selected. Under the “Modifier” menu, select “Boolean.” The “Boolean” modifier only has a few options. Select “Intersect” and the name of the plane.

blender-21

This might take some time, but if it works you should see the top half of the cube replaced by the texture of the plane.

blender-22

If that looks satisfactory, click the “Apply” button to complete the modification. This might also take some time. That will leave us with the two objects: the plane we created from the image and the cube that was cut in half.

blender-23

If we wanted to print this, we would export the cube as a .stl or .obj file and use a 3D printer to produce a model.