Skip to main content

Type Alias: PreviewOptions

PreviewOptions = object

Settings related to the 3D preview.

Properties​

autoRotation?​

readonly optional autoRotation?: boolean

When set the product while rotate slowly


backgroundColor?​

readonly optional backgroundColor?: string

The color expected to be seen in the background of the product. Expects a hexadecimal value.


backgroundImage?​

readonly optional backgroundImage?: string

Image to be used as a background when running withh transparency, the image will be scaled and centered to fill the preview based on aspect ratio. Will implicitly set transparency to true.


createCanvas?​

readonly optional createCanvas?: () => HTMLCanvasElement

Function that returns a canvas to be used for rendering. Useful when using the preview in a headless environment.

Returns​

HTMLCanvasElement

A canvas to be used for rendering.


disableActionBar?​

readonly optional disableActionBar?: boolean

When true the action bar won't be displayed to the user.


disableAutomaticOrientation?​

readonly optional disableAutomaticOrientation?: boolean

When set the 3D preview won't attempt to orient the product automatically to its front view at load.


emissiveGlowIntensity?​

readonly optional emissiveGlowIntensity?: number

The intensity of the glow effect that is present when a material has an emissive texture.


environmentFile?​

readonly optional environmentFile?: string

The environment file used to calculate product lighting.


environmentIntensity?​

readonly optional environmentIntensity?: number

The intensity of the environment lighting.


environmentRotationY?​

readonly optional environmentRotationY?: number

The rotation (around the y axis) of the environment lighting, in degrees.


fallbackLighting?​

readonly optional fallbackLighting?: object

Configuration for the light used when the environment isn't lighting the scene, either because no environmentFile was configured or because the configured file failed to load. PBR materials are lit entirely by the environment, so without this a missing environment renders the product black and looks indistinguishable from a broken model. The fallback is only applied while the scene has no lights of its own, so models that ship their own lighting are left untouched.

color?​

optional color?: string

The colour of the fallback light arriving from above. Expects a hexadecimal value. Defaults to white.

enabled?​

optional enabled?: boolean

When false no fallback light is added, and a scene with no environment lighting renders unlit. Defaults to true.

groundColor?​

optional groundColor?: string

The colour of the fallback light bouncing back from below. Expects a hexadecimal value. Defaults to a dark grey.

intensity?​

optional intensity?: number

The intensity of the fallback light. Defaults to 1.2.


groundShadow?​

readonly optional groundShadow?: object

Configuration for a soft contact shadow drawn on the ground beneath the product, which helps it read as resting on a surface rather than floating in space.

enabled?​

optional enabled?: boolean

When true the shadow is drawn. Defaults to false.

opacity?​

optional opacity?: number

The darkness of the shadow at its centre, from 0 to 1. Defaults to 0.08.

spread?​

optional spread?: number

The size of the shadow relative to the product's footprint. Defaults to 1.8.


highDynamicRange?​

readonly optional highDynamicRange?: boolean

When true the rendering pipeline renders into high dynamic range (half-float) targets, so tone mapping and bloom operate on unclamped values. Gives smoother highlights, and is recommended when tone mapping is enabled. Silently falls back to low dynamic range on devices without half-float render support. Defaults to true.


highlightColor?​

readonly optional highlightColor?: string

Sets the color of highlights when enabled. Expects hexadecimal value.


highlightOnMaterialHover?​

readonly optional highlightOnMaterialHover?: boolean

When set, mousing over the model in this preview will highlight the associated mesh/material. When layout contexts are provided, only the materials with matching names will highlight.


idleTimeBeforeRotation?​

readonly optional idleTimeBeforeRotation?: number

Time in milliseconds before the product starts rotating after a user input has taken control.


lighting?​

readonly optional lighting?: object

Configuration rleated to lighting of the scene.

contrast?​

optional contrast?: number

Sets camera contrast. Higher values will increase the contrast of the scene. Defaults to 1.1.

exposure?​

optional exposure?: number

Sets camera exposure. Higher values will make the scene brighter. Defaults to 1.


lowerAlphaLimitDeg?​

readonly optional lowerAlphaLimitDeg?: number

The leftmost point, horizontally, that the camera can rotate to. https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction


lowerBetaLimitDeg?​

readonly optional lowerBetaLimitDeg?: number

The lowest point, vertically, that the camera can rotate to. https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction


maxZoomOverride?​

readonly optional maxZoomOverride?: number

The closest zoom the camera can achieve to the product.


minZoomOverride?​

readonly optional minZoomOverride?: number

The furthest zoom the camera can achieve to the product.


noPan?​

readonly optional noPan?: boolean

When true the preview system will not allow the user to pan the camera.


noRender?​

readonly optional noRender?: boolean

When true the preview system operates in a noRender mode. It silently accepts all requests and modifies internal state based on those requests. However no rendering will actually be occuring. Can be useful in situations where testing requires a 3D preview but the actual rendering is not important.


renderingPipelineConfiguration?​

readonly optional renderingPipelineConfiguration?: RenderingPipelineConfiguration

Configuration for post-processing effects.


transparentBackground?​

readonly optional transparentBackground?: boolean

When true, the canvas background will be transparent.


upperAlphaLimitDeg?​

readonly optional upperAlphaLimitDeg?: number

The rightmost point, horizontally, that the camera can rotate to. https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction


upperBetaLimitDeg?​

readonly optional upperBetaLimitDeg?: number

The highest point, vertically, that the camera can rotate to. https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction