AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

Overhauled OpenVDB Clip SOP camera frustum padding + misc QOL changes #1818

Open kjyager opened 4 months ago

kjyager commented 4 months ago

The Clip SOPs handling of frustum clipping was odd in several ways, and this caused confusion among users. Padding in particular was opaque and unintuitive.

This change implements more consistent and explainable padding for the camera clipping mode. Padding is specified and applied in normalized device coordinates. Rather than reading the same float3 padding parm used by the other modes, this new implementation adds float2 parms 'padwinx' and 'padwiny', specifying the amount of padding to add on the left/right and top/bottom sides of the camera frustum. These are enabled only in camera mode. Padding is applied symmetrically by default, similar to the old method, but can be made asymmetric by unlinking the parameters. There is no Z-axis padding value, as the near/far plane override parameters make this functionality redundant.

A legacycamclip toggle was added to optionally revert back to the original implementation for compatibility reasons.

To implement this change, it was necessary to make minor modifications to the clipping implementation in the OpenVDB library. A padding arg was added for the camera frustum signature of clip. A similar change was made to the hvdb::drawFrustum() function. All other changes were made just to the SOP itself.

Additional Changes:

linux-foundation-easycla[bot] commented 4 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

matthewlow-dwa commented 4 months ago

/easycla

matthewlow-dwa commented 4 months ago

/easycla

kjyager commented 4 months ago

Suggesting that Jeff Lait also review