Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Module scene/projected-density

    Projected-density tracker — elements per drawing-buffer pixel, per node.

    Frame cost on element-dense views tracks ELEMENTS PER PIXEL, not pixels: the 2026-09 audit measured a 1.5 M-point example framed into ~1 600 px at 41.7 ms per frame at DPR 1 and 83 ms at DPR 0.5 (the same fragments concentrated into fewer tiles), while the same points dollied 4× closer rendered at 120 fps. Nothing in the viewer measured that density, so the adaptive-DPR controller stepped resolution DOWN on exactly those scenes.

    This module measures it once per frame for every committed emissive data mesh (points, lines, and gsplats; shaded triangle meshes are deliberately excluded): the node's geometry.boundingSphere is projected to a screen ellipse in drawing-buffer pixels (the buffer, not CSS pixels — otherwise the guard would fight the DPR controller), and divided into the node's visible element count. Consumers: the shader keep-fraction ladder (thinning), the refinement rung cap, and __luxarDebug.getPerf().density.

    Hot-path invariants, same as lod-group-registry.ts: no per-frame allocation (module scratches, a bound visitor, per-path records mutated in place) and no scene mutation.

    ProjectedDensityTracker
    NodeDensity
    ProjectedDensityDeps
    projectSphereAreaPx
    resolveDensityGuardEnabled
    getProjectedDensityTracker
    snapshotProjectedDensity