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

    Function applyLodFade

    • Apply the per-leaf LOD anti-popping opacity to a child's leaf materials, or restore the authored opacity. The effective multiplier is the product of two independent opacity terms:

      • coverageWeight = weight ?? 1 — the cross-fade blend opacity of this level (null ⇒ 1, no cross-fade in flight). Per-CHILD (the whole level).
      • energyFactor — the streaming brightness compensation 1/e(k) read PER-LEAF from committedEnergyFraction, applied only when energyComp is on AND the leaf's blend mode sums energy (BLENDABLE_MODES). Complete / unstamped / non-blendable leaves ⇒ 1.

      When the product is ≈ 1 the leaf needs no adjustment: restore the authored opacity if we had faded it (idempotent no-op otherwise) and, crucially, never clone a material we don't have to — so a steady-state / disabled / non-blendable / complete child stays byte-identical. Otherwise snapshot the authored opacity as the fade base and write base × product. Leaf materials are per-node since the material-manager rework (all three node factories stamp _layerMaterialCloned: true at creation), so in practice the write mutates the node's own material in place; the clone-on-first-use branch below is a dormant safety net for any material that ever arrives unstamped (it mirrors the layers panel's marker so the two never double-clone).

      root is a leaf mesh or a group subtree (overview/partition branch) → each fadeable leaf is visited individually, so energyFactor is genuinely per-leaf across a partition of independently-streaming leaves. registerMaterial keeps a clone-on-first-fade material receiving per-frame camera-uniform updates (wired to materialManager.register; omitted in unit tests, which run no camera loop).

      Parameters

      • root: Object3D
      • weight: number | null
      • energyComp: boolean
      • OptionalregisterMaterial: (material: Material) => void

      Returns void