Skip to main content
It gives you a scene, a camera, a renderer, lights, a grid and a render loop. Use it when you do not have a Three.js scene of your own.

Import

Example

Notes

  • The container must have a width and a height.
  • The constructor starts the render loop. Do not add a second loop.
  • Start the geometry kernel separately, before you create elements.
  • dispose() stops the loop and removes the canvas.
  • new OpenThree(container, callback, { renderOnDemand: true }) draws a frame only when something changes: a camera move until it comes to rest, a resize, an object added to or removed from the scene, new kernel geometry, and a change of the watermark, checked once a second. The callback then runs only on those frames. Call requestRender() after any other change. The default is false: a frame on every animation frame.

Constructor

boolean
Draw a frame only when the camera, scene, geometry or watermark changes. Default false.

Properties

THREE.Scene
THREE.WebGLRenderer
PlanCamera
THREE.PerspectiveCamera
HTMLElement
ICanvasTheme
activeTheme
THREE.GridHelper | undefined

Methods

generateTheme

toggleTheme

setup

toggleGrid

hexToRgb

captureView

Render the scene from camera to a PNG data-URL, off-screen at an arbitrary resolution.

refineAnalyticView

Await this before a synchronous image capture to require a world-space chord error of at most deflection metres.

dispose

requestRender

Draw one frame at the next animation frame when renderOnDemand is on; else nothing.

animate

OpenThreeError

The refusal of an OpenThree call; failed lists the bodies of this view that failed.

Types

ICanvasTheme

activeTheme

OpenThreeOptions

OpenThreeErrorCode

Why an OpenThree call refused.

OpenThreeFailedBody

A kernel body of the view that the kernel could not mesh, with the kernel’s error.
Last modified on November 5, 2026