Block: Viewer

The Viewer block is used to create a geometry viewer.

ViewerConfig

Name Type Required Description
kind "Viewer" Yes The Viewer can be used to display (parametric) geometry
materials Dictionary<string, MaterialConfig> No Materials determine how geometry is displayed
viewerControls ViewerControls No
subscribe List<ViewerSubscribe> No Subscribe to one or more sources
settings ViewerSettingsConfig No Settings customize the behavior and appearance of the viewer
objects List<ObjectConfig> No Objects to place into the viewer scene

MaterialConfig

ColouredMeshMaterialConfig

Name Type Required Description
kind "ColouredMeshMaterial" Yes

StandardMaterialConfig

Name Type Required Description
kind "StandardMaterial" Yes
color List<number> No A list of three integers between 0 and 255 defining the RGB values of the diffuse colour of the material.
The default is white, [255,255,255]
emissiveColor List<number> No A list of three integers between 0 and 255 defining the RGB values of the emissive colour of the material.
This colour is unaffected by the scene lighting. The default is black `[0,0,0]
opacity number No Number between 0.0 and 1.0 indicating how opaque the material is.
A value of 0.0 is fully transparent, 1.0 is fully opaque. Default is 1.0.
emissiveIntensity number No A float between 0.0 and 1.0 defining the intensity of the emissive colour.
A value of 0.0 means the emissiveColour is ignored and the material colour is fully defined by the diffuseColour
envMapIntensity number No A float between 0.0 and 1.0 that scales the effect of the environment map by multiplying its colour.
roughness number No A float between 0.0 and 1.0 defining how rough the material appears.
0.0 means a smooth mirror reflection,
1.0 means a fully diffuse material.
Default is 1.0.
metalness number No A float between 0.0 and 1.0 defining how much the material is like a metal.
Non-metallic materials such as wood or stone use 0.0, metallic use 1.0, with nothing (usually) in between.
The default is 0.0.
wireframe boolean No A Boolean value setting whether the geometry is rendered as wireframe. The default is false.
renderSide "FrontSide" | "BackSide" | "DoubleSide" No
shadowSide "FrontSide" | "BackSide" | "DoubleSide" No A constant that defines which side of a surface cast shadows. The default is DoubleSide.
bumpScale number No A float between 0.0 and 1.0 that defines how much the bump map affects the material.
The default is 1.0. See bumpMap for more information.
physicalDimensions Tuple<number, number> No A vector of two floats defining the physical dimensions of any texture map.
normalScale Tuple<number, number> No A vector of two floats between 0.0 and 1.0 that define how much the normal map affects the material.
The default is [1.0, 1.0]. See normalMap for more information.
diffuseColorMap TextureConfig No Defines the diffuse colour of the material. The color setting and value from this map are multiplied.
metalnessMap TextureConfig No Defines the metalness of the material, using only the blue channel of this texture map.
The metalness setting and the value for this map are multiplied.
roughnessMap TextureConfig No Defines the roughness of the material, using only the green channel of this texture map.
The roughness setting and the value for this map are multiplied.
bumpMap TextureConfig No Defines small bumps on the surface of the material.
The black and white values of the texture map are mapped to the perceived depth in relation to the lights.
normalMap TextureConfig No Defines a set of normals on the surface of the material that affect the way that the material colour is lit.
The RGB values affect the surface normal for each pixel fragment. When this map is provided the bumpMap will have no effect.
aoMap TextureConfig No Defines areas on the material where diffuse light is occluded, using only the red channel of this texture map.

PhysicalMaterialConfig

A advanced physically-based rendering material with additional properties. Compared to the StandardMaterial, this material has two additional properties: transmission and ior. If these properties are not required, then you should use the StandardMaterial instead.

Name Type Required Description
kind "PhysicalMaterial" Yes
transmission number No A float between 0.0 and 1.0 defining the degree of transmission (or optical transparency).
Thin, transparent or semitransparent, plastic or glass materials remain largely reflective even if they are fully transmissive.
The transmission property can be used to model these materials.

When transmission is non-zero, opacity should be set to 1. The default is 0.0.
ior number No A float between 1.0 and 2.33 defining the index-of-refraction for non-metallic materials. The default is 1.5.
thickness number No A float defining the thickness of the volume beneath the surface. The value is given in the coordinate space of the mesh.
If the value is 0.0 the material is thin-walled. Otherwise the material is a volume boundary. The default is 0.0.
color List<number> No A list of three integers between 0 and 255 defining the RGB values of the diffuse colour of the material.
The default is white, [255,255,255]
emissiveColor List<number> No A list of three integers between 0 and 255 defining the RGB values of the emissive colour of the material.
This colour is unaffected by the scene lighting. The default is black `[0,0,0]
opacity number No Number between 0.0 and 1.0 indicating how opaque the material is.
A value of 0.0 is fully transparent, 1.0 is fully opaque. Default is 1.0.
emissiveIntensity number No A float between 0.0and1.0defining the intensity of the emissive colour.
A value of0.0means theemissiveColouris ignored and the material colour is fully defined by thediffuseColour
envMapIntensity number No A float between 0.0and1.0 that scales the effect of the environment map by multiplying its colour.
roughness number No A float between 0.0and1.0defining how rough the material appears.
0.0means a smooth mirror reflection,
1.0means a fully diffuse material.
Default is1.0.
metalness number No A float between 0.0and1.0defining how much the material is like a metal.
Non-metallic materials such as wood or stone use0.0, metallic use 1.0, with nothing (usually) in between.
The default is 0.0.
wireframe boolean No A Boolean value setting whether the geometry is rendered as wireframe. The default is false.
renderSide "FrontSide"|"BackSide"|"DoubleSide" No
shadowSide "FrontSide"|"BackSide"|"DoubleSide" No A constant that defines which side of a surface cast shadows. The default is DoubleSide.
bumpScale number No A float between 0.0and1.0that defines how much the bump map affects the material.
The default is1.0. See bumpMap for more information.
physicalDimensions Tuple<number, number> No A vector of two floats defining the physical dimensions of any texture map.
normalScale Tuple<number, number> No A vector of two floats between 0.0and1.0that define how much the normal map affects the material.
The default is[1.0, 1.0]. See normalMap for more information.
diffuseColorMap TextureConfig No Defines the diffuse colour of the material. The color setting and value from this map are multiplied.
metalnessMap TextureConfig No Defines the metalness of the material, using only the blue channel of this texture map.
The metalness setting and the value for this map are multiplied.
roughnessMap TextureConfig No Defines the roughness of the material, using only the green channel of this texture map.
The roughness setting and the value for this map are multiplied.
bumpMap TextureConfig No Defines small bumps on the surface of the material.
The black and white values of the texture map are mapped to the perceived depth in relation to the lights.
normalMap TextureConfig No Defines a set of normals on the surface of the material that affect the way that the material colour is lit.
The RGB values affect the surface normal for each pixel fragment. When this map is provided the bumpMap will have no effect.
aoMap TextureConfig No Defines areas on the material where diffuse light is occluded, using only the red channel of this texture map.
TextureConfig
Name Type Required Description
kind "TextureMap" Yes
texturePath string Yes The path to the file that defines the texture map. This needs to be in either a jpeg or png format.
repeat Tuple<number, number> No A pair of integers that define many times the texture is repeated across the surface, in each direction U and V.
Default is: [1, 1]
wrapS TextureWrapping No A constant that defines how the texture is tiled horizontally and corresponds to U in UV mapping.
Default is: RepeatWrapping.
wrapT TextureWrapping No A constant that defines how the texture is tiled vertically and corresponds to V in UV mapping.
Default is: RepeatWrapping
colorSpace TextureColorSpace No Overrides the default texture colour space used,
which defaults to SRGBColorSpace if used for diffuseColorMap otherwise no colour space is used.
TextureWrapping
  • "ClampToEdgeWrapping"
  • "RepeatWrapping"
  • "MirroredRepeatWrapping"
