Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::GaussianSplats3D Struct Reference

Archetype: 3D gaussian splats, e.g. More...

#include <rerun/archetypes/gaussian_splats3d.hpp>

Public Member Functions

 GaussianSplats3D (GaussianSplats3D &&other)=default
 
 GaussianSplats3D (const GaussianSplats3D &other)=default
 
GaussianSplats3Doperator= (const GaussianSplats3D &other)=default
 
GaussianSplats3Doperator= (GaussianSplats3D &&other)=default
 
 GaussianSplats3D (Collection< rerun::components::Position3D > _centers)
 
GaussianSplats3D with_centers (const Collection< rerun::components::Position3D > &_centers) &&
 The centers (means) of the gaussians.
 
GaussianSplats3D with_scales (const Collection< rerun::components::Scale3D > &_scales) &&
 Per-axis standard deviations of the gaussians, in scene units.
 
GaussianSplats3D with_quaternions (const Collection< rerun::components::RotationQuat > &_quaternions) &&
 The orientations of the gaussians.
 
GaussianSplats3D with_colors (const Collection< rerun::components::Color > &_colors) &&
 The base colors and opacities of the gaussians.
 
GaussianSplats3D with_sh_coefficients (const Collection< rerun::components::SphericalHarmonics3Rgb > &_sh_coefficients) &&
 Higher-order spherical harmonics coefficients for view-dependent color.
 
GaussianSplats3D with_spherical_harmonics_degree (const rerun::components::SphericalHarmonicsDegree &_spherical_harmonics_degree) &&
 The highest spherical harmonics degree to evaluate when rendering, 0-3.
 
GaussianSplats3D with_many_spherical_harmonics_degree (const Collection< rerun::components::SphericalHarmonicsDegree > &_spherical_harmonics_degree) &&
 This method makes it possible to pack multiple spherical_harmonics_degree in a single component batch.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static GaussianSplats3D update_fields ()
 Update only some specific fields of a GaussianSplats3D.
 
static GaussianSplats3D clear_fields ()
 Clear all the fields of a GaussianSplats3D.
 

Public Attributes

std::optional< ComponentBatchcenters
 The centers (means) of the gaussians.
 
std::optional< ComponentBatchscales
 Per-axis standard deviations of the gaussians, in scene units.
 
std::optional< ComponentBatchquaternions
 The orientations of the gaussians.
 
std::optional< ComponentBatchcolors
 The base colors and opacities of the gaussians.
 
std::optional< ComponentBatchsh_coefficients
 Higher-order spherical harmonics coefficients for view-dependent color.
 
std::optional< ComponentBatchspherical_harmonics_degree
 The highest spherical harmonics degree to evaluate when rendering, 0-3.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.GaussianSplats3D"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_centers
 ComponentDescriptor for the centers field.
 
static constexpr auto Descriptor_scales
 ComponentDescriptor for the scales field.
 
static constexpr auto Descriptor_quaternions
 ComponentDescriptor for the quaternions field.
 
static constexpr auto Descriptor_colors
 ComponentDescriptor for the colors field.
 
static constexpr auto Descriptor_sh_coefficients
 ComponentDescriptor for the sh_coefficients field.
 
static constexpr auto Descriptor_spherical_harmonics_degree
 ComponentDescriptor for the spherical_harmonics_degree field.
 

Detailed Description

Archetype: 3D gaussian splats, e.g.

from a 3D Gaussian Splatting (3DGS) reconstruction.

Each gaussian is an anisotropic 3D gaussian distribution: a unit isotropic gaussian scaled per-axis, rotated, and translated. The scales are the standard deviations along the principal axes, in scene units.

Note that unlike 3DGS training checkpoints (e.g. PLY files), all values are stored in their natural form: linear scales, and base colors with opacity as RGBA.

Examples

Log a few gaussian splats

