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

    Module rendering/materials/line/shader-tsl

    Line material TSL factory — NodeMaterial counterpart to the GLSL3 shaders in shader-glsl.ts.

    Renders each line segment as a screen-space-thick instanced quad. Per-vertex aQuadCorner (±1) determines:

    • x ∈ {-1, +1}: position along the segment (interpolation t).
    • y ∈ {-1, +1}: perpendicular offset (used for width expansion).

    Per-segment data comes from the RGBA32F line texture (uLineTex, 6 texels/segment — layout in rendering/line-geometry.ts / rendering/element-texture-layout.ts), fetched in the vertex stage via textureLoad and indexed by the ordering attributes:

    • aSortedIndex (uint) — draw-slot → storage-slot mapping (identity after a fresh commit; permuted by the sort worker)

    Vertex stage projects both endpoints to view/clip space, computes a per-segment pixel-width with ortho/perspective scaling, clamps to [minPixelWidth, uMaxLinePixelWidth] with an intensity-fading "vWidthFade" for near-camera degenerate cases, then expands the quad by perpendicular×pixelWidth in NDC.

    Fragment stage produces a soft line: a shifted-truncated super-Gaussian perpendicular cross-section max(exp(-K·p^beta) - C, 0)/(1-C) (beta = 2^(6s - 2), beta=2 is a truncated Gaussian) × edgeAA × widthScale × widthFade × capFactor (capFactor ramps to full intensity inside the body and dips toward 0.5 at an endpoint to form a soft cap; that dip is scaled by the endpoint's continuous cap-suppression scalar — the full soft cap at a free end or sharp bend, lifted to full intensity (cap suppressed) at a straight-through interior joint). blendingMode: 'volumetric' selects the emission–absorption output branch at graph build time (τ = κ × the same ray mass every other mode emits).

    LineTSLConfig
    LineTSLNodes
    lineWebGPUFactory
    buildLineTSLNodesFromUniforms