ThreeJS Scenes

Fog

This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance.

Constructor

Fog( color : Integer, near : Float, far : Float )

The color parameter is passed to the Color constructor to set the color property. Color can be a hexadecimal integer or a CSS-style string.

Properties

.isFog : Boolean

Read-only flag to check whether a given object is of type Fog.

.name : String

Optional name of the object (doesn't need to be unique). Default is an empty string.

.color : Color

Fog color. Example: If set to black, far away objects will be rendered black.

.near : Float

The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog.

Default is 1.

.far : Float

The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog.

Default is 1000.

Methods

.clone () : Fog

Returns a new fog instance with the same parameters as this one.

.toJSON () : Object

Return fog data in JSON format.

FogExp2

This class contains the parameters that define exponential squared fog, which gives a clear view near the camera and a faster than exponentially densening fog farther from the camera.

Constructor

FogExp2( color : Integer, density : Float )

The color parameter is passed to the Color constructor to set the color property. Color can be a hexadecimal integer or a CSS-style string.

Properties

.isFogExp2 : Boolean

Read-only flag to check whether a given object is of type FogExp2.

.name : String

Optional name of the object (doesn't need to be unique). Default is an empty string.

.color : Color

Fog color. Example: If set to black, far away objects will be rendered black.

.density : Float

Defines how fast the fog will grow dense.

Default is 0.00025.

Methods

.clone () : FogExp2

Returns a new FogExp2 instance with the same parameters as this one.

.toJSON () : Object

Return FogExp2 data in JSON format.

Scene

Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.

Constructor

Scene()

Create a new scene object.

Properties

.autoUpdate : Boolean

Default is true. If set, then the renderer checks every frame if the scene and its objects needs matrix updates. When it isn't, then you have to maintain all matrices in the scene yourself.

.background : Object

If not null, sets the background used when rendering the scene, and is always rendered first. Can be set to a Color which sets the clear color, a Texture covering the canvas, a cubemap as a CubeTexture or an equirectangular as a Texture . Default is null.

.environment : Texture

If not null, this texture is set as the environment map for all physical materials in the scene. However, it's not possible to overwrite an existing texture assigned to MeshStandardMaterial.envMap. Default is null.

.fog : Fog

A fog instance defining the type of fog that affects everything rendered in the scene. Default is null.

.isScene : Boolean

Read-only flag to check whether a given object is of type Scene.

.overrideMaterial : Material

If not null, it will force everything in the scene to be rendered with that material. Default is null.

Methods

.toJSON ( meta : Object ) : Object

meta -- object containing metadata such as textures or images for the scene.

Convert the scene to three.js JSON Object/Scene format.