playcanvas
Version:
PlayCanvas WebGL game engine
231 lines (230 loc) • 7.64 kB
TypeScript
/**
* @import { Texture } from '../../platform/graphics/texture.js'
*/
/**
* Parameters for GSplat unified system.
*
* @category Graphics
*/
export class GSplatParams {
/**
* Enables debug rendering of AABBs for GSplat objects. Defaults to false.
*
* @type {boolean}
*/
debugAabbs: boolean;
/**
* 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).
*
* @type {boolean}
*/
radialSorting: boolean;
/**
* Enables debug rendering of AABBs for GSplat octree nodes. Defaults to false.
*
* @type {boolean}
*/
debugNodeAabbs: boolean;
/**
* Internal dirty flag to trigger update of gsplat managers when some params change.
*
* @ignore
* @type {boolean}
*/
dirty: boolean;
/**
* @type {boolean}
* @private
*/
private _colorizeLod;
/**
* Enables colorization by selected LOD level when rendering GSplat objects. Defaults to false.
* Marks params dirty on change.
*
* @type {boolean}
*/
set colorizeLod(value: boolean);
/**
* Gets colorize-by-LOD flag.
*
* @returns {boolean} Current enabled state.
*/
get colorizeLod(): boolean;
/**
* Distance threshold in world units to trigger LOD updates for camera and gsplat instances.
* Defaults to 1.
*
* @type {number}
*/
lodUpdateDistance: number;
/**
* Angle threshold in degrees to trigger LOD updates based on camera rotation. Set to 0 to
* disable rotation-based updates. Defaults to 0.
*
* @type {number}
*/
lodUpdateAngle: number;
/**
* @type {number}
* @private
*/
private _lodBehindPenalty;
/**
* Multiplier applied to effective distance for nodes behind the camera when determining LOD.
* Value 1 means no penalty; higher values drop LOD faster for nodes behind the camera.
*
* Note: when using a penalty > 1, it often makes sense to set a positive
* {@link GSplatParams#lodUpdateAngle} so LOD is re-evaluated on camera rotation,
* not just translation.
*
* @type {number}
*/
set lodBehindPenalty(value: number);
/**
* Gets behind-camera LOD penalty multiplier.
*
* @type {number}
*/
get lodBehindPenalty(): number;
/**
* @type {number}
* @private
*/
private _lodRangeMin;
/**
* Minimum allowed LOD index (inclusive). Defaults to 0.
*
* @type {number}
*/
set lodRangeMin(value: number);
/**
* Gets minimum allowed LOD index (inclusive).
*
* @type {number}
*/
get lodRangeMin(): number;
/**
* @type {number}
* @private
*/
private _lodRangeMax;
/**
* Maximum allowed LOD index (inclusive). Defaults to 10.
*
* @type {number}
*/
set lodRangeMax(value: number);
/**
* Gets maximum allowed LOD index (inclusive).
*
* @type {number}
*/
get lodRangeMax(): number;
/**
* @type {number}
* @private
*/
private _lodUnderfillLimit;
/**
* Maximum number of LOD levels allowed below the optimal level when the optimal data is not
* resident in memory. The system may temporarily use a coarser LOD within this limit until the
* optimal LOD is available. Defaults to 0, which disables fallback (always load optimal).
* Higher values allow faster loading by using lower-quality data.
*
* @type {number}
*/
set lodUnderfillLimit(value: number);
/**
* Gets the maximum allowed underfill LOD range.
*
* @type {number}
*/
get lodUnderfillLimit(): number;
set splatBudget(value: number);
get splatBudget(): number;
/**
* @type {import('../../platform/graphics/texture.js').Texture|null}
* @private
*/
private _colorRamp;
/**
* Gradient texture for elevation-based coloring in overdraw visualization mode.
* When set, enables overdraw mode with additive blending. When null, uses normal rendering.
* Texture should be (width x 1) size. World Y coordinate (0-20 range) maps to texture U coordinate.
* Defaults to null.
*
* @type {Texture|null}
*/
set colorRamp(value: import("../../platform/graphics/texture.js").Texture | null);
/**
* Gets the color ramp texture for overdraw visualization.
*
* @type {import('../../platform/graphics/texture.js').Texture|null}
*/
get colorRamp(): import("../../platform/graphics/texture.js").Texture | null;
/**
* 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.
*
* @type {number}
*/
colorRampIntensity: number;
/**
* Enables debug colorization to visualize when spherical harmonics are evaluated.
* When true, each update pass renders with a random color to visualize the behavior
* of colorUpdateDistance and colorUpdateAngle thresholds. Defaults to false.
*
* @type {boolean}
*/
colorizeColorUpdate: boolean;
/**
* Distance threshold in world units for triggering spherical harmonics color updates.
* Used to control how often SH evaluation occurs based on camera translation.
* Only affects resources with spherical harmonics data. Set to 0 to update on
* every frame where camera moves. Defaults to 0.2.
*
* @type {number}
*/
colorUpdateDistance: number;
/**
* Angle threshold in degrees for triggering spherical harmonics color updates.
* Used to control how often SH evaluation occurs based on camera rotation.
* Only affects resources with spherical harmonics data. Set to 0 to update on
* every frame where camera rotates. Defaults to 2.
*
* @type {number}
*/
colorUpdateAngle: number;
/**
* Scale factor applied to colorUpdateDistance for each LOD level.
* Each LOD level multiplies the threshold by this value raised to the power of lodIndex.
* For example, with scale=2: LOD 0 uses 1x threshold, LOD 1 uses 2x, LOD 2 uses 4x.
* Higher values relax thresholds more aggressively for distant geometry. Defaults to 2.
*
* @type {number}
*/
colorUpdateDistanceLodScale: number;
/**
* Scale factor applied to colorUpdateAngle for each LOD level.
* Each LOD level multiplies the threshold by this value raised to the power of lodIndex.
* For example, with scale=2: LOD 0 uses 1x threshold, LOD 1 uses 2x, LOD 2 uses 4x.
* Higher values relax thresholds more aggressively for distant geometry. Defaults to 2.
*
* @type {number}
*/
colorUpdateAngleLodScale: number;
/**
* 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.
*
* @type {number}
*/
cooldownTicks: number;
}