6
$\begingroup$

I've been looking online for a long time, searching for documentation on the subject of Blender Voxel Data. So far, I know that Blender uses many file types, including the .bvox file type. For the .bvox file type, I have found that it uses ASCII characters to load in density values, starting with the dimensions. For example, a data set with dimensions 64,64,64 would save into the .bvox file as:

@@@

However, only the density values are saved. The data set I have is formatted as follows, where dd is a density value:

xx yy zz dd
xx yy zz dd

My python code strips each line and takes only the density values and uses pythons pack struct to pack the values into a .bvox file. This works fine, but I am wondering how Blender knows where to put the coordinates of the densities? Each density value has to be at a specific point, and how does Blender know where that point is? And also, is it possible to specify my own coordinates for each value?

$\endgroup$
0

1 Answer 1

3
$\begingroup$

In the Blender wiki article it says

The voxels are stored in a flat z/y/x grid of floats.

That means that the coordinates of every density is defined by its position in the file. I guess that your original data set is sorted that way too. For example:

xx yy zz dd
-----------
12 20 00 dd
12 20 01 dd
12 20 02 dd
...
12 21 00 dd
12 21 01 dd
...

In this case the coordinates are redundant because they can be easily deduced from the position in the list. Thus the coordinates can be omitted.

Also the file format doesn't use ASCII characters. It is a binary file and simply stores numbers. Every number can be interpreted as an ASCII character. The character for 64 is @. But in this case this is irrelevant.

$\endgroup$
6
  • $\begingroup$ Thank you for your reply! Also, I forgot to note that at the bvox file is headed by the dimensions. Does that have something to do with is too? The data file I have has dimensions 64-64-64, and so the bvox file starts with @@@ . $\endgroup$
    – Lamikins
    Nov 8, 2013 at 2:41
  • $\begingroup$ Yes that is what I mean with the last paragraph in my answer $\endgroup$
    – Maccesch
    Nov 8, 2013 at 12:48
  • $\begingroup$ One more thing, is it possible to manually set the voxel coordinates? Some of my data sets are not in the pattern specified above, so the coordinates cannot be omitted. $\endgroup$
    – Lamikins
    Nov 17, 2013 at 21:39
  • 1
    $\begingroup$ You could fill in the blanks with 0 densities and/or reoder the data. $\endgroup$
    – Maccesch
    Nov 19, 2013 at 11:32
  • 1
    $\begingroup$ I don't know about the possibilities of RAW voxel files mentioned in blender wiki. But if you don't have uniformly spaced data you could resample it: For each point in a grid calculate the density based on points of the original file that are near the grid point. $\endgroup$
    – Maccesch
    Nov 21, 2013 at 11:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .