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

    Class RenderingControls

    Advanced rendering parameters GUI for real-time visual control.

    Provides comprehensive UI for controlling:

    • Post-processing effects (bloom, noise, vignette, chromatic aberration, lens distortion)
    • HDR intensity and tone mapping
    • Anti-aliasing options (FXAA, MSAA, SSAA)
    • Camera field of view (FOV and FOV presets)
    • Dynamic clipping planes for nD visualization

    Features:

    • Settings persistence per scene (localStorage)
    • Cinematic mode presets (C key for quick film-like look)
    • Real-time updates with deferred rebuild to prevent lag
    • Clean collapsible UI using custom GUI library
    • Auto-blur behavior to keep keyboard shortcuts working
    const renderingControls = new RenderingControls(
    postProcessingManager,
    sceneManager
    );

    // Associate with input handler for R key toggle
    inputHandler.setRenderingControls(renderingControls);

    // Set animation controller for effects requiring continuous render
    renderingControls.setAnimationController(animController);

    // User can now press R to toggle controls panel
    Index
    • Create rendering controls UI with complete parameter access.

      Initializes GUI with all post-processing and rendering controls organized in folders. Sets up auto-blur behavior and keyboard handling. Starts hidden - call show() or toggle() to display.

      Parameters

      Returns RenderingControls

      const controls = new RenderingControls(
      postProcessingManager,
      sceneManager
      );
      controls.show(); // Display controls panel
    gui: GUI

    The custom GUI instance

    Current rendering settings (public for state capture)

    sceneId: string = ''

    Scene identifier for settings persistence

    zarrViewerConfig: ZarrViewerConfig | undefined = undefined
    hasStoredLocalSettings: boolean = false
    postProcessing: PostProcessingManager

    Reference to post-processing manager

    sceneManager: SceneManager

    Reference to scene manager

    animationController?: AnimationController

    Reference to animation controller for triggering re-renders

    visible: boolean = false

    Visibility state

    focusManager: FocusManager

    Outside-click + focus management for the panel.

    controllers: RenderingControllers = {}

    References to GUI controllers for updates

    adaptiveDPRManager?: AdaptiveDPRManager

    Reference to adaptive DPR manager (persisted enabled state applied on load).

    densityGuardControl?: DensityGuardControl
    clippingDisplay: ClippingDisplay

    RAF-driven mirror of the camera near/far values into the slider displays.

    cleanupCallbacks: (() => void)[] = []

    Cleanup callbacks collected during setup, called on dispose

    Cinematic mode preset controller (created in setupControls during construction).

    • Reset all rendering settings to their default values.

      Public because the rail Home popover's "Reset rendering" action calls it too (same behavior as this panel's own "Reset to Defaults" button).

      Returns void

    • Store the adaptive DPR manager reference.

      The Performance controls (Adaptive Resolution toggle, Manual DPR slider, live DPR/FPS readout) live in the Performance rail popover (right-click the gauge) — see ui/rail-panels/performance-popover. The panel only needs the manager so loadSettings can apply the persisted enabled state.

      Parameters

      Returns void

    • Apply the stored Density Guard choice — unless ?noDensityGuard turned the guard off for this session, in which case the stored flag is left alone (neither applied nor overwritten), like a URL DPR pin.

      Returns void

    • Set the scene identifier for settings persistence

      Parameters

      • zarrUrl: string

        URL of the zarr store

      • OptionalsceneName: string

        Name of the scene

      Returns void

    • Apply zarr viewer_config as defaults for a first-time scene visit. Called when no localStorage exists and zarr provides scene-specific defaults. Re-applies the full 3-tier priority chain and updates the scene.

      Returns void

    • Apply a partial settings override programmatically — the one path a scene's authored viewer_config and the embedder API's setRenderingSettings() share, so a remote controller can set exactly what an author can bake, with the same validation and the same side-effects (camera FOV/planes, navigation, DPR ceiling, post-processing).

      Values go through validateRenderingSettings so NaN / Infinity / out-of-range input clamps to defaults instead of reaching the renderer. Unknown keys are ignored by validation. Nothing is persisted: like the authored defaults, an override describes THIS session's scene, not a user preference.

      Parameters

      • overrides: Partial<RenderingSettings>
      • logMessage: string = 'Applied programmatic rendering settings'

      Returns void

    • Update clipping controls state based on dynamic clipping setting. When dynamic clipping is enabled:

      • Grey out manual near/far controls (but keep them visible)
      • Start periodic updates to show actual camera clipping values
      • Disable pointer events so sliders can't be manually adjusted

      Parameters

      • dynamicEnabled: boolean

      Returns void

    • Update fly speed UI slider range and value based on scene scale. Called after scene data loads and scale is known.

      Returns void

    • Re-range the near/far sliders from the scene scale.

      Their authored range is ABSOLUTE (near 0.0001–10, far 1–100000) while every value they ever show is scene-relative, so on any scene that is not roughly 100 world units across the two disagree. The visible symptom is under dynamic clipping, where the sliders are read-only live readouts: at a framed camera on a diagonal-100 scene near is ~44, so the number input reads 44 truthfully while <input type=range> clamps its own value and pins the thumb at the 10 end. On a micron-scale scene the whole useful range collapses below the 0.0001 minimum instead.

      Ranged off the same scene diagonal the rest of the scale-aware machinery uses, and bracketing what the clipping policy can actually produce: near bottoms out at MIN_NEAR_RADIUS_FACTOR · R (the ortho floor) and tops out near the framed distance; far reaches dist + R at the zoom-out limit. Mirrors the fly-speed re-ranging directly above — same trigger, same structural cast, same reason.

      The STEP is not simply the range minimum, because the GUI derives the displayed decimal count from String(step) (slider-kit/format.ts). A scene-derived step carries float noise into that string — String(1.05e-4) is "0.00010499999999999999", which renders every value with TWENTY decimals. decimalsForStep handles exponential notation, but it cannot distinguish meaningful precision from that binary float noise, so decadeStep hands it a clean value; see that helper for the exact bounds.

      Parameters

      • scale: number

      Returns void

    • Apply control-type-driven visibility to the panel's camera controls.

      The navigation parameter controls themselves now live in the Navigation rail popover; the only control-type-dependent UI left in this panel is the FOV row, which is irrelevant under the ortho (orthographic) projection. Called on show/sync and after a control-mode switch (syncCurrentState).

      Parameters

      • controlType: "orbit" | "fly" | "ortho"

      Returns void

    • Save current settings to localStorage. Public so the rail popovers (navigation / performance) persist through this panel's per-scene key — the shared settings object stays the single source of truth.

      Returns void

    • Sync current state from scene manager This ensures the GUI reflects the actual state when opened

      Returns void

    • Show the rendering controls panel.

      Syncs current state from scene/post-processing managers before showing to ensure GUI displays accurate values. Adds click-outside handler for better focus management.

      Triggered by R key when controls are hidden.

      Returns void

      // Show controls programmatically
      renderingControls.show();

      // Or user presses R key (handled by input handler)
    • Hide the rendering controls panel. Returns focus to the canvas so keyboard shortcuts keep working. Triggered by R or Escape.

      Returns void

    • Toggle rendering controls panel visibility (show ↔ hide).

      Primary method for R key binding. Syncs state before showing.

      Returns void

      // User presses R key
      renderingControls.toggle();
    • Check if rendering controls panel is currently visible.

      Returns boolean

      true if panel is shown, false if hidden

    • Update the cinematic mode checkbox to reflect the current state. Called after toggleCinematicMode or when 'C' key is pressed.

      Returns void

    • Clean up GUI resources and remove from DOM.

      Destroys the GUI instance. Should be called when rendering controls are no longer needed (e.g., application teardown).

      After calling dispose(), the RenderingControls instance cannot be reused.

      Returns void