newton.Gaussian#
- class newton.Gaussian(positions, rotations=None, scales=None, opacities=None, sh_coeffs=None, sh_degree=None, min_response=0.1, sorting_mode=SortingMode.RAY_HIT_DISTANCE, *, sh_color_space=ColorSpace.SRGB)[source]#
Bases:
objectRepresents 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
.plyfile and inspect it:import newton gaussian = newton.Gaussian.create_from_ply("object.ply") print(gaussian.count, gaussian.sh_degree)
- class SortingMode(*values)#
Bases:
IntEnumSorting strategy for ordering Gaussian splat hits along a ray.
Controls how per-ray Gaussian intersections are depth-sorted before front-to-back alpha compositing.
- CAMERA_DISTANCE = 1#
Sort by projection of the Gaussian center onto the ray direction.
- RAY_HIT_DISTANCE = 0#
Sort by closest-approach distance in the Gaussian’s canonical space.
- Z_DEPTH = 2#
Sort by camera-forward depth of the Gaussian center.
- static create_from_ply(filename, min_response=0.1, *, sh_color_space=ColorSpace.SRGB)#
Load Gaussian splat data from a
.plyfile (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. SH radiance is treated as sRGB unlesssh_color_spacesays otherwise. Requires Open3D 0.20 or newer.
- 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. The USD color space of the SH coefficient attribute that is read (the single-precision attribute, or the half-precision one when only that has a value) selects
sh_color_space: untagged,srgb_rec709_sceneandsrgb_rec709_displayradiance isSRGB, andlin_rec709_sceneand other Rec.709 linear names areLINEAR. Other color spaces are imported without conversion and a warning is logged; see the USD parsing documentation for the full list of supported names.
- __init__(positions, rotations=None, scales=None, opacities=None, sh_coeffs=None, sh_degree=None, min_response=0.1, sorting_mode=SortingMode.RAY_HIT_DISTANCE, *, sh_color_space=ColorSpace.SRGB)#
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. IfNone, defaults to identity quaternions.scales (ndarray | None) – Per-axis scales (linear), shape
(N, 3), float. IfNone, defaults to ones.opacities (ndarray | None) – Opacity values
[0, 1], shape(N,), float. IfNone, 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.
sorting_mode (SortingMode) – Sorting strategy for depth-ordering Gaussian intersections along each ray before alpha compositing (default:
SortingMode.RAY_HIT_DISTANCE).sh_color_space (ColorSpace) – Color space of evaluated SH radiance. Defaults to sRGB (display-encoded); pass
LINEARfor scene-linear radiance. OnlySensorCamerahonors this; the deprecatedSensorTiledCameraignores it.
- bvh_refit()#
Refit the Gaussian
bvhin place for the current finalized data.Recomputes per-Gaussian bounds from the finalized GPU data and refits the BVH in place, keeping its existing topology. Call this after mutating the finalized
Dataarrays (e.g.transformsorscales) on the device so the acceleration structure tracks the moved Gaussians. Structural changes (a different Gaussian count) require a full rebuild viafinalize()instead.This mirrors
bvh_refit_shapes()for the scene shape BVH.- Raises:
RuntimeError – If
finalize()has not been called yet.
- compute_aabb()#
Compute axis-aligned bounding box of Gaussian centers.
- finalize(device=None, *, bvh_constructor=None)#
Upload Gaussian data to the GPU as Warp arrays.
- property bvh: Bvh | None#
The finalized Warp BVH over the Gaussians, or
Nonebeforefinalize().Mirrors the scene shape BVH exposed as
bvh_shapes. Usebvh_refit()to update it in place after the finalizedDataarrays change.
- property sh_color_space: ColorSpace#
Color space of evaluated spherical-harmonics radiance.
- property sorting_mode: SortingMode#
Sorting mode, Gaussian.SortingMode.
- property warp_bvh: Bvh | None#
Deprecated alias for
bvh.Deprecated since version 1.6: Use
bvhinstead.
- property warp_data: Gaussian.Data | None#
Deprecated alias for the finalized Warp Gaussian data.
Deprecated since version 1.6: Use the
Dataobject returned byfinalize()instead.