I have a stack of 2D images that I would like to render as a 3D object. Essentially, each image is a slice of a 3D object such that, if stacked along the z-axis, would make a 3D object.


I want to maintain the color of the image while making black transparent, like in the model below. I have a stack of images that (when stacked) look like that model.

This is what I'm looking for from my image stack.


I would like an actual 3D model. I couldn't get the voxel texturing to work. Blender didn't seem to like the fact that there was color. Below is an example of one of the slices:

Slice example

Things I've tried/ruled out:

  • Voxel texturing of an object (I'd like it to be a 3D model, I also couldn't figure out how to color this)
  • Surface modeling (this doesn't preserve internal structure (duh) but also doesn't preserve color)
  • Import images as planes (this was suggested to me and I couldn't get it to work, although it seemed like this was not the result I'm looking for either)

The help is appreciated. I'm open to doing any and all scripting; I'm comfortable with Python and image processing but not so much with Blender.

  • 1
    $\begingroup$ The answer depends if you want a surface model or just render out the volume (you tagged your question with modeling). You could use volume rendering with the voxel data set to Image Sequence. If you want a surface model and you got an outline of a model (maybe Black/White line drawing) you could trace the images as curves in Inkscape and use bsurfaces to build the mesh. Can clarify this in your question? How does the image data look like? $\endgroup$ – user2859 Apr 9 '14 at 16:22
  • $\begingroup$ Does the additional detail I added to the question help? $\endgroup$ – Luigi Apr 9 '14 at 17:09
  • 1
    $\begingroup$ I guess without a bit of scripting the outcome is not what you want. If you are going for a surface model the texturing will be the tricky part. As for voxel visualisation this might be helpful (just mute the audio). $\endgroup$ – user2859 Apr 9 '14 at 18:04
  • 1
    $\begingroup$ I added clarification and an example slice. Thank you all for your help so far. The voxel visualization worked somewhat, but I don't think that I'd be able to work with the data like that as a 3D model. $\endgroup$ – Luigi Apr 14 '14 at 0:27
  • 1
    $\begingroup$ Perhaps one way to script this might be to: (1) read in the whole stack of images (if you have Pillow and SciPy installed, you can use scipy.misc.imread()), then put into a 3D NumPy array. (2) Loop through the array, and at each voxel, if it's zero, skip it; if it's non-zero, create a 1x1x1 cube with Vertex Colors matching the value of the array. (3) Use the union modifier to connect all these cubes into one mesh. (4)[optional] Loop through each vertex enforcing that it have only 1 color. $\endgroup$ – Garrett Apr 14 '14 at 1:26

You can definitely render a 3D voxel dataset using the built-in tools of Blender. As seen in the example below:

The basic workflow using the Blender Internal engine:

  • Create a Cube that's the same dimension as your voxel data ( image resolution x Voxal size , the important thing is to preserve the dimension ratios )
  • Create a volume material and texture for the cube.
  • Load in the density data as image sequence or 8bit raw data ( tested .img and .rawb formats ).
  • Adjust all resolution parameters ( set it to the resolution of the image you should have this information , incorrect resolution will result in distorted/cropped or even no visible result )
  • setup the texture to affect Density and Emissions.
  • Tweak color map and material properties until the data is shown nicely.

The material and texture setup :

enter image description here

the render result :

enter image description here

Using the color ramp, you can even remap the density to different colors.

enter image description here


The first tool most physicists and medical imaging experts would reach for is VTK. It's made just for this sort of thing. Some example code: http://itk.org/Wiki/ITK/Examples/IO/VolumeFromSlices

But what about doing stuff like that in Blender? The rule seems to be: just think of it, and someone out there has made a .py script already. In this case, it's VTKBlender.py which converts between VTK's idea of a mesh and Blender's idea of a mesh. http://www.ualberta.ca/AICT/RESEARCH/Vis/VTKBlender/ Note that this is a few years old, but that's normal in the science world. VTK can be used easily in Python, so you can write your own scripts to perform any other VTK actions such as melding 2D slices into a 3D VTK mesh.

Another approach is to make a mesh from a point cloud. A point cloud could be defined from the 2D slices. Read this discussion on the OpenCV Q&A forum http://answers.opencv.org/question/2115/3d-models-from-2d-image-slices/


some simple solution:

make a 3d object that consists of many layers,and texture each layer with the image at that z coordinate.

I would therefore suggest to read how .obj format works and generate an obj with that properties using your python skills.

(obj is non-binary and therefore easy to generate)

if there are enough layers, one would not see the difference, but it may be tough to render.

(actually, some minecraft like game uses this technique to allow items with any shape given by a 2d texture having a thikness)

  • $\begingroup$ I am happy for your effort to supply additional information to an old post, but unfortunately this not an answer, but the premise of the question. This exact method is given just above the first image in the question. Sprite maybe helpful in many game Situations, but the question clearly rules them out: "Import images as planes [is not what I was looking for]", "I would like an actual 3D model". $\endgroup$ – Leander Jul 21 '18 at 14:11
  • $\begingroup$ I would like an actual 3D model - what is, why are many 2d planes no actual 3d model? (comparing to other solution using point ammount : both can be rendered by any 3d engine, both has the difficulty that the surface has no proper normals.) $\endgroup$ – KGM Jul 21 '18 at 14:20
  • $\begingroup$ I would classify a number of planes as a 3D model as well. But stacking images sounded like not an option to the asker: "Import images as planes ([...]it seemed like this was not the result I'm looking for either)". $\endgroup$ – Leander Jul 21 '18 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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