LUX-VIEW - v1.0.0
    Preparing search index...

    LUX-VIEW - v1.0.0

    This documentation describes the viewer as it is served to your deployments. Load it through your deployment's dropcode rather than a hardcoded script URL: the deployment record is the single source of truth for the engine and the content it serves, and keeps your integration on the version this documentation describes.

    Getting Started

    To display 3D content on your website, add the following dropcode to your HTML:

    <script>(function(m,i){var d=document,s='script';var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),c='https://cdn.bitreality.com/v.js?i='+i+'&m='+m;j.async=true;
    j.src=c;f.parentNode.insertBefore(j,f);})('MountDivId', 'DeploymentId');</script>

    Two parameters are required:

    • MountDivId — The ID of the div element where the 3D content will render. For Base deployments or framework-based setups where you handle mounting yourself, pass an empty string.
    • DeploymentId — The ID of the deployment you created on bitreality.com.

    You receive a pre-filled dropcode when you create a deployment. Copy it as-is.

    If your deployment ID is determined at runtime — for example, when it's stored in a CMS or returned by a backend API — see Dynamic Injection instead.

    Create a div element where the 3D content will appear. You control its size and position via CSS.

    <div id="viewer" style="width: 100%; height: 600px;"></div>
    

    The element must have a defined height greater than zero. The engine will fill the element and respect its dimensions.

    The dropcode loads a small script (v.js) that contacts the BitReality deployment service with your deployment ID. The service returns a list of scripts specific to your deployment type and configuration. These scripts are injected into your page sequentially. Once complete, the lux:loaded event fires — signaling that the engine is ready.

    What happens after that depends on your deployment type. See Deployment Types for details.

    If your deployment ID isn't known when your HTML is built — for example, when it's stored in a CMS or returned by a backend API — inject the dropcode dynamically instead of using the static form above. The IIFE shown in Dropcode is one way to create a <script> tag that loads v.js; doing it from your own code is another.

    function loadBitReality(deploymentId, mountId) {
    var s = document.createElement("script");
    s.async = true;
    s.src = "https://cdn.bitreality.com/v.js?i=" + deploymentId
    + "&m=" + (mountId || "");
    document.head.appendChild(s);
    }

    // Fetch your runtime configuration, then inject:
    fetch("/your-backend/config")
    .then(function (r) { return r.json(); })
    .then(function (cfg) { loadBitReality(cfg.deploymentId); });

    The mount ID is only needed for Managed deployments, where the initializer mounts the engine for you. For Base deployments you provide the mount element directly to lux.initialize() in your lux:loaded handler, so the second argument can be omitted (or left empty).

    After injection, everything works the same as the static dropcode. The lifecycle events (lux:loaded, lux:ready, lux:viewer-ready) fire as documented in Lifecycle Events, and you initialize the engine the same way described in Initialization.

    For Base deployments, the deployment configuration arrives in lux:loaded as event.detail.config — pass it to lux.initialize() as-is, optionally spreading viewer options on top (e.g. adaptive_quality). Treat config as opaque; its internals belong to the engine. Your own metadata (scene IDs, UI state, anything else) stays in your code; the deployment record is the single source of truth for the viewer version and the content it serves.

    Deployment Types

    A deployment defines how your 3D content is loaded and initialized on a website. Each deployment has a type that determines what the platform handles automatically and what you control yourself.

    A Managed deployment handles everything. You embed the dropcode and provide a mount element — the platform takes care of loading the engine, initializing it with your project data, and optionally creating a viewer with a scene configuration.

    When to use: You want the simplest integration. No custom initialization logic needed.

    What you configure: name, release, scene (optional), adaptive quality (optional).

    What happens automatically:

    1. The engine loads and mounts to your element (supports deferred mounting for SPAs)
    2. Your project data is loaded from the configured deployment
    3. If a scene is configured, a DefaultViewer is created and the scene is loaded

    After initialization, window.lux is available and the full API can be used to interact with the viewer. See Lifecycle Events for how to hook into the initialization process.

    A Base deployment loads the engine but lets you control when and how initialization happens. The deployment carries its configuration, which is forwarded to your code via the lux:loaded event — you decide when to initialize and where to mount.

    When to use: You need control over the initialization lifecycle. Common for custom integrations, single-page applications, or cases where you want to defer initialization or dynamically decide where to render.

    What you configure: name, release.

    What happens automatically:

    1. The engine loads

    What you handle:

    1. Listen for lux:loaded
    2. Call lux.initialize() with a mount element and the forwarded config
    3. Optionally create a viewer
    document.addEventListener("lux:loaded", async function (e) {
    var mount = document.getElementById("your-div-id");
    await e.detail.lux.initialize(mount, e.detail.config);

    // Engine ready — full API available
    });

    Treat e.detail.config as opaque — it carries everything lux.initialize needs from your deployment settings. You don't need to hardcode anything from it. See Initialization for the full API.

    Managed Base
    Integration effort Dropcode + div Dropcode + div + initialization code
    Controls timing Platform You
    Controls what loads Platform Platform (via config)
    Deferred mounting Automatic (MutationObserver) You handle it
    Custom init logic Not needed Full control
    Framework integration Works out of the box Explicit, see Frameworks

    Lifecycle Events

    The deployment system fires DOM events at key points during initialization. These events let you hook into the process — whether to start custom logic, update UI, or track loading state.

    Fires when all deployment scripts have been injected and loaded. window.lux is available.

    document.addEventListener("lux:loaded", function (e) {
    // e.detail.lux — the engine API (same as window.lux)
    // e.detail.config — deployment configuration, pass into lux.initialize as-is
    });

    Treat config as opaque — for Base deployments it carries everything lux.initialize needs, and its internals may change. For Managed deployments it is empty (initialization is handled internally).

    Both things the event carries have a dedicated place once it has fired: e.detail.lux is window.lux, and e.detail.config is window.lux_config. Code that runs after the event (a component that mounts late, for example) reads them from there instead — see Framework Integration.

    This event fires for all deployment types.

    Fires when the engine has been initialized, mounted to the DOM, and project data has been loaded.

    document.addEventListener("lux:ready", function (e) {
    // e.detail.mount — the mount DOM element
    });

    This event fires only for Managed deployments. For Base deployments, you call lux.initialize() yourself — there is no automatic engine setup.

    Fires when a DefaultViewer has been created and a scene configuration has been loaded.

    document.addEventListener("lux:viewer-ready", function (e) {
    // e.detail.viewer — the DefaultViewer instance
    });

    This event fires only for Managed deployments that have a scene configured. If no scene is set, only lux:ready fires.

    Type lux:loaded lux:ready lux:viewer-ready
    Managed (with scene) Yes Yes Yes
    Managed (no scene) Yes Yes No
    Base Yes No No

    For a Managed deployment with a scene configured, the events fire in this order:

    1. Dropcode loads v.js → fetches deployment config → injects scripts
    2. Scripts loaded → lux:loaded
    3. Engine initialized, mounted, project data loaded → lux:ready
    4. DefaultViewer created, scene loaded → lux:viewer-ready

    For a Base deployment, only step 1–2 occur. You take over from lux:loaded.

    Initialization

    After the engine has loaded (signaled by the lux:loaded event), the engine API is available at window.lux. For Managed deployments, initialization happens automatically. For Base deployments, you call it yourself.

    Mounts the rendering engine to a DOM element and fetches the data referenced by the deployment. The settings object is the config you received from the lux:loaded event — pass it through as-is:

    document.addEventListener("lux:loaded", async function (e) {
    var mount = document.getElementById("viewer");
    await e.detail.lux.initialize(mount, e.detail.config);
    });

    Treat e.detail.config as opaque — its internals belong to the engine and may change. You can spread additional viewer options on top:

    await e.detail.lux.initialize(mount, {
    ...e.detail.config,
    adaptive_quality: true
    });

    If your code runs after lux:loaded has already fired (a component that mounts late, for example), the same config is available as window.lux_config, next to window.lux:

    await window.lux.initialize(mount, window.lux_config);
    

    Parameters:

    Parameter Type Description
    mount HTMLDivElement The DOM element to render into. Must have a defined height > 0.
    settings object The deployment config from lux:loaded (or window.lux_config), optionally extended with the viewer options below.

    Viewer options:

    Property Type Required Description
    adaptive_quality boolean No If true, render quality scales based on measured device performance. Default: false.

    After lux.initialize() resolves, the following methods are available on window.lux:

    Returns all assets in the loaded release.

    var assets = lux.getAssets();
    // [{ id: "...", name: "...", type: "Material", tags: [...] }, ...]

    Each asset has:

    Property Type Description
    id string Unique asset identifier.
    name string Human-readable name.
    type string One of: Material, MaterialDefinition, Background, Skydome, Texture, Geometry, Scene, Camera, Settings.
    tags string[] Tags assigned to the asset.

    Returns a deep copy of an asset's data. The structure depends on the asset type.

    var data = lux.getAssetData("asset_id");
    

    Updates an asset's data. This must be done before the asset is consumed by a viewer — changes to assets already in use by a running viewer will not take effect.

    lux.setAssetData("asset_id", modifiedData);
    

    Fades out the current render.

    await lux.fadeOut(1000, "white");
    
    Parameter Type Default Description
    time number — Fade duration in milliseconds.
    color string "white" The color to fade to.

    Fades in the current render. Use the same color as the preceding fadeOut to avoid a color flash.

    await lux.fadeIn(1000, "white");
    
    Parameter Type Default Description
    time number — Fade duration in milliseconds.
    color string "white" The color to fade from.

    DefaultViewer

    The DefaultViewer is the primary way to display and interact with a configured 3D scene. It is created after the engine has been initialized and provides a high-level API for controlling materials, cameras, animations, visibility, and more.

    The following assumes that lux has been initialized. For Managed deployments this happens automatically. For Base deployments, see Initialization.

    To create a DefaultViewer, you need the ID of a configuration asset from your project. Configurations define the scene setup — which cameras, materials, animations, and other elements are available.

    var assets = lux.getAssets();
    var config = assets.find(function (a) { return a.name === "YOUR_CONFIGURATION_NAME"; });

    var viewer = await lux.getDefaultViewer({
    configAssetId: config.id,
    initialFade: { color: "white", time: 1000 }
    });

    Settings:

    Property Type Required Description
    configAssetId string Yes The ID of the configuration asset to load.
    initialFade { color, time } No Fade-in effect when the scene first appears. color: the color to fade from. time: duration in ms.

    After the viewer is created, call getConfiguration() to inspect what's available in the loaded scene:

    var configuration = viewer.getConfiguration();
    

    The configuration contains:

    Property Type Description
    cameras [{ id, name, tags }] Available camera positions.
    environments [{ id, name, tags }] Background environments.
    skydomes [{ id, name, tags }] Skydome options.
    renderSettings [{ id, name, tags }] Render quality presets.
    materials [{ id, name, tags }] Individual materials.
    materialGroups [{ id, name, tags, materials }] Material groups, each with an array of selectable materials.
    animationGroups [{ id, name, tags }] Animation groups.
    visibilitySets [{ id, name, tags, visibilityGroups }] Visibility sets, each with selectable visibility groups.
    states [{ id, name, tags }] Predefined viewer states.
    hotspots [{ id, name, tags }] Interactive hotspot elements.

    Get the viewer's current state at any time:

    var state = viewer.getCurrentState();
    

    This returns the active camera, environment, material selections, animation positions, and more. Useful for building UI that reflects the current viewer state.

    await viewer.setMaterialGroup(groupId, materialId);
    

    Sets the active material within a material group. Use getConfiguration().materialGroups to find group and material IDs.

    await viewer.setCamera(cameraId);
    await viewer.setCamera(cameraId, { time: 1000, easing: "easeInOut" });

    Transitions to a camera. The optional second parameter controls the transition animation.

    Property Type Description
    time number Transition duration in ms.
    easing string Easing function name.
    onFinished function Callback when the transition completes. Receives a reason string.
    await viewer.setEnvironment(environmentId);
    

    Sets the background environment.

    await viewer.setSkydome(skydomeId);
    await viewer.setSkydome(null); // removes the skydome
    await viewer.setRenderSettings(settingsId);
    

    Applies a render quality preset.

    await viewer.setVisibilitySet(setId, groupId);
    

    Activates a visibility group within a visibility set. Controls which parts of the scene are shown or hidden.

    await viewer.setAnimationGroup(groupId);
    await viewer.setAnimationGroup(groupId, "End");
    await viewer.setAnimationGroup(groupId, "Start", { instant: true });

    Plays an animation group. The returned promise resolves when all animations in the group have finished.

    The optional destination parameter controls direction:

    Value Behavior
    "Toggle" Alternates between forward and backward on each call. Default.
    "Start" Plays backward to the start position.
    "End" Plays forward to the end position.

    The optional options parameter:

    Property Type Description
    instant boolean If true, jumps to the destination instead of playing toward it. Useful to reset a group before playing it again. Default: false.

    For detailed animation examples, see Animations.

    await viewer.setState(stateId);
    

    Applies a predefined state that may change camera, materials, visibility, and other properties at once.

    await viewer.setHotspots(["hotspot_1", "hotspot_2"]);
    

    Sets which hotspots are active.

    await viewer.viewInAR({ stateId: "optional_state_id" });
    

    Exports the current scene for AR viewing. See Augmented Reality for details and device requirements.

    viewer.screenshots.shoot();
    viewer.screenshots.shoot({ fileName: "capture.png" });
    viewer.screenshots.shoot({ fileName: "4k.png", size: { width: 3840, height: 2160 } });

    See Screenshots for the full API.

    Framework Integration

    Modern JavaScript frameworks (React, Vue, Angular, etc.) create DOM elements dynamically. This means the mount element may not exist when the deployment scripts load. Both deployment types handle this, but in different ways.

    Managed deployments support deferred mounting out of the box. If the configured mount element doesn't exist when the engine is ready, the initializer waits via MutationObserver and starts automatically when the element appears. No additional code is needed.

    With Base deployments, you control initialization timing. The lux:loaded event signals that the engine is ready — you can defer calling lux.initialize() until your component has mounted and the DOM element exists.

    import { useEffect, useRef } from "react";

    function Viewer() {
    const mountRef = useRef(null);

    useEffect(() => {
    const onLoaded = async () => {
    const lux = window["lux"];
    await lux.initialize(mountRef.current, window["lux_config"]);

    const assets = lux.getAssets();
    const scene = assets.find((a) => a.name === "YOUR_CONFIGURATION_NAME");
    await lux.getDefaultViewer({
    configAssetId: scene.id,
    initialFade: { color: "white", time: 1000 },
    });
    };

    if (window["lux"]) {
    onLoaded();
    } else {
    document.addEventListener("lux:loaded", onLoaded);
    return () => document.removeEventListener("lux:loaded", onLoaded);
    }
    }, []);

    return <div ref={mountRef} style={{ width: "100%", height: "600px" }} />;
    }

    Key points:

    • Use a ref for the mount element — not document.getElementById.
    • Check window["lux"] first: if the component mounts after the scripts have already loaded, the lux:loaded event has already fired.
    • Once lux:loaded has fired, what the event carried is at window["lux"] and window["lux_config"], so neither path needs the event itself.
    • Clean up the event listener in the effect's return function.
    <template>
    <div ref="mount" style="width: 100%; height: 600px;"></div>
    </template>

    <script>
    export default {
    mounted() {
    const init = async () => {
    const lux = window["lux"];
    await lux.initialize(this.$refs.mount, window["lux_config"]);

    const assets = lux.getAssets();
    const scene = assets.find((a) => a.name === "YOUR_CONFIGURATION_NAME");
    await lux.getDefaultViewer({
    configAssetId: scene.id,
    initialFade: { color: "white", time: 1000 },
    });
    };

    if (window["lux"]) {
    init();
    } else {
    this._onLoaded = init;
    document.addEventListener("lux:loaded", this._onLoaded);
    }
    },
    beforeUnmount() {
    if (this._onLoaded) {
    document.removeEventListener("lux:loaded", this._onLoaded);
    }
    },
    };
    </script>

    Regardless of framework, the integration pattern is the same:

    1. Render a mount element in your component.
    2. Check if the engine is already loaded (window["lux"] exists). If so, initialize immediately.
    3. Otherwise, listen for lux:loaded and initialize when it fires.
    4. Clean up the event listener when the component unmounts.

    The dropcode only needs to load once. Place it in your application's HTML shell (e.g., index.html) when your deployment ID is known at build time, or inject it dynamically — see Dynamic Injection — when it arrives at runtime. Avoid loading it inside a component that may mount more than once.

    Examples

    The simplest integration. Drop the code in, provide a mount element, everything else is automatic.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Managed Deployment</title>
    <script>(function(m,i){var d=document,s='script';var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),c='https://cdn.bitreality.com/v.js?i='+i+'&m='+m;j.async=true;
    j.src=c;f.parentNode.insertBefore(j,f);})('viewer', 'YOUR_DEPLOYMENT_ID');</script>
    </head>
    <body>
    <div id="viewer" style="width: 100%; height: 600px;"></div>
    </body>
    </html>

    Hook into the initialization process to run code at specific points.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Managed with Events</title>
    <script>(function(m,i){var d=document,s='script';var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),c='https://cdn.bitreality.com/v.js?i='+i+'&m='+m;j.async=true;
    j.src=c;f.parentNode.insertBefore(j,f);})('viewer', 'YOUR_DEPLOYMENT_ID');</script>
    </head>
    <body>

    <div id="viewer" style="width: 100%; height: 600px;"></div>

    <script>
    document.addEventListener("lux:ready", function () {
    console.log("Engine initialized. API available at window.lux");
    });

    document.addEventListener("lux:viewer-ready", function (e) {
    var viewer = e.detail.viewer;
    console.log("Viewer ready:", viewer.getConfiguration());

    // Example: switch to a specific camera after load
    var cameras = viewer.getConfiguration().cameras;
    if (cameras.length > 1) {
    viewer.setCamera(cameras[1].id, { time: 2000 });
    }
    });
    </script>

    </body>
    </html>

    Initialize the engine yourself. The deployment provides the project config.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Base Deployment</title>
    <script>(function(m,i){var d=document,s='script';var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),c='https://cdn.bitreality.com/v.js?i='+i+'&m='+m;j.async=true;
    j.src=c;f.parentNode.insertBefore(j,f);})('', 'YOUR_DEPLOYMENT_ID');</script>
    </head>
    <body>

    <div id="viewer" style="width: 100%; height: 600px;"></div>

    <script>
    document.addEventListener("lux:loaded", async function (e) {
    var lux = e.detail.lux;
    var config = e.detail.config;

    // Initialize the engine
    await lux.initialize(document.getElementById("viewer"), config);

    // Find a configuration asset
    var assets = lux.getAssets();
    var scene = assets.find(function (a) { return a.name === "YOUR_CONFIGURATION_NAME"; });

    // Create a viewer
    var viewer = await lux.getDefaultViewer({
    configAssetId: scene.id,
    initialFade: { color: "white", time: 1000 }
    });

    console.log("Viewer ready:", viewer.getConfiguration());
    });
    </script>

    </body>
    </html>

    Build a simple UI that lets the user change materials.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Material Switcher</title>
    <script>(function(m,i){var d=document,s='script';var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),c='https://cdn.bitreality.com/v.js?i='+i+'&m='+m;j.async=true;
    j.src=c;f.parentNode.insertBefore(j,f);})('', 'YOUR_DEPLOYMENT_ID');</script>
    </head>
    <body>

    <div id="viewer" style="width: 100%; height: 600px;"></div>
    <div id="controls"></div>

    <script>
    document.addEventListener("lux:loaded", async function (e) {
    var lux = e.detail.lux;
    await lux.initialize(document.getElementById("viewer"), e.detail.config);

    var assets = lux.getAssets();
    var scene = assets.find(function (a) { return a.name === "YOUR_CONFIGURATION_NAME"; });
    var viewer = await lux.getDefaultViewer({ configAssetId: scene.id });

    // Get material groups from the configuration
    var config = viewer.getConfiguration();
    var controls = document.getElementById("controls");

    config.materialGroups.forEach(function (group) {
    var label = document.createElement("strong");
    label.textContent = group.name + ": ";
    controls.appendChild(label);

    var select = document.createElement("select");
    group.materials.forEach(function (mat) {
    var option = document.createElement("option");
    option.value = mat.id;
    option.textContent = mat.name;
    select.appendChild(option);
    });

    select.addEventListener("change", function () {
    viewer.setMaterialGroup(group.id, this.value);
    });

    controls.appendChild(select);
    controls.appendChild(document.createElement("br"));
    });
    });
    </script>

    </body>
    </html>

    A React component that initializes the engine and creates a viewer.

    import { useEffect, useRef, useState } from "react";

    function LuxViewer({ configName }) {
    const mountRef = useRef(null);
    const [viewer, setViewer] = useState(null);

    useEffect(() => {
    let cancelled = false;

    const onLoaded = async () => {
    const lux = window["lux"];

    await lux.initialize(mountRef.current, window["lux_config"]);

    const assets = lux.getAssets();
    const scene = assets.find((a) => a.name === configName);

    if (!scene) {
    console.error(`Configuration "${configName}" not found`);
    return;
    }

    const v = await lux.getDefaultViewer({
    configAssetId: scene.id,
    initialFade: { color: "white", time: 1000 },
    });

    if (!cancelled) {
    setViewer(v);
    }
    };

    if (window["lux"]) {
    onLoaded();
    } else {
    document.addEventListener("lux:loaded", onLoaded);
    }

    return () => {
    cancelled = true;
    document.removeEventListener("lux:loaded", onLoaded);
    };
    }, [configName]);

    return (
    <div>
    <div ref={mountRef} style={{ width: "100%", height: "600px" }} />
    {viewer && <p>Viewer loaded with {viewer.getConfiguration().cameras.length} cameras</p>}
    </div>
    );
    }

    Animations

    Animations are a feature which is only supported in the DefaultViewer

    AnimationGroups are multiple animations bundled together with an id, a name and possibly tags.

    When playing such a group all the animations which are part of the group will start playing.

    All animations which are currently not visible or loaded will also be set to this destination once they are present.

    The destination defines the direction that an animation will play.

    If an animation group has already reached its destination the play call will not have any effect.

    Using "Toggle" as the destination will let the configurator play the animations to the opposite of the current position.


    // Get the configuration
    const config = viewer.getConfiguration();

    // Find the animation group you want to play by searching
    // for name, id or tags ...
    const group = config.animationGroups.find(group => {
    // return group.id==="id_of_the_group";
    // return group.tags.indexOf("tag_name") > -1;
    return group.name==="name_of_the_group";
    });

    if (!group) {
    throw new Error("No animation group found ...");
    }

    // Optionally define the destination: "Toggle", "Start" or "End"
    let destination = "End";

    // Simulate the "toggle" behaviour by deciding the destination
    // based on the current state:


    const state = viewer.getCurrentState();

    const groupState = state.animation_groups.find(g => g.id === group.id);

    // Start playing all animations of the animation group.
    const playPromise = viewer.setAnimationGroup(group.id, destination);

    // The returned promise resolves when all animations finished playing
    playPromise.then(() => {
    console.log("Animation Group finished!");
    });

    const config = viewer.getConfiguration();
    const group = config.animationGroups.find(group => {
    // return group.id==="id_of_the_group";
    // return group.tags.indexOf("tag_name") > -1;
    return group.name==="name_of_the_group";
    });

    if (!group) {
    throw new Error("No animation group found ...");
    }

    let destination = "End";

    // Get the current state of the viewer
    const state = viewer.getCurrentState();

    // Get the current state of our animation group
    const groupState = state.animation_groups.find(g => g.id === group.id);

    // Set the destination based on the current state
    if (groupState.position === "End") {
    destination = "Start";
    } else if (groupState.position === "Start") {
    destination = "End";
    }

    viewer.setAnimationGroup(group.id, destination);

    Screenshots

    The DefaultViewer has a property viewer.screenshots which gives access to the screenshot API.


    // Takes a screenshot of the current render canvas
    viewer.screenshots.shoot();

    // Takes a screenshot and sets a custom file name
    viewer.screenshots.shoot({
    fileName: "foo.png"
    });

    // Takes a screenshot in 4k resolution
    viewer.screenshots.shoot({
    fileName: "4k.png",
    size: {width: 3840, height: 2160}
    });

    // Apply an extra multiplier on top of the device pixel ratio
    viewer.screenshots.shoot({
    size: {width: 1920, height: 1080},
    dpr: 2
    });
    Option Type Description
    fileName string Filename of the downloaded PNG. Defaults to screenshot_{unix_ms}.png.
    size { width, height } Custom resolution in CSS pixels. Defaults to the current canvas size. The camera aspect follows the requested size.
    dpr number Extra multiplier applied to size, on top of the device pixel ratio the viewer already renders at. No extra multiplier when omitted.

    The screenshot is not a copy of the canvas: the current scene state is rendered again at the requested size through the same pipeline as the live view, then captured. Output pixel dimensions are size times the device pixel ratio, times dpr when given.

    Augmented Reality

    Augmented Reality is a feature that is only supported in the DefaultViewer

    The current scene configuration can be viewed in Augmented Reality.

    It is possible to optionally apply a state to the scene. This can be used for example to hide unwanted geometries such as a background skydome. The state will only be applied to the exported scene shown in Augmented Reality. It does not apply outside of Augmented Reality.

        // Retrieve the state we want to apply by name
    const state = viewer.getConfiguration().states.find(
    state => state.name === "Hide Background");

    try {
    // Try to export scene with state applied and view in AR
    // NOTE: options object is optional
    await viewer.viewInAR({ stateId: state?.id });
    } catch(error) {
    // We failed to activate AR, likely either the device or browser is unsupported
    alert("Unsupported device or browser!");

    console.error("AR error", error);
    }

    Due to technical limitations, only a subset of materials can be displayed in Augmented Reality:

    • PBR materials without:

      • Triplanar mapping
      • Clear coat normal map
      • Alpha map
      • Anisotropy
      • Vertex color gradient
    • Glass materials

    Unsupported materials are highlighted with a magenta colored material in AR. You can also inspect the return value of viewer.viewInAR for warnings about unsupported materials.

    Versions

    • update engine to the next engine generation (configuration version 8 with geometry manifests); every existing release keeps loading
    • the viewer API is declared stable; existing calls are unchanged
    • the deployment config is published as window.lux_config once lux:loaded has fired, next to window.lux, so a component that mounts after the event can still initialize
    • viewer.setAnimationGroup(groupId, destination, { instant: true }) jumps to the destination instead of playing toward it
    • removed the BasicViewer (deprecated since 0.4.0): lux.getBasicViewer and lux.createBasicUi are gone
    • update engine
    • update engine
    • watermark on preview deployments
    • deprecate BasicViewer in favour of DefaultViewer
    • improved initialization lifecycle
    • documentation overhaul
    • bugfixes
    • update engine
    • update engine
    • update three.js to r182
    • implement skydome feature
    • enable changing render settings and environment via AR state
    • update engine to support advanced visibility use cases
    • allow higher level of material support on Android AR (versus iOS AR) through a flag
    • updated three.js version to r177
    • enable AR export of compressed textures on iOS
    • updated three.js version to r175
    • bugfixes
    • Augmented Reality implementation
    • a new world