mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.1k stars 246 forks source link

Allow vectorized vcalls of Mesh methods #1319

Closed merlinND closed 1 month ago

merlinND commented 1 month ago

Description

Allows accessing the Mesh interface through a new MeshPtr type. This will allow users to access the Mesh interface through a new MeshPtr. Before, it was only accessible on the individual Mesh instances (no vectorized calls).

meshes = mi.MeshPtr(si.shape)
# Not strictly needed, the non-mesh pointers are automatically zeroed-out
active &= si.shape.is_mesh() 

n = meshes.face_normal(si.prim_index, active=active)

Requires a DrJit-side change to allow CallSupport<Mesh>: https://github.com/mitsuba-renderer/drjit/pull/287

Testing

Added a unit test that checks the results of the vcall on MeshPtr against calls on the individual mesh instances.

Checklist

merlinND commented 1 month ago

Thank you! I rebased and applied the fix.

njroussel commented 1 month ago

Looks good now. Thank you!