Engine API Reference - v2.20.0-beta.0
    Preparing search index...

    Class GSplatFormat

    Gsplat resources store per-splat data (positions, colors, rotations, scales, spherical harmonics) in GPU textures. This class describes those texture streams and generates the shader code needed to access them.

    Each stream defines a texture with a name and pixel format. The class automatically generates shader declarations (uniforms/samplers) and load functions (e.g. loadColor()) for each stream. A read shader can be provided to define how splat attributes are extracted from these textures.

    Users can add extra streams via addExtraStreams for custom per-splat data. These can be per-resource (shared across instances) or per-instance (unique to each gsplat component).

    For loaded gsplat resources, base streams are automatically configured based on the loaded data format. For GSplatContainer, users define both base and extra streams to specify the complete data layout.

    Index

    Constructors

    • Creates a new GSplatFormat instance.

      Parameters

      • device: GraphicsDevice

        The graphics device.

      • streams: GSplatStreamDescriptor[]

        Array of stream descriptors.

      • options: { readGLSL?: string; readWGSL?: string }

        Format options.

        • OptionalreadGLSL?: string

          GLSL code defining getCenter(), getColor(), getRotation(), getScale() functions. Can include additional declarations at module scope. Required for WebGL.

        • OptionalreadWGSL?: string

          WGSL code defining getCenter(), getColor(), getRotation(), getScale() functions. Can include additional declarations at module scope. Required for WebGPU.

      Returns GSplatFormat

    Properties

    Array of stream descriptors.

    Accessors

    Methods

    • Adds additional texture streams for custom gsplat data. Each stream defines a texture that can store extra information, accessible in shaders via generated load functions. Streams with storage: GSPLAT_STREAM_INSTANCE are created per gsplat component instance, while others are shared across all instances of the same resource.

      Note: Streams cannot be removed once added currently.

      Parameters

      Returns void

    • Creates a default format using 32F/16F textures, simple to use for CPU data population. This format can be rendered to by GSplatProcessor when supported. Check GraphicsDevice#textureFloatRenderable (for RGBA32F) and GraphicsDevice#textureHalfFloatRenderable (for RGBA16F).

      The format stores:

      • dataColor (RGBA16F): color.rgba as half floats
      • dataCenter (RGBA32F): center.xyz as floats (w unused)
      • dataScale (RGBA16F): scale.xyz as half floats (w unused)
      • dataRotation (RGBA16F): rotation.xyzw as half floats (w stored directly, not derived)

      Parameters

      Returns GSplatFormat

      The default format.

    • Creates a simple format with uniform-scale splats and no rotation. Streams:

      • dataCenter (RGBA32F): center.xyz + uniform size in w
      • dataColor (RGBA16F): color.rgba as half floats

      Parameters

      Returns GSplatFormat

      The simple format.