Blender and Voxel


I’ve an problem.

For university I need to load a VoxelFile into Blender using Python.

The Voxel in the file are stored like this



Each tupel is a voxel - dimension of the Voxel should be 1 but everything else is also okay.

Loading the 536MB file is no problem and reshaping the array to 512x512x512 is also no problem.

But now my is how I could make this Voxel-Grid visible in Blender. For optimization I gonna ignore all voxel with A = 0

If I try to use


it is very slow and also I have no color.

Therefore my question is: How can I display the voxel in Blender in an efficient way using Python? Waiting hours to add all the cubes is no way for me…

Maybe there is already a script which I could use - my Professor said it is okay if I use an external script for displaying the voxelGrid


Just create one cube and add it to a group. Then create an empty for every voxel x,y,z. Make each empty dupligroup the cube into the scene.

you could add a vertex per voxel, set material to halo and render that with hardness ~100 and size 0.06

I couldn’t get the Volume material type to work like expected, but it should generally work for Voxel rendering.

I don’t understand your way. As far as I understand your idea, it would not bring me additional performance, because I still create a new object for each voxel

You recommend to use a single vertex for each voxel. this would create a pointcloud?

As I do not have much knowledge about Blender, I do not really understand both ideas.
@Atom: Like you said, I’e created a “Group” (in my case it’s an empty mesh). Then I add points to the mesh - This creates a pointcloud. This happens with nice speed, but there are still no faces. As I know the alpha value of each voxel, I gonna skip those with alpha = 0 and use only every secound line in each three dimensons. This made it a bit faster - But it is still not as fast as I want to have it…

@CoDEmanX: I don’t understand your idea… Sorry

Here some code how I do it:

for z in range(0,dim,2):
for y in range(0,dim,2):
for x in range(0,dim,2):
if self.voxelGrid[x,y,z,3] != 0:
triMesh =‘Mesh’)
triObj =‘Object’, triMesh)
triMesh.from_pydata(self.vertices , [], self.faces)

self.voxelGrid is an 512512512*4 Array - 4 is color RGBA