#include <rerun.hpp>
int main(int argc, char* argv[]) {
const auto rec = rerun::RecordingStream("rerun_example_gaussian_splats3d");
rec.spawn().exit_on_failure();
// 15 view-dependent RGB coefficients (degrees 1-3) per splat, coefficient-major:
std::array<std::array<float, 3>, 15> red_sh, green_sh, blue_sh;
red_sh.fill({0.5f, 0.0f, 0.0f});
green_sh.fill({0.0f, 0.5f, 0.0f});
blue_sh.fill({0.0f, 0.0f, 0.5f});
rec.log(
"gaussians",
{{0.0f, 0.0f, 0.0f}, {2.0f, 0.0f, 0.0f}, {4.0f, 0.0f, 0.0f}}
)
{{1.0f, 0.5f, 0.25f}, {0.5f, 1.0f, 0.5f}, {0.25f, 0.5f, 1.0f}}
)
rerun::Quaternion::IDENTITY,
// 45 degrees around Z
rerun::Quaternion::from_xyzw(0.0f, 0.0f, 0.382683f, 0.923880f),
rerun::Quaternion::IDENTITY,
})
rerun::Rgba32(255, 0, 0, 128),
rerun::Rgba32(0, 255, 0, 200),
rerun::Rgba32(0, 0, 255, 255),
})
})
);
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:63
Archetype: 3D gaussian splats, e.g.
Definition gaussian_splats3d.hpp:101
GaussianSplats3D with_colors(const Collection< rerun::components::Color > &_colors) &&
The base colors and opacities of the gaussians.
Definition gaussian_splats3d.hpp:206
GaussianSplats3D with_sh_coefficients(const Collection< rerun::components::SphericalHarmonics3Rgb > &_sh_coefficients) &&
Higher-order spherical harmonics coefficients for view-dependent color.
Definition gaussian_splats3d.hpp:212
GaussianSplats3D with_scales(const Collection< rerun::components::Scale3D > &_scales) &&
Per-axis standard deviations of the gaussians, in scene units.
Definition gaussian_splats3d.hpp:188
GaussianSplats3D with_quaternions(const Collection< rerun::components::RotationQuat > &_quaternions) &&
The orientations of the gaussians.
Definition gaussian_splats3d.hpp:194
static Quaternion from_xyzw(float x, float y, float z, float w)
Construct Quaternion from x/y/z/w values.
Definition quaternion.hpp:32
Datatype: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition rgba32.hpp:27
Datatype: Spherical harmonics coefficients of degrees 1 through 3 for RGB, as 15 half-precision RGB t...
Definition spherical_harmonics3rgb.hpp:43

Log a 3D gaussian splatting (3DGS) PLY file

#include <rerun.hpp>
#include <iostream>
int main(int argc, char* argv[]) {
if (argc <2) {
std::cerr <<"Usage: " <<argv[0] <<" <path_to_splats.ply>"
<<std::endl;
return 1;
}
const auto path = argv[1];
const auto rec =
rerun::RecordingStream("rerun_example_gaussian_splats3d_ply");
rec.spawn().exit_on_failure();
rec.log_file_from_path(path);
}

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

Member Function Documentation

◆ with_colors()

GaussianSplats3D rerun::archetypes::GaussianSplats3D::with_colors ( const Collection< rerun::components::Color > &  _colors) &&
inline

The base colors and opacities of the gaussians.

The RGB part is the view-independent base color, i.e. the degree-0 (DC) term of the spherical harmonics. The alpha part is the peak opacity of the gaussian; the gaussian falloff further modulates it spatially.

◆ with_spherical_harmonics_degree()

GaussianSplats3D rerun::archetypes::GaussianSplats3D::with_spherical_harmonics_degree ( const rerun::components::SphericalHarmonicsDegree _spherical_harmonics_degree) &&
inline

The highest spherical harmonics degree to evaluate when rendering, 0-3.

Lower values render faster; 0 disables view-dependent color entirely. If not set, defaults to 3, i.e. all coefficients present in the data are used.

◆ with_many_spherical_harmonics_degree()

GaussianSplats3D rerun::archetypes::GaussianSplats3D::with_many_spherical_harmonics_degree ( const Collection< rerun::components::SphericalHarmonicsDegree > &  _spherical_harmonics_degree) &&
inline

This method makes it possible to pack multiple spherical_harmonics_degree in a single component batch.

This only makes sense when used in conjunction with columns. with_spherical_harmonics_degree should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::GaussianSplats3D::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::GaussianSplats3D::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ colors

std::optional<ComponentBatch> rerun::archetypes::GaussianSplats3D::colors

The base colors and opacities of the gaussians.

The RGB part is the view-independent base color, i.e. the degree-0 (DC) term of the spherical harmonics. The alpha part is the peak opacity of the gaussian; the gaussian falloff further modulates it spatially.

◆ spherical_harmonics_degree

std::optional<ComponentBatch> rerun::archetypes::GaussianSplats3D::spherical_harmonics_degree

The highest spherical harmonics degree to evaluate when rendering, 0-3.

Lower values render faster; 0 disables view-dependent color entirely. If not set, defaults to 3, i.e. all coefficients present in the data are used.

◆ Descriptor_centers

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_centers
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:centers",
Loggable<rerun::components::Position3D>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition gaussian_splats3d.hpp:128

ComponentDescriptor for the centers field.

◆ Descriptor_scales

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_scales
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:scales",
Loggable<rerun::components::Scale3D>::ComponentType
)

ComponentDescriptor for the scales field.

◆ Descriptor_quaternions

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_quaternions
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:quaternions",
Loggable<rerun::components::RotationQuat>::ComponentType
)

ComponentDescriptor for the quaternions field.

◆ Descriptor_colors

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:colors",
Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the colors field.

◆ Descriptor_sh_coefficients

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_sh_coefficients
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:sh_coefficients",
Loggable<rerun::components::SphericalHarmonics3Rgb>::ComponentType
)

ComponentDescriptor for the sh_coefficients field.

◆ Descriptor_spherical_harmonics_degree

constexpr auto rerun::archetypes::GaussianSplats3D::Descriptor_spherical_harmonics_degree
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GaussianSplats3D:spherical_harmonics_degree",
Loggable<rerun::components::SphericalHarmonicsDegree>::ComponentType
)

ComponentDescriptor for the spherical_harmonics_degree field.


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