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

    Class GSplatVaryings

    Manages custom varying streams for the gsplat render customization. Streams added here generate set functions available to the gsplatModifyVS shader chunk, where they run once per splat, and matching get functions available to the gsplatModifyPS shader chunk, where the per-splat value can be read for each rendered fragment.

    Access the instance via GSplatParams#varyings.

    Index

    Accessors

    Methods

    Accessors

    Methods

    • Adds varying streams. For each stream, a set function (set<Name>) is generated and made available to the gsplatModifyVS shader chunk, where it runs once per splat, and a matching get function (get<Name>) is made available to the gsplatModifyPS shader chunk, where the per-splat value can be read for each rendered fragment.

      Supported types are TYPE_FLOAT32, TYPE_INT32 and TYPE_UINT32, with 1 to 4 components. Adding or removing streams rebuilds the gsplat shaders.

      Note: on some platforms each component is stored in per-splat video memory, so its size scales with the number of rendered splats. Keep the data as compact as possible - prefer fewer components, and consider bit-packing multiple small values into a single uint component instead of using separate streams.

      Parameters

      Returns void

      // Add a per-splat flag, written once per splat in gsplatModifyVS using setFlag(value),
      // and read per fragment in gsplatModifyPS using getFlag()
      app.scene.gsplat.varyings.add([{
      name: 'flag',
      type: pc.TYPE_UINT32,
      components: 1
      }]);
    • Removes varying streams previously added by GSplatVaryings#add.

      Parameters

      • names: string[]

        The names of the streams to remove.

      Returns void