Rendering controller is a global object accessible via OccViewer.renderingParams, responsible for querying and changing various rendering properties. It defines parameters from corresponding C++ class Graphic3d_RenderingParams defined by OCCT.

interface RenderingParams {
    backgroundColor: string;
    isPbrEnabled: boolean;
    isShadowEnabled: boolean;
    nbMsaaSamples: number;
    renderResolutionScale: number;
    shadowMapBias: number;
    shadowMapResolution: number;
    toShowStats: boolean;
    setBackgroundCubemap(
        theImagePath: string,
        theLightmapOnly: boolean,
        theToUpdate: boolean,
    ): Promise<void>;
    setImageBaseLighting(theToEnable: boolean, theToUpdate: boolean): void;
}

Properties

backgroundColor: string

Background color in #rrggbb format.

isPbrEnabled: boolean

Is PBR enabled.

isShadowEnabled: boolean

To cast shadows on/off.

nbMsaaSamples: number

Number of samples (integer) for MSAA buffer, 0 means no MSAA anti-aliasing. incompatible with renderResolutionScale (e.g. renderResolutionScale should be set to 1.0).

renderResolutionScale: number

Rendering resolution ratio; 1.0 means native resolution (100% scale).

shadowMapBias: number

Shadow map bias.

shadowMapResolution: number

Shadow map resolution in pixels (integer number).

toShowStats: boolean

To show stats on/off.

Methods

  • Set cubemap background. File will be loaded asynchronously.

    Parameters

    • theImagePath: string

      image path to load

    • theLightmapOnly: boolean
    • theToUpdate: boolean

      viewer update flag

    Returns Promise<void>

    promise with image loading results

  • Set image-based lighting.

    Parameters

    • theToEnable: boolean
    • theToUpdate: boolean

      viewer update flag

    Returns void