Source code for fvdb.enums

# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: Apache-2.0
#

from enum import Enum, IntEnum


[docs] class ShOrderingMode(str, Enum): """ Enum representing spherical harmonics ordering modes used by Gaussian Splats.. Spherical harmonics for Gaussian splatting can be stored differently in memory depending on the application. For example, PLY files store spherical harmonics in ``RRR_GGG_BBB`` order, while some rendering codes (including :class:`fvdb.GaussianSplat3d`) use ``RGB_RGB_RGB`` order. This enum defines two common ordering modes: - ``RGB_RGB_RGB``: The feature channels are interleaved for each coefficient. *i.e.* The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape ``[num_coefficients, num_sh_bases, channels]``, where channels=3 for RGB. - ``RRR_GGG_BBB``: The feature channels are stored in separate blocks for each coefficient. *i.e.* The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape ``[num_coefficients, channels, num_sh_bases]``, where channels=3 for RGB. """ RGB_RGB_RGB = "rgb_rgb_rgb" """ The feature channels of spherical harmonics are interleaved for each coefficient. *i.e.* The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape ``[num_coefficients, num_sh_bases, channels]``, where channels=3 for RGB. """ RRR_GGG_BBB = "rrr_ggg_bbb" """ The feature channels of spherical harmonics are stored in separate blocks for each coefficient. *i.e.* The spherical harmonics tensor corresponds to a (row-major) contiguous tensor of shape ``[num_coefficients, channels, num_sh_bases]``, where channels=3 for RGB. """
class SmoothingMode(IntEnum): """ Laplacian smoothing mode used to de-staircase a signed distance field in :meth:`fvdb.Grid.reinitialize_sdf` / :meth:`fvdb.Grid.retopologize_sdf` (and their :class:`fvdb.GridBatch` counterparts). The number of smoothing passes is controlled separately by the ``smooth`` argument; this enum selects *which* umbrella-Laplacian flow each pass applies. Values mirror the C++ ``fvdb::detail::ops::SmoothingMode`` enum. """ MEAN_CURVATURE = 0 """ Mean-curvature flow: each pass moves every voxel toward the average of its 6 face neighbours. Effective at removing staircase artifacts but shrinks the surface (volume loss) if over-applied. """ TAUBIN = 1 """ Volume-preserving Taubin smoothing: alternates a positive (shrinking) and a slightly larger negative (inflating) Laplacian step per pass, de-staircasing with much less volume loss. """
[docs] class RollingShutterType(IntEnum): """ Rolling shutter policy for camera projection / ray generation. Rolling shutter models treat different image rows/columns as having different exposure times. FVDB uses this to interpolate between per-camera start/end poses when generating rays. """ NONE = 0 """ No rolling shutter: the start pose is used for all pixels. """ VERTICAL = 1 """ Vertical rolling shutter: exposure time varies with image row (y). """ HORIZONTAL = 2 """ Horizontal rolling shutter: exposure time varies with image column (x). """
[docs] class CameraModel(IntEnum): """ Camera model for projection / ray generation. Notes: - ``PINHOLE`` and ``ORTHOGRAPHIC`` ignore distortion coefficients. - ``OPENCV_*`` variants use pinhole intrinsics plus OpenCV-style distortion. When distortion coefficients are provided, FVDB expects a packed layout: ``[k1,k2,k3,k4,k5,k6,p1,p2,s1,s2,s3,s4]`` Unused coefficients for a given model should be set to 0. """ PINHOLE = 0 """ Ideal pinhole camera model (no distortion). """ OPENCV_RADTAN_5 = 1 """ OpenCV radial-tangential distortion with 5 parameters (k1,k2,p1,p2,k3). """ OPENCV_RATIONAL_8 = 2 """ OpenCV rational radial-tangential distortion with 8 parameters (k1..k6,p1,p2). """ OPENCV_RADTAN_THIN_PRISM_9 = 3 """ OpenCV radial-tangential + thin-prism distortion with 9 parameters (k1,k2,p1,p2,k3,s1..s4). """ OPENCV_THIN_PRISM_12 = 4 """ OpenCV rational radial-tangential + thin-prism distortion with 12 parameters (k1..k6,p1,p2,s1..s4). """ ORTHOGRAPHIC = 5 """ Orthographic camera model (no distortion). """
[docs] class ProjectionMethod(IntEnum): """ Projection implementation selector for Gaussian splatting camera models. """ AUTO = 0 """ Choose the default implementation for the selected camera model. """ ANALYTIC = 1 """ Use the analytic projection path. """ UNSCENTED = 2 """ Use the unscented projection path. """