TextureColorSpace
  • "SRGBColorSpace"
  • "LinearSRGBColorSpace"
  • "NoColorSpace"

IndexOfRefraction

NonNegative

ViewerControls

Name Type Required Description
topLeft { kind: undefined, orientation: undefined, buttons: undefined } No
topRight { kind: undefined, orientation: undefined, buttons: undefined } No

ViewerControlConfig

ViewerCustomControl

A object for configuring a view button in the button bar. Use this object when when using settings of kind: AdvancedSettings.

Name Type Required Description
kind "PerspectiveView" | "TopView" | "FrontView" | "RightView" Yes
camera string Yes A string identifying the name of a camera in the cameras property of the AdvancedSettings.
target Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the camera target.
The camera will be orientated to look at the target.
position Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the camera position.

ViewerBasicControl

A object for configuring a view button in the button bar. Use this object when using settings of kind: BasicSettings

Name Type Required Description
kind "PerspectiveView" | "TopView" | "FrontView" | "RightView" Yes

ViewerZoomControl

Name Type Required Description
kind "ZoomToFit" Yes Useful button that can be used to zoom in to your geometry so that it fills the space of the viewer

ViewerLayerControl

Name Type Required Description
kind "ToggleLayer" Yes Button that shows or hides a layer of objects. Use subscription to assign objects to a layer
layer 0 | 1 | 2 | 3 Yes Layers to be hidden or shown
icon IconObjectConfig Yes Icon of the button

