Skip to content

aov.cpp, test_aov.py: fix shape_index for JIT variants - #1889

Open
LinasBeres wants to merge 1 commit into
mitsuba-renderer:masterfrom
LinasBeres:linasb_fixAOVShapeIndexJIT
Open

aov.cpp, test_aov.py: fix shape_index for JIT variants#1889
LinasBeres wants to merge 1 commit into
mitsuba-renderer:masterfrom
LinasBeres:linasb_fixAOVShapeIndexJIT

Conversation

@LinasBeres

@LinasBeres LinasBeres commented May 31, 2026

Copy link
Copy Markdown

Fix shape_index AOV for JIT/CUDA variants

Previously, the shape_index AOV reinterpreted the raw ShapePtr as a uint32, producing garbage values in JIT/CUDA variants instead of a proper scene index. This made the channel unusable for segmentation masks and per-shape identification in any JIT variant.

Further fixes #1059.

Description

The shape_index AOV channel is documented to return an integer index into the scene's shape list. In scalar variants this worked correctly. In JIT variants the raw ShapePtr value was cast to uint32, producing arbitrary large integers instead of indices in {0, 1, ..., N}.

Testing

Added test08_shape_index_correct in test_aov.py. The test renders a two-rectangle scene with an orthographic camera, box filter, and spp=1 to avoid fractional blending of indices.

Checklist

  • My code follows the style guidelines of this project
  • My changes generate no new warnings
  • My code also compiles for cuda_* and llvm_* variants. If you can't test this, please leave below
  • I have commented my code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I cleaned the commit history and removed any "Merge" commits
  • I give permission that the Mitsuba 3 project may redistribute my contributions under the terms of its license

Previously, shape_index AOV reinterpreted the raw ShapePtr as a uint32,
producing garbage values in JIT/CUDA variants instead of a proper scene
index. Fix by iterating over scene.shapes() and match the hit shape.

Also adds test08_shape_index_correct which verifies the output contains
only valid indices.

Fixes mitsuba-renderer#1059.
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.

Use shape index for segmentation mask but got weird result

1 participant