     }
     const size_t currentSize = spherePartitionPivots[cubes.Size()];
     sphereIndices.resize(currentSize);
+    sphereIndexPartition.resize(sphereIndices.size());
     nextSphereIndices.resize(sphereIndices.size());
 
     std::cout << "sphere partition pivots: ";

    }
};


void MortonDacrtNodes::Create(RayContainer& rayContainer, SpheresGeometry& spheres) {
    

    
    // Geometry partition
    
    doneSpherePartitions = doneSphereIndices = 0;
    while (spherePartitions.size() - doneSpherePartitions > 0) {
        // Create new ray partitions through binary search
        nextRayPartitions.resize(rayPartitions.size() * 2);
