Closed tangziwen closed 2 years ago
It is 2 because not only the neighor voxel are needed, but also their gradient (used for normals). To compute the gradient of a neighbor voxel, neighbors are needed, which means it needs neighbor's neighbors, hence 2. It is 1 on the other direction because the origin coordinate for a cell is the minimum corner. Transvoxel does not iterate single voxels, it iterates cells of 2x2x2 voxels because it polygonizes within 8 corners of a cube, where each corner is a voxel. Pad a cell with 1 voxel for gradients and you obtain a 4x4x4 cell, with the origin point at (1,1,1).
Thanks!!
hi~ I'm just a bit confused about this line [transvoxel.h Line 18: ]: // How many extra voxels are needed towards the positive axes static const int MAX_PADDING = 2; What I don't understand is why the MAX_PADDING is set to 2, i think the padding is used for getting neighbor's chunk voxel, so maybe the MAX_PADDING equal to MIN_PADDING = 1 is enough?