ViewerSubscribe

ViewerModelSubscribe

Name Type Required Description
kind "Model" Yes Subscribe to the results of a model to import them into this viewer
frame string Yes The frame name the model you wish to subscribe to lives
source string Yes The model name to use as a source. This is the same name as used in your contents
assignMaterials Dictionary<string, string> No Optionally assign materials to different outputs of your model
assignLayers Dictionary<string, 0 | 1 | 2 | 3> No Optionally assign layers to different outputs of your model

ViewerControlPanelSubscribe

Name Type Required Description
kind "ControlPanel" Yes Subscribe to control panel to update material properties
frame string Yes The frame name the control panel you wish to subscribe to lives
source string Yes The control panel name to use as a source. This is the same name as used in your contents
control string Yes The control panel name to use as a source. This is the same name as used in your contents
material string Yes The material name as defined in viewer materials. The given material will be updated when value of the control changes
assignMaterialPropertiesByKey Dictionary<string, MaterialInput> Yes The mapping from control values to material properties

MaterialInput

Name Type Required Description
color List<number> Yes

ViewerSettingsConfig

ViewerAdvancedSettings

An object for configuring advanced viewer settings. These settings will allow you to configure custom cameras, lights, and environment.

Name Type Required Description
kind "AdvancedSettings" Yes
defaultCamera string Yes A string, the name of one of the cameras in cameras.
cameras Dictionary<string, CameraConfig> Yes A dictionary of name-value pairs, where the value can be either a PerspectiveCamera object or a OrthographicCamera object.
lights Dictionary<string, LightConfig> No
environment EnvironmentConfig No An object for configuring the scene environment and scene background in the viewer.
Can be either a GeneratedTextureMap or an EquirectangularTextureMap object.
shadowPlane ShadowPlane No A ShadowPlane object for configuring an invisible shadow plane onto which shadows can be cast.

CameraConfig

OrthographicCamera

An object for configuring an orthographic camera.

