OrbPro2 a Cesium distribution

VirtualSun

new Cesium.VirtualSun(options)

A directional light source that casts cascaded shadows, mimicking the Sun's shadow behavior at any distance. Virtual suns use Cascaded Shadow Maps (CSM) to provide high-quality shadows regardless of object distance from the camera.
Name Type Description
options object Object with the following properties:
Name Type Default Description
direction Cartesian3 The direction the light is traveling in world coordinates.
color Color Color.WHITE optional The color of the light.
intensity number 2.0 optional The intensity of the light.
enabled boolean true optional Whether the virtual sun is enabled.
castShadows boolean true optional Whether the virtual sun casts shadows.
maximumDistance number 1e10 optional The maximum distance for shadows (defaults to very large for sun-like behavior).
size number 2048 optional The shadow map texture size in pixels.
softShadows boolean false optional Whether to use soft shadows (PCF).
darkness number 0.3 optional The darkness of the shadows (0.0 = no shadow, 1.0 = full black).
numberOfCascades number 4 optional Number of shadow cascades (1 or 4).
Example:
// Create a virtual sun pointing northeast and downward
const virtualSun = scene.virtualSuns.add({
  direction: new Cesium.Cartesian3(1, 1, -1),
  color: Cesium.Color.WHITE,
  intensity: 2.0,
  castShadows: true
});

// Update direction dynamically
virtualSun.direction = new Cesium.Cartesian3(0, 1, -0.5);

Members

Whether the virtual sun casts shadows.
The color of the light.
The darkness of the shadows (0.0 = no shadow, 1.0 = full black).
The direction the light is traveling in world coordinates (normalized).
Whether the virtual sun is enabled.
The intensity of the light.

maximumDistance : number

The maximum distance for shadows. Larger distances reduce shadow quality.

readonly numberOfCascades : number

The number of shadow cascades. Read-only after creation.
The shadow map used by this virtual sun. Read-only.
The shadow map texture size in pixels.
Whether to use soft shadows (PCF filtering).

Methods

destroy()undefined

Destroys the resources held by this object.
Returns:

isDestroyed()boolean

Returns true if this object was destroyed; otherwise, false.
Returns:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.