AmbientLight

This light globally illuminates all objects in the scene equally. This light cannot be used to cast shadows as it does not have a direction.

Constructor

new AmbientLight(coloropt, intensityopt)

Parameters:
NameTypeAttributesDefaultDescription
colornumber<optional>
0xffffff
intensitynumber<optional>
1

Extends

Members

castShadow :boolean

Whether the object gets rendered into shadow map.

Type:
  • boolean
Default Value
  • false

children :Array.<Object3D>

Object's parent in the scene graph. An object can have at most one parent.

Type:

color :Color3

Color of the light.

Type:
Overrides
Default Value
  • Color3(0xffffff)

euler :Euler

Object's local rotation as an Euler, in radians.

Type:
Overrides
Default Value
  • Euler(0, 0, 0)

frustumCulled :boolean

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. Otherwise the object gets rendered every frame even if it isn't visible.

Type:
  • boolean
Default Value
  • true

groupMask :number

Group mask of the light, indicating which lighting group the light belongs to. Default is 1 (binary 0001), meaning the light belongs to lighting group 0. For example, to make the light effective in both lighting group 0 and lighting group 1, set groupMask to 3 (binary 0011). Used in conjunction with Material#lightingGroup.

Type:
  • number
Default Value
  • 1

(readonly) id :number

Unique number for this object instance.

Type:
  • number
Overrides

intensity :number

The light's intensity, or strength.

Type:
  • number
Default Value
  • 1

(readonly) isAmbientLight :boolean

Type:
  • boolean
Default Value
  • true

(readonly) isLight :boolean

Type:
  • boolean
Overrides
Default Value
  • true

matrix :Matrix4

The local transform matrix.

Type:
Overrides

matrixAutoUpdate :boolean

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the worldMatrix property.

Type:
  • boolean
Default Value
  • true

matrixNeedsUpdate :boolean

When this is set, it calculates the matrix in that frame and resets this property to false.

Type:
  • boolean
Default Value
  • true

name :string

Optional name of the object (doesn't need to be unique).

Type:
  • string
Overrides
Default Value
  • ""

parent :Object3D

Object's parent in the scene graph. An object can have at most one parent.

Overrides

position :Vector3

A Vector3 representing the object's local position.

Type:
Default Value
  • Vector3(0, 0, 0)

quaternion :Quaternion

Object's local rotation as a Quaternion.

Default Value
  • Quaternion(0, 0, 0, 1)

receiveShadow :boolean

Whether the material receives shadows.

Type:
  • boolean
Default Value
  • false

renderLayer :number

Render layer of this object. RenderQueue will dispatch all renderable objects to the corresponding RenderQueueLayer according to object.renderLayer.

Type:
  • number
Default Value
  • 0

renderOrder :number

This value allows the default rendering order of scene graph objects to be overridden although opaque and transparent objects remain sorted independently. Sorting is from lowest to highest renderOrder.

Type:
  • number
Default Value
  • 0

renderable :boolean

Whether it can be collected into the Render Queue.

Type:
  • boolean
Default Value
  • true

scale :Vector3

The object's local scale.

Type:
Overrides
Default Value
  • Vector3(1, 1, 1)

shadowType :SHADOW_TYPE

Defines shadow map type. Note: In webgl1 or Scene#disableShadowSampler is true, soft shadow types will fallback to POISSON_SOFT without warning. Note: Point light only support POISSON_SOFT for now.

Default Value
  • SHADOW_TYPE.PCF3_SOFT

userData :object

An object that can be used to store custom data about the Object3D. It should not hold references to functions as these will not be cloned.

Type:
  • object
Default Value
  • {}

uuid :string

UUID of this object instance. This gets automatically assigned, so this shouldn't be edited.

Type:
  • string
Overrides

visible :boolean

Object gets rendered if true.

Type:
  • boolean
Overrides
Default Value
  • true

worldMatrix :Matrix4

The global transform of the object. If the Object3D has no parent, then it's identical to the local transform Object3D#matrix.

Type:

worldMatrixNeedsUpdate :boolean

When this is set, it calculates the world matrix in that frame and resets this property to false.

Type:
  • boolean
Default Value
  • true

Methods

add(object)

Add object as child of this object.

Parameters:
NameTypeDescription
objectObject3D
Overrides

clone(recursiveopt) → {Object3D}

Returns a clone of this object and optionally all descendants.

Parameters:
NameTypeAttributesDefaultDescription
recursivefunction<optional>
true

if true, descendants of the object are also cloned.

Overrides
Returns:
Type: 
Object3D

copy(source) → {Light}

Copies properties from the source light into this one.

Parameters:
NameTypeDescription
sourceLight

The source light.

Overrides
Returns:
  • This light.
Type: 
Light

getObjectByName(name) → {Object3D}

Searches through the object's children and returns the first with a matching name. Note that for most objects the name is an empty string by default. You will have to set it manually to make use of this method.

Parameters:
NameTypeDescription
namestring

String to match to the children's Object3D#name property.

Returns:
Type: 
Object3D

getObjectByProperty(name, value) → {Object3D}

Searches through the object's children and returns the first with a property that matches the value given.

Parameters:
NameTypeDescription
namestring

the property name to search for.

valuenumber

value of the given property.

Returns:
Type: 
Object3D

getWorldDirection(optionalTargetopt) → {Vector3}

Returns a vector representing the direction of object's positive z-axis in world space. This call must be after Object3D#updateMatrix.

Parameters:
NameTypeAttributesDescription
optionalTargetVector3<optional>

— the result will be copied into this Vector3.

Returns:
  • the result.
Type: 
Vector3

lookAt(target, up)

Set light direction, this func will set quaternion of this light.

Parameters:
NameTypeDescription
targetVector3

The target that the light look at.

upVector3

The up direction of the light.

Overrides

onAfterRender()

An optional callback that is executed immediately after the Object3D is rendered.

onBeforeRender()

An optional callback that is executed immediately before the Object3D is rendered.

(abstract) raycast(ray, intersects)

Method to get intersections between a casted ray and this object.

Parameters:
NameTypeDescription
rayRay

The Ray instance.

intersectsArray

output intersects array.

Overrides

remove(object)

Remove object as child of this object.

Parameters:
NameTypeDescription
objectObject3D
Overrides

traverse(callback)

Executes the callback on this object and all descendants.

Parameters:
NameTypeDescription
callbackfunction

A function with as first argument an object3D object.

updateMatrix(force)

Update the local transform.

Parameters:
NameTypeDescription
forceboolean