Scene
The container for all 3D graphical objects and state in a Cesium virtual scene. Generally, a scene is not created directly; instead, it is implicitly created by CesiumWidget.
// Create scene without anisotropic texture filtering
const scene = new Scene({
canvas : canvas,
contextOptions : {
allowTextureFilterAnisotropic : false
}
});
See also
Types
Properties
Settings for atmosphere lighting effects affecting 3D Tiles and model rendering. This is not to be confused with Scene.skyAtmosphere which is responsible for rendering the sky.
The background color, which is only visible if there is no sky box, i.e., Scene.skyBox is undefined.
Whether or not the camera is underneath the globe.
Gets the canvas element to which this scene is bound.
Returns true
if the Scene.clampToHeight and Scene.clampToHeightMostDetailed functions are supported.
Determines whether or not to instantly complete the scene transition animation on user input.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
This property is for debugging only; it is not for production use.
The drawingBufferHeight of the underlying GL context.
The drawingBufferWidth of the underlying GL context.
The eye separation distance in meters for use with cardboard or WebVR.
The far-to-near ratio of the multi-frustum when using a normal depth buffer.
The focal length for use when with cardboard or WebVR.
Gets the collection of ground primitives.
Whether or not to use high dynamic range rendering.
Whether or not high dynamic range rendering is supported.
Gets the collection of image layers that will be rendered on the globe.
When false
, 3D Tiles will render normally. When true
, classified 3D Tile geometry will render normally and unclassified 3D Tile geometry will render with the color multiplied by Scene.invertClassificationColor.
The highlight color of unclassified 3D Tile geometry when Scene.invertClassification is true
. When the color's alpha is less than 1.0, the unclassified portions of the 3D Tiles will not blend correctly with the classified positions of the 3D Tiles. Also, when the color's alpha is less than 1.0, the WEBGL_depth_texture and EXT_frag_depth WebGL extensions must be supported.
Returns true
if the Scene.invertClassification is supported.
Gets the simulation time when the scene was last rendered. Returns undefined if the scene has not yet been rendered.
Whether or not to use a logarithmic depth buffer. Enabling this option will allow for less frustums in the multi-frustum, increasing performance. This property relies on fragmentDepth being supported.
The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer.
Get the map projection to use in 2D and Columbus View modes.
The maximum aliased line width, in pixels, supported by this WebGL implementation. It will be at least one.
The maximum length in pixels of one edge of a cube map, supported by this WebGL implementation. It will be at least 16.
If Scene.requestRenderMode is true
, this value defines the maximum change in simulation time allowed before a render is requested. Lower values increase the number of frames rendered and higher values decrease the number of frames rendered. If undefined
, changes to the simulation time will never request a render. This value impacts the rate of rendering for changes in the scene like lighting, entity property updates, and animations.
The distance from the camera at which to disable the depth test of billboards, labels and points to, for example, prevent clipping against terrain. When set to zero, the depth test should always be applied. When less than zero, the depth test should never be applied. Setting the disableDepthTestDistance property of a billboard, label or point will override this value.
The event fired at the completion of a scene transition.
The event fired at the beginning of a scene transition.
The sample rate of multisample antialiasing (values greater than 1 enable MSAA).
Returns true
if the Scene's context supports MSAA.
Determines the uniform depth size in meters of each frustum of the multifrustum in 2D. If a primitive or model close to the surface shows z-fighting, decreasing this will eliminate the artifact, but decrease performance. On the other hand, increasing this will increase performance but may cause z-fighting among primitives close to the surface.
Gets whether or not the scene has order independent translucency enabled. Note that this only reflects the original construction option, and there are other factors that could prevent OIT from functioning on a given system configuration.
Returns true
if the Scene.pickPosition function is supported.
When true
, enables picking translucent geometry using the depth buffer. Note that Scene.useDepthPicking must also be true for enabling this to work.
Post processing effects applied to the final render.
Gets the event that will be raised immediately after the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
Gets the event that will be raised immediately after the scene is updated and before the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
Gets the event that will be raised after the scene is updated and immediately before the scene is rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
Gets the event that will be raised before the scene is updated or rendered. Subscribers to the event receive the Scene instance as the first parameter and the current time as the second parameter.
Gets the collection of primitives.
Gets the event that will be raised when an error is thrown inside the render
function. The Scene instance and the thrown error are the only two parameters passed to the event handler. By default, errors are not rethrown after this event is raised, but that can be changed by setting the rethrowRenderErrors
property.
When true
, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using Scene.requestRender to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API.
Exceptions occurring in render
are always caught in order to raise the renderError
event. If this property is true, the error is rethrown after the event is raised. If this property is false, the render
function returns normally after raising the event.
Returns true
if the Scene.sampleHeight and Scene.sampleHeightMostDetailed functions are supported.
Gets whether or not the scene is optimized for 3D only viewing.
Gets the controller for camera input handling.
The sky atmosphere drawn around the globe.
The url to the KTX2 file containing the specular environment map and convoluted mipmaps for image-based lighting of PBR models.
Returns true
if specular environment maps are supported.
The spherical harmonic coefficients for image-based lighting of PBR models.
Gets or sets the position of the splitter within the viewport. Valid values are between 0.0 and 1.0.
The terrain provider providing surface geometry for the globe.
Gets an event that's raised when the terrain provider is changed
When true
, enables picking using the depth buffer.
The vertical exaggeration of the scene. When set to 1.0, no exaggeration is applied.
The reference height for vertical exaggeration of the scene. When set to 0.0, the exaggeration is applied relative to the ellipsoid surface.
Functions
Transforms a position in cartesian coordinates to canvas coordinates. This is commonly used to place an HTML element at the same screen position as an object in the scene.
Clamps the given cartesian position to the scene geometry along the geodetic surface normal. Returns the clamped position or undefined
if there was no scene geometry to clamp to. May be used to clamp objects to the globe, 3D Tiles, or primitives in the scene.
Initiates an asynchronous Scene.clampToHeight query for an array of Cartesian3 positions using the maximum level of detail for 3D Tilesets in the scene. Returns a promise that is resolved when the query completes. Each position is modified in place. If a position cannot be clamped because no geometry can be sampled at that location, or another error occurs, the element in the array is set to undefined.
Instantly completes an active transition.
Returns a list of objects, each containing a primitive
property, for all primitives at a particular window coordinate position. Other properties may also be set depending on the type of primitive and may be used to further identify the picked object. The primitives in the list are ordered by their visual order in the scene (front to back).
Determines if a compressed texture format is supported.
Returns true if this object was destroyed; otherwise, false.
Asynchronously transitions the scene to Columbus View.
Returns an object with a primitive
property that contains the first (top) primitive in the scene at a particular window coordinate or undefined if nothing is at the location. Other properties may potentially be set depending on the type of primitive and may be used to further identify the picked object.
Pick a metadata value at the given window position.
Pick the schema of the metadata of the object at the given position
Returns the cartesian position reconstructed from the depth buffer and window position.
Update and render the scene. It is usually not necessary to call this function directly because CesiumWidget will do it automatically.
Requests a new rendered frame when Scene.requestRenderMode is set to true
. The render rate will not exceed the CesiumWidget.targetFrameRate.
Returns the height of scene geometry at the given cartographic position or undefined
if there was no scene geometry to sample height from. The height of the input position is ignored. May be used to clamp objects to the globe, 3D Tiles, or primitives in the scene.
Initiates an asynchronous Scene.sampleHeight query for an array of Cartographic positions using the maximum level of detail for 3D Tilesets in the scene. The height of the input positions is ignored. Returns a promise that is resolved when the query completes. Each point height is modified in place. If a height cannot be determined because no geometry can be sampled at that location, or another error occurs, the height is set to undefined.
Update the terrain providing surface geometry for the globe.