Skip to content

ThreeView Properties

This page describes all properties and events available on a ThreeView instance.

Type: ThreeViewCamera

Read-only (getter)

The camera controller that manages the view’s position, orientation, projection, and interactive control behavior.

Example:

// Read the camera's geographic position
const pos = view.camera.positionGeographic;
// Subscribe to camera movement events
view.camera.on("moveend", () => {
console.log("Camera stopped");
});

Type: Globe

Read-only (getter)

The Globe instance that manages terrain, imagery layers, and globe-specific settings. Controls various properties related to globe display, including transparency, wireframe display, and elevation heatmap color maps.

Example:

// Set globe transparency
view.globe.transparent = true;
view.globe.opacity = 0.8;
// Enable wireframe mode
view.globe.wireframe = true;
// Set color map for elevation heatmap
view.globe.elevationColormap = customColorMap;

Type: Atmosphere

Read-only (getter)

The instance that manages the atmosphere system. Handles sun and moon position calculations and atmospheric scattering texture management. When the date property is changed, sun and moon directions are automatically recalculated based on the ephemeris and reflected in related Descriptors such as SunLightDesc and SkyMeshDesc.

Example:

// Set the date to change the sun position
view.atmosphere.date = new Date("2024-06-21T12:00:00");
// Get the sun direction vector
const sunDirection = view.atmosphere.getSunDirection();
// Determine if the current location is at night
const isNight = view.atmosphere.isAtNight(view.camera.positionECEF);
// Monitor sun direction changes
view.atmosphere.on("sunChanged", (sunDirection) => {
console.log("Sun direction changed:", sunDirection);
});

Type: number

Gets or sets the tone mapping exposure value for HDR rendering. Higher values make the scene brighter, lower values make it darker.

Example:

// Increase exposure for a brighter scene
view.toneMappingExposure = 1.5;
// Decrease exposure for a darker scene
view.toneMappingExposure = 0.8;

Type: boolean

Default: true

Gets or sets the scene-level default of the lit material option. When false, every material that does not set lit explicitly outputs plain albedo: the lighting equation is skipped on the color output, while the rest of the lit pipeline keeps running: normals and the shadow G-buffer are still written. That combination is the input a deferred lighting pass needs.

Resolution is three-state, and the more specific setting always wins:

SettingResult
lit: true on a material or meshLit, even when view.lit is false
lit: false on a material or meshPlain albedo, even when view.lit is true
lit unset (undefined)Follows view.lit

The option is available on the terrain, polygon, polyline and model materials, and top-level on any mesh Descriptor config (see MeshDesc). Materials that are unlit by nature (point, billboard, text) are unaffected.

Example:

// Scene default: everything outputs plain albedo
view.lit = false;
// …except this mesh, which stays forward-lit
view.addMesh<SphereMeshDesc>({
sphere: { radius: 100 },
position,
lit: true,
});

Type: ResolvedGBufferOptions

Read-only (getter)

The buffers currently allocated, as { selectiveEffect, emissive, shadow, globeNormal } booleans. This is derived, not configured: the view allocates the union of the static requiredBuffers declared by the active effect Descriptors, and releases a buffer when the last effect needing it is removed.

The first three are G-buffer attachments. globeNormal is a separate screen-space copy of the terrain normal, so it takes no attachment slot (see Custom Descriptor: Buffer / Texture Access).

Example:

console.log(view.buffers);
// { selectiveEffect: false, emissive: false, shadow: false, globeNormal: false }

Type: boolean

Gets or sets whether continuous animation mode is enabled. When true, renders every frame. When false, renders only on changes.

Example:

// Enable continuous rendering
view.animation = true;
// Render only when needed (power saving)
view.animation = false;

Type: Vector2

Gets the current screen size in pixels.

Read-only

Example:

const size = view.screenSize;
console.log(`Screen size: ${size.x} x ${size.y} pixels`);

Type: number

Gets the current device pixel ratio.

Read-only

Example:

const ratio = view.pixelRatio;
console.log(`Pixel ratio: ${ratio}`);

Type: boolean

Gets or sets whether the shadow map debug viewers are displayed on screen.

Example:

// Show shadow map debug views
view.shadowMapViewersEnabled = true;
// Hide debug views
view.shadowMapViewersEnabled = false;

Type: number | undefined

Gets or sets the tile-cache memory budget in bytes (see the cacheBytes option). The getter returns the resolved budget (undefined before init() when no explicit option was given). Lowering it at runtime evicts retained tiles down to the new budget over the next frames. Setting undefined disables budgeting entirely, restoring the original destroy-on-unvisited tile lifecycle.

Example:

// Read the resolved budget
console.log(`cache budget: ${(view.cacheBytes ?? 0) / 1024 / 1024} MB`);
// Shrink the budget at runtime (evicts down to it over the next frames)
view.cacheBytes = 256 * 1024 * 1024;
// Disable tile-cache budgeting
view.cacheBytes = undefined;

Type: getter LodFogSettings | undefined / setter Partial<LodFogSettings>

Gets or sets the LOD fog settings (see the lodFog option): a distance-based screen-space-error relaxation that keeps far tiles coarser. The getter returns the resolved settings (undefined before init()). Partial values assigned to the setter merge over the current settings. The next traversal re-selects tile LODs with the new curve.

Example:

// Strengthen the distance degrade — far tiles settle coarser
view.lodFog = { density: 2.5e-4, sseFactor: 3.0 };
// Only change one field; the rest keeps its current value
view.lodFog = { sseFactor: 4.0 };

Type: getter DynamicSseSettings | undefined / setter Partial<DynamicSseSettings>

Gets or sets the dynamic screen-space-error settings (see the dynamicSse option): tilted, street-level horizon views tolerate a larger error for far tiles. The getter returns the resolved settings (undefined before init()). Partial values assigned to the setter merge over the current settings. The next traversal re-selects tile LODs with the new curve.

Example:

// Disable dynamic SSE
view.dynamicSse = { enabled: false };
// Tune the relaxation strength for horizon views
view.dynamicSse = { sseFactor: 16.0, heightFalloff: 0.25 };