diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 2f0f702795..70e88bd7b5 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -1351,6 +1351,7 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp if (params.viewFrustum && childNode->isColored() && !childNode->isLeaf()) { int grandChildrenInView = 0; int grandChildrenInLOD = 0; + float grandChildBoundaryDistance = boundaryDistanceForRenderLevel(childNode->getLevel() + 2); for (int grandChildIndex = 0; grandChildIndex < NUMBER_OF_CHILDREN; grandChildIndex++) { VoxelNode* grandChild = childNode->getChildAtIndex(grandChildIndex); @@ -1358,7 +1359,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp grandChildrenInView++; float grandChildDistance = grandChild->distanceToCamera(*params.viewFrustum); - float grandChildBoundaryDistance = boundaryDistanceForRenderLevel(grandChild->getLevel() + 1); if (grandChildDistance < grandChildBoundaryDistance) { grandChildrenInLOD++; }