Camera, lights and rendering

Set where the 3D view looks from, how the scene is lit, and how it is rendered: environment, background, ambient occlusion, bloom and frame rate.

These settings decide how the scene looks. Without them the widget shows the models from a default camera, on a light grey background, lit the same way as earlier versions of the widget. Every setting here is optional.

This example from a robot dashboard uses the current lighting: physical light units, a panorama image that lights all objects, and ambient occlusion for soft shadows where parts meet:

"camera": "Camera",
"cameraLookAt": { "x": -0.1, "y": 0, "z": 0.3 },
"spotLight": { "x": -5, "y": 5, "z": 20, "castShadow": true, "angle": 0.5, "intensity": 100, "penumbra": 1.5 },
"renderSettings": {
  "lighting": "physical",
  "toneMapping": "neutral",
  "backgroundColor": "#899094",
  "fps": 20,
  "environment": { "type": "equirectangular", "file": "environmentmap/sunrise.exr", "azimuthDegrees": 90 },
  "ambientOcclusion": { "enable": true, "radius": 0.05, "intensity": 0.5 },
  "bloom": { "enable": true, "strength": 0.1, "radius": 0.1, "threshold": 1.8 }
}

Camera

Field What it does Default
camera A camera in the model to look through, by name or search pattern The default camera
cameraPosition Where the default camera stands, { "x": …, "y": …, "z": … } in m. Not used with camera, which keeps its own position x -1, y 5, z 1.5
cameraLookAt The point the camera looks at, for the default camera and a camera from the model alike The origin

Each coordinate of cameraPosition and cameraLookAt is optional. The default camera has a vertical field of view of 45° and shows what is between 0.1 m and 50 m away from it.

With view navigation on, the camera orbits around cameraLookAt: drag to turn the view, scroll to zoom, and drag with the right mouse button to move it. Disable view navigation in the widget’s properties keeps the camera where the file puts it.

A camera from the model is useful when you want a fixed view with the field of view you chose in Blender. If camera names an object that is not a camera, the widget warns and uses the default camera.

Lights

The widget adds a light only when the file asks for it. Without hemisphereLight and spotLight, the scene gets its light from the environment alone, and without an environment too, the models are dark.

Field What it does Default
hemisphereLight.intensity A soft light over the whole scene, white from above and grey from below 1
spotLight.x, .y, .z Where the spot light stands, in m. It points at the origin 0, 0, 15
spotLight.intensity The brightness of the spot light 0.2
spotLight.angle Half the opening angle of the light cone, in rad 1.0
spotLight.penumbra How soft the edge of the cone is, 0 sharp to 1 soft 1.5, which acts as soft
spotLight.castShadow The spot light casts shadows true
spotLight.decay How the light fades with distance: 0 not at all, 2 as real light does 0, or 2 with "lighting": "physical"

Shadows also need castShadow and receiveShadow on the objects that cast them and that they fall on.

With "lighting": "physical", lights use physical units and need higher values for the same brightness: about 3 times higher (×π) for the hemisphere light. A spot light then fades with the square of the distance, so its intensity must grow with π × distance²: a spot light of 0.2 at 19 m needs about 230. Set decay to 0 to keep a far-away spot light from fading.

Rendering

renderSettings collects the settings for how the scene is drawn.

Field What it does Default
lighting legacy renders lights as earlier versions did, so existing files keep their look. physical uses physical light units, see Lights, and the current colour handling and bloom legacy
toneMapping Maps bright parts, such as lamps, LEDs and bloom, to colours a screen can show, without clipping: none, agx, neutral, aces, reinhard, cineon or linear. agx gives natural colours and highlights, neutral keeps colours closest to the materials none
toneMappingExposure Makes the image brighter (higher) or darker. Only with toneMapping 1
backgroundColor The background, as a CSS colour such as "#202830" or "white". An environment shown as background covers it Light grey
environment Light and reflections from the surroundings, see Environment Off
ambientOcclusion Soft shadows in corners and where parts touch, see Ambient occlusion Off
bloom A glow around bright parts, see Bloom Off
fps The most frames per second. The scene is only drawn again when something changed 60
pixelRatio The rendering resolution: 1 draws one pixel per CSS pixel; "device" uses the screen’s pixel ratio, up to 2, sharper on high-resolution screens; a number sets it 1
instancing auto draws many copies of a model with GPU instancing where it can; off never does. See Several copies of one model auto

