This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| combining [2024/03/31 15:21] – [Combining multiple models into a single .binvox file] badmin | combining [2024/04/02 14:19] (current) – [Merging the resulting binvox files] badmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Combining multiple models into a single .binvox file ===== | + | ===== Combining |
| This is a fairly popular use case, for which I had promised to write a tutorial many years ago.. :-| | This is a fairly popular use case, for which I had promised to write a tutorial many years ago.. :-| | ||
| + | |||
| + | ==== An example 3D model with multiple components ==== | ||
| + | |||
| + | I constructed the example from [[https:// | ||
| + | combined using the '' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | ==== Splitting the 3D model ==== | ||
| + | |||
| + | In '' | ||
| + | |||
| + | The resulting files: [[https:// | ||
| + | |||
| + | ==== Voxelizing both models in the same coordinate system ==== | ||
| + | |||
| + | The goal is to voxelize them such that after merging they end up in the same spot relative to each other. | ||
| + | |||
| + | For this we need to determine the smallest bounding box that contains both models. Since in our example the " | ||
| + | |||
| + | '' | ||
| + | |||
| + | < | ||
| + | # > binvox -d 128 puppet.obj | ||
| + | |||
| + | --- [binvox] mesh voxelizer, version 1.36, build #889 on 2023/07/23 12:28:17, running on Linux | ||
| + | |||
| + | ... | ||
| + | |||
| + | Mesh:: | ||
| + | | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Make a note of these values, and pass them to '' | ||
| + | < | ||
| + | # > binvox -d 128 -bb -0.768355 -0.313688 -0.034275 0.658711 0.407517 2.04301 heart.obj | ||
| + | </ | ||
| + | |||
| + | I will update '' | ||
| + | |||
| + | Now both models have been voxelized such that they can be merged, and be the same relative size and in the same relative position. | ||
| + | |||
| + | ==== Merging the resulting binvox files ==== | ||
| + | |||
| + | For this, the '' | ||
| + | < | ||
| + | binvox_merge heart.binvox puppet.binvox -o puppet_with_heart.binvox | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | |||
| + | The output file is in the binvox **version 2** file format, which supports different values for a set voxel (in the range 1-255). | ||
| + | |||
| + | ----- | ||
| + | |||
| + | **TODO**: some explanation/ | ||
| + | |||
| + | ----- | ||
| + | |||
| + | ==== Visualising the merged binvox file ==== | ||
| + | |||
| + | '' | ||
| + | |||
| + | A useful new feature is the ability to toggle "point rendering" | ||