Skip to content

Commit

Permalink
iterator context: fix mapping of intervalResolutionHint for BVH-based…
Browse files Browse the repository at this point in the history
… iterators and bvhDepth <= 1.
  • Loading branch information
gregjohnson committed Sep 14, 2021
1 parent 034cc06 commit 37af653
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions openvkl/devices/cpu/iterator/IteratorContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ namespace openvkl {
const float defaultRangeBegin = 0.45f;
const float defaultRangeEnd = 0.55f;

for (int i = 0; i <= defaultDepth; i++) {
float f = float(i) / float(defaultDepth) * defaultRangeBegin;
hintToDepth.emplace_back(f, i);
// mapping defined for intervalResolutionHint in [0, defaultRangeBegin]
if (defaultDepth == 0) {
hintToDepth.emplace_back(0.f, 0);
} else {
for (int i = 0; i <= defaultDepth; i++) {
float f = float(i) / float(defaultDepth) * defaultRangeBegin;
hintToDepth.emplace_back(f, i);
}
}

// mapping defined for intervalResolutionHint in [defaultRangeEnd, 1)
for (int i = defaultDepth + 1; i <= bvhDepth - 1; i++) {
float f = defaultRangeEnd + float(i - (defaultDepth + 1)) /
float(bvhDepth - (defaultDepth + 1)) *
Expand All @@ -84,6 +90,7 @@ namespace openvkl {
hintToDepth.emplace_back(f, i);
}

// mapping defined for intervalResolutionHint == 1
hintToDepth.emplace_back(1.f, bvhDepth);
}

Expand Down

0 comments on commit 37af653

Please sign in to comment.