diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h index fde5c47301..946cdd03e2 100644 --- a/nanovdb/nanovdb/NanoVDB.h +++ b/nanovdb/nanovdb/NanoVDB.h @@ -1134,8 +1134,10 @@ class Coord /// @brief Return a hash key derived from the existing coordinates. /// @details For details on this hash function please see the VDB paper. + /// The prime numbers are modified based on the ACM Transactions on Graphics paper: + /// "Real-time 3D reconstruction at scale using voxel hashing" template - __hostdev__ uint32_t hash() const { return ((1 << Log2N) - 1) & (mVec[0] * 73856093 ^ mVec[1] * 19349663 ^ mVec[2] * 83492791); } + __hostdev__ uint32_t hash() const { return ((1 << Log2N) - 1) & (mVec[0] * 73856093 ^ mVec[1] * 19349669 ^ mVec[2] * 83492791); } /// @brief Return the octant of this Coord //__hostdev__ size_t octant() const { return (uint32_t(mVec[0])>>31) | ((uint32_t(mVec[1])>>31)<<1) | ((uint32_t(mVec[2])>>31)<<2); } diff --git a/openvdb/openvdb/math/Coord.h b/openvdb/openvdb/math/Coord.h index 54d3294355..00589fa598 100644 --- a/openvdb/openvdb/math/Coord.h +++ b/openvdb/openvdb/math/Coord.h @@ -224,13 +224,15 @@ class Coord /// @brief Return a hash value for this coordinate /// @note Log2N is the binary logarithm of the hash table size. - /// @details The hash function is taken from the SIGGRAPH paper: + /// @details The hash function is originally taken from the SIGGRAPH paper: /// "VDB: High-resolution sparse volumes with dynamic topology" + /// and the prime numbers are modified based on the ACM Transactions on Graphics paper: + /// "Real-time 3D reconstruction at scale using voxel hashing" template size_t hash() const { const uint32_t* vec = reinterpret_cast(mVec.data()); - return ((1<