Block: Viewer

A Viewer block for configuring a geometry viewer to be displayed in the user interface.

Overview

A Viewer block is used for configuring a viewer for visualizing geometry, to be displayed in a frame. The viewer can also be configured to allow users to draw and manipulate simple geometric objects.

Two types of viewer settings can be configured: BasicSettings and AdvancedSettings:

  • The BasicSettings is a convenient way of quickly setting up a standard viewer. It allows a small number of key settings to be configured and applies default settings for all the other settings.
  • The AdvancedSettings allows all viewer settings to be configured, including lights, cameras, and the scene environment.

A set of viewer materials can be configured that can be applied to geometric objects in the viewer. These materials each have their own configuration settings, allowing highly custom materials to be created.

The viewer typically receives geometry from a Grasshopper model. This is achieved by subscribing the viewer to a Model block. The configuration settings for this subscription allow materials and layers to be assigned to named outputs of the Grasshopper model.

Example

Below is an example configuration of a viewer with basic settings.

kind: Solution
version: v0
router:
  kind: Router
  routes:
    - frame: home-frame
frames:
  home-frame:
    kind: Frame
    contents:
      my-model:
        kind: Model
        modelFile: my-grasshopper-model.gh
      my-basic-viewer:
        kind: Viewer
        settings:
          kind: BasicSettings
          size: 300
          axes: true
          fog: true
          grid: true
          shadows: true
        viewerControls:
          topRight:
            kind: ButtonBar
            orientation: vertical
            buttons:
              - kind: ZoomToFit
        materials:
          my-blue-mat:
            kind: StandardMaterial
            color: [100, 100, 200]
          my-trans-mat:
            kind: StandardMaterial
            opacity: 0.2
          my-glass-mat:
            kind: PhysicalMaterial
            color: [255, 255, 255]
            transmission: 1
            roughness: 0
            ior: 1.5
            thickness: 0.1
        subscribe:
          - kind: Model
            frame: home-frame
            source: my-model
            assignMaterials:
              my-output1: my-blue-mat
              my-output2: my-trans-mat
              my-output3: my-glass-mat

Below is an example of a viewer with some advanced settings.

kind: Solution
version: v0
assetsPath: assets
router:
  kind: Router
  routes:
    - frame: home-frame
frames:
  home-frame:
    kind: Frame
    contents:
      my-advanced-viewer:
        kind: Viewer
        settings:
          kind: AdvancedSettings
          defaultCamera: my-pers-camera
          cameras:
            my-pers-camera:
              kind: PerspectiveCamera
              nearPlane: 1
              farPlane: 900
              position: [500, 500, 500]
              target: [0, 0, 200]
              fov: 60
              controls:
                enablePan: false
                enableRotate: true
                enableZoom: true
                minAltitudeAngle: 5
                maxAltitudeAngle: 80
                mouseButtons:
                  left: null
                  middle: dolly
                  right: rotate
            my-ortho-camera:
              kind: OrthographicCamera
              frustumSize: 500
              farPlane: 900
              position: [0, 0, 0]
              controls:
                enablePan: true
                enableRotate: false
                enableZoom: true
                mouseButtons:
                  left: null
                  middle: dolly
                  right: pan
          environment:
            kind: EquirectangularTextureMap
            texturePath: assets/my-background.hdr
            backgroundBlurriness: 0.5
            backgroundIntensity: 0.9
            showAsBackground: false
          lights:
            my-sun:
              kind: DirectionalLight
              position: [-900, 100, 100]
              shadowNear: 100
              shadowFar: 1200
              shadowFrustumSize: 600
              intensity: 0.8
          shadowPlane:
            position: [0, 0, -0.5]
            size: 1600
        editors:
          my-line-editor:
            kind: LineEditor
            enabled: true
            multi: true
        viewerControls:
          topRight:
            kind: ButtonBar
            orientation: vertical
            buttons:
              - kind: FrontView
                camera: my-ortho-camera
                position: [0, -1000, 100]
                target: [0, 0, 100]
              - kind: FrontView
                camera: my-ortho-camera
                position: [0, -1000, 100]
                target: [0, 0, 100]
              - kind: ToggleLayer
                layer: 1
                icon:
                  kind: Icon
                  icon: fab-accusoft
              - kind: ZoomToFit

ViewerConfig

An object for configuring a viewer for displaying geometry. If the appropriate editors are defined, a viewer can also allow the user to draw simple geometries.

