newton.Gaussian#

class newton.Gaussian(positions, rotations=None, scales=None, opacities=None, sh_coeffs=None, sh_degree=None, min_response=0.1)[source]#

Bases: object

Represents a Gaussian splat asset for rendering and rigid body attachment.

A Gaussian splat is a collection of oriented, scaled 3D Gaussians with appearance data (color via spherical harmonics or flat RGB). Gaussian objects can be attached to rigid bodies as a shape type (GeoType.GAUSSIAN) for rendering, with collision handled by an optional proxy geometry.

Example

Load a Gaussian splat from a .ply file and inspect it:

import newton

gaussian = newton.Gaussian.create_from_ply("object.ply")
print(gaussian.count, gaussian.sh_degree)
static create_from_ply(filename, min_response=0.1)#

Load Gaussian splat data from a .ply file (standard 3DGS format).

Reads positions (x/y/z), rotations (rot_0..3), scales (scale_0..2, stored as log-scale), opacities (logit-space), and SH coefficients (f_dc_*, f_rest_*). Converts log-scale and logit-opacity to linear values.

Parameters:
  • filename (str) – Path to a .ply file in standard 3DGS format.

  • min_response (float) – Min response (default = 0.1).

Returns:

A new Gaussian instance.

Return type:

Gaussian

static create_from_usd(prim, min_response=0.1)#

Load Gaussian splat data from a USD prim.

Reads positions from attributes: positions, orientations, scales, opacities and radiance:sphericalHarmonicsCoefficients.

Parameters:
  • prim – A USD prim containing Gaussian splat data.

  • min_response (float) – Min response (default = 0.1).

Returns:

A new Gaussian instance.

Return type:

Gaussian

__init__(positions, rotations=None, scales=None, opacities=None, sh_coeffs=None, sh_degree=None, min_response=0.1)#

Construct a Gaussian splat asset from arrays.

Parameters:
  • positions (ndarray) – Gaussian centers in local space [m], shape (N, 3), float.

  • rotations (ndarray | None) – Quaternion orientations (x, y, z, w), shape (N, 4), float. If None, defaults to identity quaternions.

  • scales (ndarray | None) – Per-axis scales (linear), shape (N, 3), float. If None, defaults to ones.

  • opacities (ndarray | None) – Opacity values [0, 1], shape (N,), float. If None, defaults to ones (fully opaque).

  • sh_coeffs (ndarray | None) – Spherical harmonic coefficients, shape (N, C), float. The number of coefficients C determines the SH degree (C = 3 -> degree 0, C = 12 -> degree 1, etc.).

  • sh_degree (int | None) – Spherical harmonic degree.

  • min_response (float) – Minimum response required for alpha testing.

compute_aabb()#

Compute axis-aligned bounding box of Gaussian centers.

Returns:

Tuple of (lower, upper) as (3,) arrays [m].

Return type:

tuple[ndarray, ndarray]

compute_proxy_mesh(method='convex_hull')#

Generate a proxy collision Mesh from Gaussian positions.

Parameters:

method (str) – "convex_hull" (default) or "alphashape" or "points".

Returns:

A Mesh for use as collision proxy.

Return type:

Mesh

finalize(device=None)#

Upload Gaussian data to the GPU as Warp arrays.

Parameters:

device (Device | str | None) – Device on which to allocate buffers.

Returns:

Gaussian.Data struct containing the Warp arrays.

Return type:

Data

property count: int#

Number of Gaussians in this asset.

property min_response: float#

Min response, float.

property opacities: ndarray#

Opacity values [0, 1], shape (N,), float.

property positions: ndarray#

Gaussian centers in local space [m], shape (N, 3), float.

property rotations: ndarray#

Quaternion orientations (x, y, z, w), shape (N, 4), float.

property scales: ndarray#

Per-axis linear scales, shape (N, 3), float.

property sh_coeffs: ndarray | None#

Spherical harmonic coefficients, shape (N, C), float.

property sh_degree: int#

Spherical harmonics degree (0-3), int