Interface ThreeViewerOptions

Options for the ThreeViewer creation.

interface ThreeViewerOptions {
    assetManager?: AssetManagerOptions;
    camera?: {
        controlsMode?: string;
        position?: Vector3;
        target?: Vector3;
        type?: "perspective" | "orthographic";
    };
    canvas?: HTMLCanvasElement;
    container?: HTMLElement;
    debug?: boolean;
    dropzone?: boolean
    | DropzonePluginOptions;
    isAntialiased?: boolean;
    load?: {
        background?: null | string | ITexture | IAsset;
        environment?: null | string | ITexture | IAsset;
        src?: ValOrArr<null | string | IAsset>;
    };
    maxHDRIntensity?: number;
    maxRenderScale?: number;
    msaa?: boolean;
    onLoad?: (results: any) => void;
    plugins?: (IViewerPluginSync | Class<IViewerPluginSync>)[];
    renderScale?: number | "auto";
    rgbm?: boolean;
    screenShader?: TViewerScreenShader;
    tonemap?: boolean;
    useGBufferDepth?: boolean;
    useRgbm?: boolean;
    zPrepass?: boolean;
}

Properties

assetManager?: AssetManagerOptions

Options for the asset manager.

camera?: {
    controlsMode?: string;
    position?: Vector3;
    target?: Vector3;
    type?: "perspective" | "orthographic";
}
canvas?: HTMLCanvasElement

The canvas element to use for rendering. Only one of container and canvas must be specified.

container?: HTMLElement

The container for the canvas. A new canvas will be created in this container. Only one of container and canvas must be specified.

debug?: boolean
dropzone?: boolean | DropzonePluginOptions

Add the dropzone plugin to the viewer, allowing to drag and drop files into the viewer over the canvas/container. Set to true/false to enable/disable the plugin, or pass options to configure the plugin. Assuming true if options are passed.

- false
isAntialiased?: boolean

use msaa instead

load?: {
    background?: null | string | ITexture | IAsset;
    environment?: null | string | ITexture | IAsset;
    src?: ValOrArr<null | string | IAsset>;
}

Type declaration

  • Optionalbackground?: null | string | ITexture | IAsset

    Load background map

  • Optionalenvironment?: null | string | ITexture | IAsset

    Load environment map

  • Optionalsrc?: ValOrArr<null | string | IAsset>

    Load one or more source files

maxHDRIntensity?: number
maxRenderScale?: number

Max render scale when set to 'auto'

2
msaa?: boolean

Use MSAA. Renders objects in a multi-sampled buffer.

false
onLoad?: (results: any) => void

Add initial plugins.

renderScale?: number | "auto"

Render scale, 1 = full resolution, 0.5 = half resolution, 2 = double resolution. Same as pixelRatio in three.js Can be set to window.devicePixelRatio to render at device resolution in browsers. An optimal value is Math.min(2, window.devicePixelRatio) to prevent issues on mobile. This is set when 'auto' is passed.

1
rgbm?: boolean

Use Uint8 RGBM HDR Render Pipeline. Provides better performance with post-processing. RenderManager Uses Half-float if set to false.

true
screenShader?: TViewerScreenShader

The fragment shader snippet to render on screen.

tonemap?: boolean

TonemapPlugin is added to the viewer if this is true.

true
useGBufferDepth?: boolean

use zPrepass instead

useRgbm?: boolean

use rgbm instead

zPrepass?: boolean

Use rendered gbuffer as depth-prepass / z-prepass. (Requires DepthBufferPlugin/GBufferPlugin). Set it to true if you only have opaque objects in the scene to get better performance.

todo fix: It should be disabled when there are any transparent/transmissive objects with render to depth buffer enabled, see forceZPrepass