# GSplatParams

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/scene/gsplat-unified/gsplat-params.js#L40

Parameters for the GSplat system.

## Constructors

### constructor

```ts
new GSplatParams(device: GraphicsDevice)
```

Creates a new GSplatParams instance.

**Parameters**

- `device` ([`GraphicsDevice`](https://api.playcanvas.com/engine/classes/GraphicsDevice.md)): The graphics device.

## Properties

### colorRampIntensity

```ts
colorRampIntensity: number = 1
```

Intensity multiplier for overdraw visualization mode. Value of 1 uses alpha of 1/32,
allowing approximately 32 overdraws to reach full brightness with additive blending.
Higher values increase brightness per splat. Defaults to 1.

### colorUpdateAngle

```ts
colorUpdateAngle: number = 10
```

Viewing angle threshold in degrees for triggering spherical harmonics color updates.
When the camera translates enough to change the viewing angle to an octree node or
splat by this amount, its SH colors are re-evaluated. Distant nodes naturally update
less frequently since they require more camera movement to reach the angle threshold.
An orthographic camera views all splats along its forward direction, so their colors are
re-evaluated together once the camera rotates by this amount, and moving it has no effect.
Set to 0 to update every frame where camera moves. Defaults to 10.

### cooldownTicks

```ts
cooldownTicks: number = 100
```

Number of update ticks before unloading unused streamed resources. When a streamed resource's
reference count reaches zero, it enters a cooldown period before being unloaded. This allows
recently used data to remain in memory for quick reuse if needed again soon. Set to 0 to
unload immediately when unused. Defaults to 100.

### dither

```ts
dither: string = DITHER_BLUENOISE
```

The noise pattern the coverage of a [GSplatParams#stochastic](https://api.playcanvas.com/engine/classes/GSplatParams.md#stochastic) splat is dithered
against, ignored when `stochastic` is false. Can be:

- [DITHER_BAYER2](https://api.playcanvas.com/engine/variables/DITHER_BAYER2.md): Coverage is dithered using a Bayer 2 matrix.
- [DITHER_BAYER4](https://api.playcanvas.com/engine/variables/DITHER_BAYER4.md): Coverage is dithered using a Bayer 4 matrix.
- [DITHER_BAYER8](https://api.playcanvas.com/engine/variables/DITHER_BAYER8.md): Coverage is dithered using a Bayer 8 matrix.
- [DITHER_BAYER16](https://api.playcanvas.com/engine/variables/DITHER_BAYER16.md): Coverage is dithered using a Bayer 16 matrix.
- [DITHER_BLUENOISE](https://api.playcanvas.com/engine/variables/DITHER_BLUENOISE.md): Coverage is dithered using a blue noise.
- [DITHER_IGNNOISE](https://api.playcanvas.com/engine/variables/DITHER_IGNNOISE.md): Coverage is dithered using an interleaved gradient noise.

Defaults to [DITHER_BLUENOISE](https://api.playcanvas.com/engine/variables/DITHER_BLUENOISE.md), which looks best under temporal anti-aliasing.
[DITHER_NONE](https://api.playcanvas.com/engine/variables/DITHER_NONE.md) is not a coverage pattern, so it is not accepted here - turn
`stochastic` off instead.

### lodUpdateAngle

```ts
lodUpdateAngle: number = 90
```

Angle threshold in degrees to trigger LOD updates based on camera rotation. Set to 0 to
disable rotation-based updates. Rotation only affects LOD through [lodBehindPenalty](https://api.playcanvas.com/engine/classes/GSplatParams.md#lodbehindpenalty),
so rotation-based updates also stop when the penalty is 1. Defaults to 90.

### lodUpdateDistance

```ts
lodUpdateDistance: number = 1
```

Distance threshold in world units to trigger LOD updates for camera and gsplat instances.
Defaults to 1.

### radialSorting

```ts
radialSorting: boolean = false
```

Enables radial sorting based on distance from camera (for cubemap rendering). When false,
uses directional sorting along camera forward vector. Defaults to false.

Note: Radial sorting helps reduce sorting artifacts when the camera rotates (looks around),
while linear sorting is better at minimizing artifacts when the camera translates (moves).

### sceneDepthWrite

```ts
sceneDepthWrite: boolean = false
```

Whether the gaussian splats contribute to the scene depth, which the volumetric fog and the depth
of field need in order to be bounded by the splats instead of drawing through them.

This costs an extra full screen render target, and so defaults to false. Enable it for a scene
where the splats need to take part in those effects. Requires the camera to render using
[CameraFrame](https://api.playcanvas.com/engine/classes/CameraFrame.md) - see [CameraFrame.isSplatSceneDepthSupported](https://api.playcanvas.com/engine/classes/CameraFrame.md#issplatscenedepthsupported).

On some devices enabling this stores the scene depth at a lower precision, which the other
effects using it share. The depth stays accurate over camera clip distances of roughly 0.000015
to 16384 there; past the far end of that a distant depth loses accuracy, and the pixels nothing
covers stop reading as far away as they are. Keep the far clip inside that range on those
devices, or leave the effects which read the depth off.

### stochastic

```ts
stochastic: boolean = false
```

Enables stochastic alpha rendering on the WebGPU GPU-sort renderer. Splats are drawn
without sorting, using dithered coverage, opaque blending and depth writes. Ignored by
the CPU-sort renderer. Picking continues to use sorted rendering. Defaults to false.
Applications can customize the sampling through the material's opacityDitherPS chunk.

### useFog

```ts
useFog: boolean = true
```

Whether to apply scene fog to Gaussian splats. When false, splats ignore fog settings
even if the scene or camera has fog configured. Defaults to true.

### useTonemap

```ts
useTonemap: boolean = true
```

Whether to apply the camera's tonemapping and the scene exposure to Gaussian splats. When
false, splats render with their stored colors, unaffected by [Scene#exposure](https://api.playcanvas.com/engine/classes/Scene.md#exposure) and the
camera's [CameraComponent#toneMapping](https://api.playcanvas.com/engine/classes/CameraComponent.md#tonemapping). Fog, when enabled, still applies. Defaults to
true.

## Accessors

### alphaClip

```ts
get alphaClip(): number
set alphaClip(value: number)
```

Gets the alpha threshold for shadow, pick, and prepass rendering.

### alphaClipForward

```ts
get alphaClipForward(): number
set alphaClipForward(value: number)
```

Gets the forward-pass alpha threshold.

### antiAlias

```ts
get antiAlias(): boolean
set antiAlias(value: boolean)
```

Gets whether anti-aliasing compensation is enabled.

### colorizeColorUpdate

```ts
get colorizeColorUpdate(): boolean
set colorizeColorUpdate(value: boolean)
```

**Deprecated**: Use [debug](https://api.playcanvas.com/engine/classes/GSplatParams.md#debug) with [GSPLAT_DEBUG_SH_UPDATE](https://api.playcanvas.com/engine/variables/GSPLAT_DEBUG_SH_UPDATE.md) instead.

### colorRamp

```ts
get colorRamp(): Texture | null
set colorRamp(value: Texture | null)
```

Gets the color ramp texture for overdraw visualization.

### currentRenderer

```ts
get currentRenderer(): number
```

The current rendering pipeline in effect after platform-based fallback resolution. When
[renderer](https://api.playcanvas.com/engine/classes/GSplatParams.md#renderer) is set to a mode requiring WebGPU on a WebGL device, this returns the
fallback mode actually being used.

### dataFormat

```ts
get dataFormat(): string
set dataFormat(value: string)
```

Gets the work buffer data format.

### debug

```ts
get debug(): number
set debug(value: number)
```

Gets the debug rendering mode for Gaussian splats.

### enableIds

```ts
get enableIds(): boolean
set enableIds(value: boolean)
```

Gets the ID storage enabled state.

### fisheye

```ts
get fisheye(): number
set fisheye(value: number)
```

Gets the fisheye projection strength.

### format

```ts
get format(): GSplatFormat
```

Format descriptor for work buffer streams. Describes the textures used by the work buffer
for intermediate storage during rendering. Users can add extra streams via
[GSplatFormat#addExtraStreams](https://api.playcanvas.com/engine/classes/GSplatFormat.md#addextrastreams) for custom per-splat data.

**Example**

```ts
// Add a custom stream to store per-splat component IDs
app.scene.gsplat.format.addExtraStreams([{
    name: 'splatId',
    format: PIXELFORMAT_R32U
}]);
```

### foveationCenter

```ts
get foveationCenter(): number
set foveationCenter(value: number)
```

Gets the protected centre radius for foveated contribution culling.

### foveationStrength

```ts
get foveationStrength(): number
set foveationStrength(value: number)
```

Gets the foveated contribution culling strength.

### lodBehindPenalty

```ts
get lodBehindPenalty(): number
set lodBehindPenalty(value: number)
```

Gets behind-camera LOD penalty multiplier.

### lodUnderfillLimit

```ts
get lodUnderfillLimit(): number
set lodUnderfillLimit(value: number)
```

Gets the maximum allowed underfill LOD range.

### material

```ts
get material(): ShaderMaterial
```

A material template that can be customized by the user. Any defines, parameters, or shader
chunks set on this material will be automatically applied to all GSplat components. After
making changes, call [Material#update](https://api.playcanvas.com/engine/classes/Material.md#update) to for the changes to be applied on the next
frame.

**Example**

```ts
// Set a custom parameter on all GSplat materials
app.scene.gsplat.material.setParameter('myCustomParam', 1.0);
app.scene.gsplat.material.update();
```

### minContribution

```ts
get minContribution(): number
set minContribution(value: number)
```

Gets the minimum contribution threshold.

### minPixelSize

```ts
get minPixelSize(): number
set minPixelSize(value: number)
```

Gets the minimum pixel size threshold.

### renderer

```ts
get renderer(): number
set renderer(value: number)
```

Gets the requested rendering pipeline for gaussian splatting. This may differ from
[currentRenderer](https://api.playcanvas.com/engine/classes/GSplatParams.md#currentrenderer) when a WebGPU mode falls back on a WebGL device.

### splatBudget

```ts
get splatBudget(): number
set splatBudget(value: number)
```

Gets the number of splats across all GSplats in the scene.

### splatBudgetMode

```ts
get splatBudgetMode(): string
set splatBudgetMode(value: string)
```

Gets how the splat budget is used.

### twoDimensional

```ts
get twoDimensional(): boolean
set twoDimensional(value: boolean)
```

Gets whether 2D Gaussian Splatting mode is enabled.

### varyings

```ts
get varyings(): GSplatVaryings
```

Custom varying streams for the gsplat render customization: per-splat values written by
the `gsplatModifyVS` shader chunk and read per fragment by the `gsplatModifyPS` shader
chunk. See [GSplatVaryings](https://api.playcanvas.com/engine/classes/GSplatVaryings.md).

**Example**

```ts
// 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: TYPE_UINT32,
    components: 1
}]);
```
