Skip to content

Fix artifacts when sampling AMR volume#35

Merged
johguenther merged 2 commits intodevelfrom
guj/fixes
Mar 25, 2026
Merged

Fix artifacts when sampling AMR volume#35
johguenther merged 2 commits intodevelfrom
guj/fixes

Conversation

@johguenther
Copy link
Copy Markdown
Contributor

No description provided.

@johguenther johguenther requested a review from Copilot March 25, 2026 08:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates AMR sampling to avoid boundary-related artifacts (notably at relBrickPos == 1.0) by clamping brick-relative coordinates and simplifying shared dual-cell interpolation helpers across CPU/GPU paths.

Changes:

  • Clamp relBrickPos to < 1.0 (1 ULP below) before computing brick-cell indices (CPU ISPC and GPU compute).
  • Refactor initDualCell overloads and lerp() helpers to reduce duplication and align CPU/GPU implementations.
  • Remove the nextafter()-shrunk f_dims workaround and rely on explicit coordinate clamping instead.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
openvkl/devices/gpu/compute/amr/DualCell.h Refactors initDualCell and lerp helpers to reduce duplication.
openvkl/devices/gpu/compute/amr/CellRef.h Adds explicit clamp of brick-relative coordinates to avoid out-of-range indexing at the upper boundary.
openvkl/devices/cpu/volume/amr/DualCell.ih Mirrors DualCell refactors (overload forwarding + lerp helper reuse).
openvkl/devices/cpu/volume/amr/CellRef.ispc Adds the same boundary clamp in CPU ISPC code paths.
openvkl/devices/cpu/volume/amr/AMRData.cpp Removes nextafter() shrink for f_dims and uses exact dims as floats.
CHANGELOG.md Documents the AMR sampling artifact fix for 2.0.3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +61 to +62
const vec3f relBrickPos =
min(relBrickPosUnclamped, vec3f(0x1.fffffep-1f));
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clamp uses a hard-to-read hex float literal (0x1.fffffep-1f) to represent the largest float < 1.0. Consider defining this as a named constant (or computing it via nextafter(1.f, 0.f)) to make the intent clearer and avoid duplicating the literal elsewhere.

Copilot uses AI. Check for mistakes.
@johguenther johguenther merged commit 621b774 into devel Mar 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants