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:
Tooltips and documentation for the node's parameters have been updated and expanded.
Some parameters that were previously non-animatable can now be animated. There was no documented reason given for them being fixed, and I've observed no issues with their being animated. It is the padding (old and new) and near/far clipping plane parameters which have been changed.
The xVoxelCount argument of hvdb::frustumTransformFromCamera() is now set to the cameras x-resolution, avoiding the rounding error that previously made the resulting frustum slightly inaccurate.
Mask clipping mode now disables the y and z components of the 'padding' parm, to indicate that only uniform padding is supported in that mode.
When clipping in mask mode, the warning regarding nonuniform not being supported previously triggered whenever the three 'padding' values were not equal. This caused it to be raised for valid non-zero values as well. I've fixed it to trigger only when the y or z components are non-zero.
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 thehvdb::drawFrustum()
function. All other changes were made just to the SOP itself.Additional Changes:
xVoxelCount
argument ofhvdb::frustumTransformFromCamera()
is now set to the cameras x-resolution, avoiding the rounding error that previously made the resulting frustum slightly inaccurate.