Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::datatypes::SphericalHarmonics3Rgb Struct Reference

Datatype: Spherical harmonics coefficients of degrees 1 through 3 for RGB, as 15 half-precision RGB triples. More...

#include <rerun/datatypes/spherical_harmonics3rgb.hpp>

Public Member Functions

 SphericalHarmonics3Rgb (const std::array< std::array< float, 3 >, NUM_COEFFICIENTS > &coefficients_)
 Construct from 15 RGB coefficient triples of float, converting each to half-precision.
 
 SphericalHarmonics3Rgb (std::array< std::array< rerun::half, 3 >, 15 > coefficients_)
 
SphericalHarmonics3Rgboperator= (std::array< std::array< rerun::half, 3 >, 15 > coefficients_)
 

Public Attributes

std::array< std::array< rerun::half, 3 >, 15 > coefficients
 Spherical harmonics coefficients of degrees 1 through 3, coefficient-major.
 

Static Public Attributes

static constexpr size_t NUM_COEFFICIENTS = 15
 The number of coefficients of degrees 1 through 3, i.e. the number of RGB triples.
 

Detailed Description

Datatype: Spherical harmonics coefficients of degrees 1 through 3 for RGB, as 15 half-precision RGB triples.

The coefficients are stored coefficient-major: [c1.rgb, c2.rgb, …, c15.rgb]. The 15 coefficients c1…c15 are ordered by ascending degree l = 1, 2, 3, and within each degree by ascending order m = -l … +l: degree 1 is c1…c3, degree 2 is c4…c8, and degree 3 is c9…c15. The degrees are not exposed as separate groups, since each degree has a different number of coefficients (3, 5, and 7).

This per-coefficient order matches the f_rest_* properties of the PLY files used by 3D Gaussian Splatting (Kerbl et al., 2023), but those store the channels channel-major (all 15 coefficients of R, then G, then B), so they must be transposed on import.

The degree-0 (DC) term is not included — it is represented as a datatypes::Rgba32 color instead.

Data of a lower spherical harmonics degree should be zero-padded, which represents the exact same function (the spherical harmonics basis is orthonormal). Conversely, truncating trailing coefficients at the degree boundaries (3 and 8 triples) yields the optimal least-squares approximation of that lower degree.

This type is unstable and may change significantly in a way that the data won't be backwards compatible.


The documentation for this struct was generated from the following file: