2
$\begingroup$

I'm using a Remesh Modifier set to Blocks and I can kind of tell what the Octree Depth and Scale sliders do visually, but I want the modifier to make a model where the blocks are 1 meter in size. Mathematically, what do the two values do? Is there a proportion between the two?

I've figured out that when your remeshed object has a uniform scale of 1 and you use these settings in the modifier it comes close to what I want, but I want to know why the scale value is 0.08164 in this case.

The modifier settings I used for a 1 meter sized block

$\endgroup$
0

1 Answer 1

4
$\begingroup$

TLDR: It uses this formula to calculate the size of the boxes, as far as I can tell: $$\frac{LargestDimensionOfYourObject} {2^\text{OctreeDepth} \times Scale}$$


When you hover over the Scale box in the modifier, the tooltip tells you that it takes into account the "largest dimension of the model":

enter image description here

So I prepared a scene with objects with various dimensions, 4 copies of each. They all have the Remesh modifier, with their Octree Depth increasing by 1 with each copy. Then I took the measurements of all the original objects at their maximum, plus the measurements of their voxel cubes at different octree depths:

enter image description here

When you divide the longest size with the first voxel cube size you consistently get 1.8, after which it gets halved with every iteration. That 1.8 obviously comes from $Scale(0.9) \times 2$, but it's too easy a relation so I took more measurements using a 5m cube at different depths to make sure:

enter image description here

When we divide object length with the resultant boxes, we get nice round numbers. Let's call this Divider. This table then tells me that for every 0,1 increase in Scale, the Divider value increases in relation with the Octree Depth in a rhythm of 2, 4, 8, 16... which is obviously $2^n$. The formula seems to be:

$$\frac{BoundingBoxMax} {2^\text{OctreeDepth} \times Scale}$$

So, say, if you have an object that's 7m at its longest side and a Remesh modifier with the values Octree Depth: 3 and Scale: 0.7 you'll get a mesh built out of boxes with an edge length of $7 \div (2^3 \times 0.7) = 1.25m$.

Note: If you look at the screenshot, you'll notice that the only object violating the formula is the torus. I suspect that's because it gets divided into 4 instead of 2 with the first Octree Depth which is probably due to the hole. So I guess the algorithm calculates the voxel size according to the formula, puts one cube in the middle of the mesh volume, then fills out the rest with more cubes stack on top of the original. Or something like that. Then it simply smooths them if you have Smooth or Sharp modes selected instead of Blocks, since the manual says that that's the only difference between them.

$\endgroup$
2
  • 2
    $\begingroup$ Very nice empiric demonstration ! I've looked a bit in the source code and couldn't find where this operation is defined $\endgroup$
    – Gorgious
    Commented Mar 1, 2022 at 6:58
  • $\begingroup$ @Gorgious I was lucky that it was a simple formula. It could've turned out to be a fool's errand trying to reverse engineer something you can't just by measurement. Phew. $\endgroup$
    – Kuboå
    Commented Mar 1, 2022 at 11:23

You must log in to answer this question.

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