Name Type Required Description
kind "OrthographicCamera" Yes
frustumSize number Yes A float defining the left-to-right and top-to-bottom dimensions of the camera frustum.
For orthographic cameras, the frustum is a square box, capped by the near and far planes.
Objects which lie outside a camera’s frustum are excluded from rendering.
farPlane number Yes A float defining the camera frustum far plane. Must be greater than the value of near plane. The default is 2000.
nearPlane number No A float defining the camera frustum near plane. Note that 0 is not a valid value for a perspective’s camera near plane.
The default is 0.1.
position Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the camera position.
target Tuple<number, number, number> No A vector of three floats defining the XYZ coordinates of the camera target.
The camera will be orientated to look at this target. The default is [0,0,0].
controls OrthographicCameraControls No
OrthographicCameraControls
Name Type Required Description
minZoom number No A positive float defining how far you can zoom in. Default is 0
maxZoom number No A positive float defining how far you can zoom out. Default is Infinity
enablePan boolean No A Boolean to enable panning. The default is true.
enableZoom boolean No A Boolean to enable zooming. The default is true.
enableZoomToCursor boolean No A Boolean to enable zooming to the position of the cursor. The default is true.
enableRotate boolean No A Boolean to enable rotating. The default is true.
zoomSpeed number No A positive float defining the zoom speed. The default is 0.5.
rotateSpeed number No A positive float defining the zoom speed. The default is 1.0.
panSpeed number No A positive float defining the zoom speed. The default is 1.0.
minAzimuthAngle number No A float defining the lower limit of horizontal rotations of the camera, in degrees. The angle is measure from the Y axis.
Positive angles are clockwise, negative angles are anti-clockwise. The default is -Infinity.
maxAzimuthAngle number No A float between -180.0 and 180.0 defining the upper limit of horizontal rotations of the camera, in degrees.
The angle is measure from the Y axis. Positive angles are clockwise, negative angles are anti-clockwise. The default is 180.0.
minAltitudeAngle number No A float between -90.0 and 90.0 defining the lower limit of vertical rotations of the camera, in degrees.
The angle is measure from the horizontal plane. Positive angles are above the plane, negative angles are below the plane.
The default is0.
maxAltitudeAngle number No A float between -90.0 and 90.0 defining the upper limit of vertical rotations of the camera, in degrees..
The angle is measure from the horizontal plane. Positive angles are above the plane, negative angles are below the plane.
The default is 90.0.
minDistance number No A positive float defining how far you can dolly in.
maxDistance number No A positive float defining how far you can dolly out.
PerspectiveCamera

An object for configuring a perspective camera.

Name Type Required Description
kind "PerspectiveCamera" Yes
fov number No A float defining the the camera frustum vertical field of view, from bottom to top of view, in degrees. Default is 45.
farPlane number Yes A float defining the camera frustum far plane. Must be greater than the value of near plane. The default is 2000.
nearPlane number No A float defining the camera frustum near plane. Note that 0 is not a valid value for a perspective’s camera near plane.
The default is 0.1.
position Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the camera position.
target Tuple<number, number, number> No A vector of three floats defining the XYZ coordinates of the camera target.
The camera will be orientated to look at this target. The default is [0,0,0].
controls PerspectiveCameraControls No
PerspectiveCameraControls
Name Type Required Description
minDistance number No A positive float defining how far you can dolly in. Default is 0
maxDistance number No A positive float defining how far you can dolly out. Default is Infinity
enablePan boolean No A Boolean to enable panning. The default is true.
enableZoom boolean No A Boolean to enable zooming. The default is true.
enableZoomToCursor boolean No A Boolean to enable zooming to the position of the cursor. The default is true.
enableRotate boolean No A Boolean to enable rotating. The default is true.
zoomSpeed number No A positive float defining the zoom speed. The default is 0.5.
rotateSpeed number No A positive float defining the zoom speed. The default is 1.0.
panSpeed number No A positive float defining the zoom speed. The default is 1.0.
minAzimuthAngle number No A float defining the lower limit of horizontal rotations of the camera, in degrees. The angle is measure from the Y axis.
Positive angles are clockwise, negative angles are anti-clockwise. The default is -Infinity.
maxAzimuthAngle number No A float between -180.0 and 180.0 defining the upper limit of horizontal rotations of the camera, in degrees.
The angle is measure from the Y axis. Positive angles are clockwise, negative angles are anti-clockwise. The default is 180.0.
minAltitudeAngle number No A float between -90.0 and 90.0 defining the lower limit of vertical rotations of the camera, in degrees.
The angle is measure from the horizontal plane. Positive angles are above the plane, negative angles are below the plane.
The default is0.
maxAltitudeAngle number No A float between -90.0 and 90.0 defining the upper limit of vertical rotations of the camera, in degrees..
The angle is measure from the horizontal plane. Positive angles are above the plane, negative angles are below the plane.
The default is 90.0.
minDistance number No A positive float defining how far you can dolly in.
maxDistance number No A positive float defining how far you can dolly out.