A lower fps and pixelRatio 1 keep the dashboard light on panel PCs and tablets: the cost of a frame grows with the square of the pixel ratio.

Environment

An environment lights every object from all sides and shows in shiny surfaces, as the surroundings do in a real room. It works best with "lighting": "physical" and a toneMapping. Choose where it comes from with type:


A generated environment

The widget makes the environment itself, so there is nothing to download:

"renderSettings": {
  "lighting": "physical",
  "toneMapping": "neutral",
  "environment": { "type": "generated", "generator": "hall", "intensity": 1 }
}
generator Looks like
room A studio room with soft lights
hall A factory hall with light strips on the ceiling
sky An outdoor sky. The sun itself is not drawn: the scene’s lights stand in for it
gradient A colour gradient from the sky to the ground

sky has three more settings:

Field What it does Default
skySunElevationDegrees The height of the sun above the horizon: 0 on the horizon, 90 straight up. It sets where the sky is brightest 35
skySunAzimuthDegrees The direction of the sun around the vertical axis: 0 towards −y, 90 towards +x, 180 towards +y 150
skyTurbidity How hazy the air is: 1 clear to 20 4

gradient takes three colours, as CSS colours:

Field The colour Default
gradientTopColor Straight up #e8f0ff
gradientHorizonColor At the horizon #ffffff
gradientBottomColor Straight down #606468

One panorama image

An equirectangular image, also called latitude-longitude: twice as wide as high, 360° around from left to right and from straight up to straight down from top to bottom. This is the format of Blender world textures and HDRI sites.

"renderSettings": {
  "lighting": "physical",
  "toneMapping": "neutral",
  "environment": {
    "type": "equirectangular",
    "file": "environmentmap/sunrise.exr",
    "azimuthDegrees": 90,
    "intensity": 1,
    "background": false
  }
}

file is relative to the JSON file. It can be:

  • .hdr or .exr: high dynamic range, with the full brightness of lamps and the sun. Use it with "lighting": "physical" and a toneMapping, so the brightest parts are not clipped.
  • .jpg, .png or .webp: smaller files, with less range.

The image is made with y up and the widget turns it to its z-up world.


Six cube map images

Six square images, one for each axis direction, in the standard cube map layout for the widget’s z-up world: pz is up and nz is down. The paths are relative to the JSON file.

"renderSettings": {
  "environment": {
    "type": "cubemap",
    "files": {
      "px": "env/px.jpg", "nx": "env/nx.jpg",
      "py": "env/py.jpg", "ny": "env/ny.jpg",
      "pz": "env/pz.jpg", "nz": "env/nz.jpg"
    }
  }
}

Older files set the same six images with the top-level environmentmap, with intensity next to them. That still works. When both are set, renderSettings.environment wins, and "type": "none" switches the environment off.

These fields work with every type:

Field What it does Default
intensity The strength of the light from the environment 1
background Also show the environment as the background, instead of backgroundColor false
blurriness Blurs the background, 0 sharp to 1 0.5 for generated, 0 otherwise
azimuthDegrees Turns the environment around the vertical axis, counter-clockwise seen from above: 90 brings what was towards +x to +y. The scene’s own lights do not turn along 0

"type": "none" switches the environment off.

Ambient occlusion

Ambient occlusion darkens corners, gaps and the places where parts touch, so the model looks less flat. It is computed every frame and costs about 40% more time per frame. Transparent parts and trace lines are left out.

Field What it does Default
enable Switches it on false
radius How far apart, in m, surfaces still darken each other 0.25
intensity How dark, from 0 to 1 1
thickness How thick the widget assumes surfaces are. Lower values reduce dark halos behind thin parts 0.1
samples Samples per pixel: more is smoother and slower 16

Bloom

Bloom adds a glow around bright parts, such as LEDs and lamps. Make a part glow with an emissive material, or with an emissiveIntensity link.

Field What it does Default
enable Switches it on false
strength How strong the glow is 1
radius How far the glow spreads 0.1
threshold How bright a part must be to glow. The environment adds to the brightness of a material too 1

With an environment, raise threshold above 1, otherwise shiny parts that reflect a bright environment glow as well.