Name Type Required Description
kind "Viewer" Yes A constant, Viewer.
materials Dictionary<string, MaterialConfig> No A dictionary of objects for configuring materials. The materials can be assigned to the geometry output from a Grasshopper model.
editors Dictionary<string, EditorConfig> No A dictionary of objects for configuring editors in the viewer. Editors can be used for drawing simple geometries (such as lines and polylines), for selecting geometric objects, and for transforming geometric objects. Drawing, selecting, and transforming all require users to click in the viewer with various types of mouse clicks. The actions of the different mouse buttons can be configured in the viewer AdvancedSettings, as part of the camera control settings.
viewerControls ViewerControls No An object for configuring button bars in the viewer. The button bars can contain different types of buttons for interacting with the viewer. These include view buttons, layer toggle buttons, and editor toggle buttons.
settings ViewerSettingsConfig No An object for configuring settings for the viewer. Either a BasicSettings or AdvancedSettings object can be defined. The BasicSettings object is a convenient way of quickly setting up a standard viewer. It allows a small number of key settings to be configured and applies defaults for all the other settings. The AdvancedSettings object allows all viewer settings to be configured, including lights, cameras, and the scene environment.
objects List<ObjectConfig> No A list of objects for configuring the display of geometric objects in the viewer. The geometric objects are stored in files, in formats such as the .obj file format.
subscribe List<ViewerSubscribe> No A list of objects for subscribing the Viewer block to other blocks.
defaultEditor string No A string specifying the editor that should be enabled by default when no other editors are enabled.

MaterialConfig

Objects for configuring different types of materials.

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

EditorConfig

Objects for configuring different types of editors.

PolylineEditor

An object for configuring an editor that supports drawing polylines in the viewer.

Name Type Required Description
kind "PolylineEditor" Yes A constant, PolylineEditor.
open boolean No A boolean specifying whether open polylines can be drawn. When false, only closed polylines can be drawn. When true, both open and closed polylines can be drawn.
multi boolean No A boolean specifying whether multiple polylines can be drawn. When false, then each time a polyline is drawn, it replaces the previous polyline. When true, multiple polylines can be drawn.
enabled boolean No A boolean specifying whether this editor is enabled by default. Only one editor can be enabled at a time.
applyProperties LineObjectProperties No An object for configuring a set of properties that will be applied to drawn polylines.
snapToGridSize number No A number specifying a global grid size used for snapping.
displayLength boolean No A boolean specifying whether the line length is displayed while drawing.

LineEditor

An object for configuring an editor that supports drawing lines in the viewer.

Name Type Required Description
kind "LineEditor" Yes A constant, LineEditor.
multi boolean No A boolean specifying whether multiple lines can be drawn. When false, then each time a line is drawn, it replaces the previous line. When true, multiple lines can be drawn.
enabled boolean No A boolean specifying whether this editor is enabled by default. Only one editor can be enabled at a time.
applyProperties LineObjectProperties No An object for configuring a set of properties that will be applied to drawn lines.
snapToGridSize number No A number specifying a global grid size used for snapping.
displayLength boolean No A boolean specifying whether the line length is displayed while drawing.

LineObjectProperties

An object for configuring a set of properties that will be applied to geometric objects drawn by the user.

Name Type Required Description
layers List<0 | 1 | 2 | 3> No An integer defining the layer of the geometric object.

SelectEditor

An object for configuring an editor that supports selecting geometric objects in the viewer. Geometric objects are selected by clicking on them in the viewer.

Name Type Required Description
kind "SelectEditor" Yes A constant, SelectEditor.
multi boolean No A boolean specifying whether multiple geometric objects can be selected. When false, then each time an object is selected, it replaces the previous selection. When true, multiple objects can be selected.
enabled boolean No A boolean specifying whether this editor is enabled by default. Only one editor can be enabled at a time.
layers List<0 | 1 | 2 | 3> No A list of integers specifying the layers for geometric objects that can be selected.

ViewerControls

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

ButtonBar

Name Type Required Description
kind "ButtonBar" Yes
orientation "horizontal" | "vertical" Yes
buttons List<ViewerControlConfig> Yes A list of objects for configuring buttons in the button bar.
If you are specifying AdvancedSettings, then you should additionally specify three required button properties: camera, position, target.

ViewerControlConfig

Objects for configuring different types of buttons in the viewer button bars.

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

An object for configuring a button to toggle hiding and showing layers. When the toggle is enabled, the geometry on the layer will be visible in the viewer. When the toggle is disabled, the geometry will be hidden.

Name Type Required Description
kind "ToggleLayer" Yes A constant, ToggleLayer.
layer 0 | 1 | 2 | 3 Yes An integer specifying the layer to be hidden or shown.
icon IconObjectConfig Yes An object for configuring the button icon.
enable boolean No A boolean specifing the default state of the toggle button.

ViewerEditorControl

An object for configuring an editor button in one of the viewer button bars. Editor buttons are used to enable and disable editors defined in the viewer. Only one editor can be enabled at a time.