LightConfig

DirectionalLight

An object for configuring a light source that that emits light in a specific direction. The light behaves as though it is infinitely far, resulting in light rays that are parallel. A common use case for this is to simulate sunlight.

Name Type Required Description
kind "DirectionalLight" Yes
position Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the directional light position.
shadowNear number No A float defining the frustum near plane. The valid range is between 0 and the value of the far plane. The default is 0.1.
shadowFar number No A float defining the frustum far plane. Must be greater than the current value of near plane. The default is 2000.
shadowFrustumSize number No A float defining the size of the shadow frustum.
The size is the distance from the light centre line to the left, right, top, and bottom frustum planes.
The default is 512
target Tuple<number, number, number> No A vector of three floats defining the XYZ coordinates of the directional light target. The default is [0,0,0].
color List<number> No A list of three integers defining the RGB values of the colour of the directional light. The default is white, [255,255,255].
intensity number No A float between 0.0 and 1.0 defining the light’s intensity, or strength. The default is 1.0.
helper boolean No A boolean to show the light helper geometry, mainly used for debugging.
The helper geometry consists of plane and a line representing the light’s position and direction. The default is false.
castShadows boolean No A boolean to enable casting shadows. The default is false.
shadowBias number No A float defining the shadow map bias,
how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.
Very tiny adjustments here (in the order of 0.0001) may help reduce artifacts in shadows. The default is 0.

EnvironmentConfig

EquirectangularTextureMap

An object for configuring the scene environment using an equirectangular texture map. Such a texture is an image that represents a 360-degree view along the horizontal centerline, and a 180-degree view along the vertical axis, with the top and bottom edges of the image corresponding to the north and south poles of a mapped sphere.

Name Type Required Description
kind "EquirectangularTextureMap" Yes
texturePath string Yes A string, the path to the file to be used for the equirectangular texture map in HDR format.
showAsBackground boolean No A boolean to show he environment as a background image to the scene. The default is false.
backgroundIntensity number No A float between 0.0 and 1.0 attenuating the colour of the background. The default is 1.0.
backgroundBlurriness number No A float between 0.0 and 1.0 defining the blurriness of the background. The default is 0.0.
GeneratedTextureMap

An object for configuring a basic environment with a generated texture map.

Name Type Required Description
kind "GeneratedTextureMap" Yes

ShadowPlane

Name Type Required Description
position Tuple<number, number, number> Yes A vector of three floats defining the XYZ coordinates of the center of the shadow plane. The default is [0,0,0].
size number Yes A float defining the size of the shadow plane, in both X and Y directions.

ViewerBasicSettings

The basic settings of the viewer

Name Type Required Description
kind "BasicSettings" Yes
size number No The size determines the view size of the model
grid boolean No The grid option determines whether to show the grid or not
axes boolean No The axes option determines whether to show the axes or not
fog boolean No The fog option determines whether to show the fog or not
shadows boolean No The shadows option determines whether to show the shadows or not

ObjectConfig

Name Type Required Description
kind "Obj" Yes
objFile string Yes
material string No
layers List<0 | 1 | 2 | 3> No