three-virtual-geometry
Version:
Virtual geometry for three.js WebGPU: automatic cluster LOD and GPU-driven culling for billions of triangles. Independent implementation, not affiliated with Epic Games.
28 lines (27 loc) • 1.36 kB
TypeScript
/** Max triangles per meshlet. The renderer always issues `MAX_MESHLET_TRIANGLES * 3` vertices per drawn meshlet. */
export declare const MAX_MESHLET_TRIANGLES = 128;
/** Max unique vertices per meshlet (meshoptimizer allows up to 256). */
export declare const MAX_MESHLET_VERTICES = 128;
/** Stand-in for `Infinity` on the GPU: the parent error of root meshlets. */
export declare const ERROR_INFINITY = 1e+30;
/**
* Instances whose LOD range is at most this many meshlets, and where every meshlet is guaranteed to be
* selected, emit their meshlets directly from the instance pass (no meshlet pass for them).
*/
export declare const FAST_PATH_MAX_MESHLETS = 4;
/**
* Relative margin the fast path keeps from the LOD threshold, so float rounding between the bound and the
* per-meshlet test can never make the fast path select a meshlet the full test would reject.
*/
export declare const FAST_PATH_MARGIN = 0.001;
/** Floats per meshlet in `VirtualMeshData.meshletBounds` (4 x vec4). */
export declare const MESHLET_BOUNDS_STRIDE = 16;
/** Uints per meshlet in `VirtualMeshData.meshletInfo` (1 x uvec4). */
export declare const MESHLET_INFO_STRIDE = 4;
/** Debug views for `VirtualGeometry.debugMode`. */
export declare const VG_DEBUG_MODES: {
readonly shaded: 0;
readonly meshlets: 1;
readonly lodLevel: 2;
readonly instances: 3;
};