Name Type Required Description
kind "ToggleEditor" Yes A constant, ToggleEditor
editor string Yes A string specifying the name of the editor to be enabled or disabled by this button. The name must match the name of one of the editors defined in the viewer.
icon IconObjectConfig Yes An object for configuring the button icon.

ViewerDeleteSelectedControl

An object for configuring a button for deleting selected geometric objects in the viewer.

Name Type Required Description
kind "DeleteSelected" Yes A constant, DeleteSelected.
icon IconObjectConfig Yes An object for configuring the button icon.

ViewerSettingsConfig

Objects for configuring viewer settings.

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 objects for configuring cameras.
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

Objects for configuring different types of cameras.

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.
controls OrthographicCameraControls No
farPlane number Yes
nearPlane number No
position Tuple<number, number, number> Yes
target Tuple<number, number, number> No
layers List<0 | 1 | 2 | 3> 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.
mouseButtons CameraControlMouseButtons No An object for configuring the actions of the mouse buttons for this camera.
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.
controls PerspectiveCameraControls No
farPlane number Yes
nearPlane number No
position Tuple<number, number, number> Yes
target Tuple<number, number, number> No
layers List<0 | 1 | 2 | 3> 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.
mouseButtons CameraControlMouseButtons No An object for configuring the actions of the mouse buttons for this camera.
CameraControlMouseButtons

An object for configuring the actions of the mouse buttons when interacting with the viewer. The dolly (zoom) action moves the camera’s position along to the camera’s view direction. The pan action moves both the cameras’s position and target orthogonal to the camera’s view direction. The rotate action rotates the camera’s position around the camera’s target. These actions are also affected by other camera settings that define zooming, panning, and rotating behaviours. (Note also that when the end user is interacting with the viewer, holding the shift key and the mouse button at the same time will change the pan action to rotate and the rotate to pan.) When using drawing editors in the viewer, certain mouse buttons are typically reserved for drawing actions. This can be achieved by assigning a null action to one of the mouse buttons.

Name Type Required Description
left null | "dolly" | "pan" | "rotate" No A string specifying the action of the left mouse button.
middle null | "dolly" | "pan" | "rotate" No A string specifying the action of the middle mouse button.
right null | "dolly" | "pan" | "rotate" No A string specifying the action of the right mouse button.

LightConfig

Objects for configuring different types of lights.

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

Objects for configuring different types of environments.

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

ViewerSubscribe

ViewerModelSubscribe

An object for configuring a subscription from a Viewer block to a Model block. The subscription allows the geometry displayed in the viewer to be updated based on the geometry generated by a Grasshopper model.

Name Type Required Description
kind "Model" Yes A constant, Model.
frame string Yes A string specifying the name of the frame in which the Model is located.
source string Yes A string specifying the name of the Model. your contents
assignMaterials Dictionary<string, string> No A dictionary mapping Grasshopper model output names to material names. The dictionary keys are strings specifying the names of Packhunt Data Output components in the Grasshopper model. The dictionary values are strings specifying the names of materials.
assignLayers Dictionary<string, 0 | 1 | 2 | 3> No A dictionary mapping Grasshopper model output names to layer numbers. The dictionary keys are strings specifying the names of Packhunt Data Output components in the Grasshopper model. The dictionary values are integers specifying the layer numbers (between 0 and 3).

ViewerControlPanelSubscribe

An object for configuring a subscription from a Viewer block to a ControlPanel block. The subscription allows the materials in the viewer to be updated based on user selections in the control panel.

Name Type Required Description
kind "ControlPanel" Yes A constant, ControlPanel.
frame string Yes A string specifying the name of the frame in which the ControlPanel is located.
source string Yes A string specifying the name of the ControlPanel.
control string Yes A string specifying the name of the control to use for updating the material.
material string Yes A string specifying the material name to be updated.
assignMaterialPropertiesByKey Dictionary<string, MaterialInput> Yes A dictionary mapping control values to material properties. The dictionary keys are strings specifying the values of a control. The dictionary values are objects for configuring the material properties to be updated. Currently only the color property can be updated.

MaterialInput

Name Type Required Description
color List<number> Yes

ViewerEntityDataStoreSubscribe

An object for configuring a subscription from a Viewer block to an EntityDataStore block. The subscription allows the viewer to retrieve geometric objects from the selected entity in the entity data store.

Name Type Required Description
kind "EntityDataStore" Yes A constant, EntityDataStore.
frame string Yes A string specifying the name of the frame in which the EntityDataStore is located.
source string Yes A string specifying the name of the EntityDataStore.
fromProperties List<string> Yes A list of strings specifying the property names in the entity data store from which geometric objects will be retrieved.