LightSource
ClassActs as a source of light in the scene.
- Available on all platforms
Index
Properties
- autoLightSourcePosition
- autoShadowFrustumSize
- color
- diffuseEnvmapTexture
- enabled
- envmapExposure
- envmapRotation
- falloffRange
- falloffType
- innerConeAngleDegrees
- intensity
- isBeingDestroyed
- isEnabledInHierarchy
- lightType
- outerConeAngleDegrees
- renderLayer
- sceneObject
- shadowBlurRadius
- shadowColor
- shadowDensity
- shadowFrustumFarClipPlane
- shadowFrustumNearClipPlane
- shadowFrustumSize
- shadowType
- specularEnvmapTexture
- uniqueIdentifier
- useEnvmap
Methods
Example
// Sets the intensity of a light source
//@input Component.LightSource lightSource
script.lightSource.intensity = 0.0;
Extends
Properties
autoLightSourcePosition
autoLightSourcePosition:
boolean
If enabled, the LightSource will be automatically positioned based on its orientation relative to any shadow casting meshes in the scene.
Default Value
false
autoShadowFrustumSize
autoShadowFrustumSize:
boolean
If enabled, shadowFrustumSize will be automatically updated based on its orientation relative to any shadow casting meshes in the scene.
Default Value
false
color
color:
vec3
The color of the light.
Default Value
(1, 1, 1)
diffuseEnvmapTexture
diffuseEnvmapTexture:
Texture
A color image applied to an imaginary skybox the LightSource will use for color information.
Default Value
null
enabled
enabled:
boolean
If disabled, the Component will stop enacting its behavior.
Default Value
true
Inherited from
envmapExposure
envmapExposure:
number
A value used to increase the intensity of light information derived from the diffuseEnvmapTexture exponentially.
Default Value
1
envmapRotation
envmapRotation:
number
Controls the amount of rotation applied to the diffuseEnvmapTexture.
Default Value
0
falloffRange
falloffRange:
number
The distance (in cm) at which the light’s intensity reaches 0.0.
Use any value that is larger than 100m (10000cm) for a limitless range and better performance (see FalloffType.Quadratic).
Default Value
Infinity
falloffType
falloffType:
FalloffType
The falloff type of the light.
Since
Lens Scripting Version 341
Default Value
FalloffType.None
innerConeAngleDegrees
innerConeAngleDegrees:
number
The angle in degrees from the center of the spotlight at which the light’s intensity will begin to decrease towards 0.0. Only applies when LightSource#lightType is LightType.Spot. Normally set no larger than LightSource#outerConeAngleDegrees; a larger value is still valid and simply removes the feathering.
Since
Lens Scripting Version 375
Default Value
0
Example
// Feathers the spotlight edge between the inner and outer cone
//@input Component.LightSource lightSource
script.lightSource.lightType = LightType.Spot;
script.lightSource.innerConeAngleDegrees = 15.0;
intensity
intensity:
number
The intensity of the light.
Default Value
1
isBeingDestroyed
readonlyisBeingDestroyed:boolean
Returns true if this Component is currently being destroyed. Becomes true as soon as
destruction begins via Component#destroy or destruction of its owning SceneObject,
before any OnDestroyEvent callbacks fire.
Since
Lens Scripting Version 364
Example
if (!script.isBeingDestroyed) {
// Component is still fully alive
}
Inherited from
isEnabledInHierarchy
readonlyisEnabledInHierarchy:boolean
Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.
Inherited from
Component.isEnabledInHierarchy
lightType
lightType:
LightType
The type of light emitted from this light source.
Since
Lens Scripting Version 300
Default Value
LightType.Point
outerConeAngleDegrees
outerConeAngleDegrees:
number
The angle in degrees from the center of the spotlight at which the light’s intensity will reach 0.0. Only applies when LightSource#lightType is LightType.Spot.
Since
Lens Scripting Version 375
Default Value
45
Example
// Widens the spotlight to a 60 degree cone
//@input Component.LightSource lightSource
script.lightSource.lightType = LightType.Spot;
script.lightSource.outerConeAngleDegrees = 60.0;
renderLayer
renderLayer:
LayerSet
The set of layers this LightSource will affect.
Default Value
LayerSet.all()
sceneObject
readonlysceneObject:SceneObject
The SceneObject this component is on.
Inherited from
shadowBlurRadius
shadowBlurRadius:
number
Controls the blurring size used when casting shadows from this LightSource.
Default Value
0
shadowColor
shadowColor:
vec4
Controls the color used when casting shadows from this LightSource.
Default Value
(0, 0, 0, 0)
shadowDensity
shadowDensity:
number
The lightness and darkness value of the shadow cast by objects from this light source.
Default Value
1
shadowFrustumFarClipPlane
shadowFrustumFarClipPlane:
number
The maximum distance at which shadows will be calculated for this LightSource.
Default Value
1000
shadowFrustumNearClipPlane
shadowFrustumNearClipPlane:
number
The minimum distance at which shadows will be calculated for this LightSource.
Default Value
1
shadowFrustumSize
shadowFrustumSize:
number
The simulated distance of the light source from objects to calculate the softness of the shadow.
Default Value
30
shadowType
shadowType:
ShadowType
Control whether this light can cast shadows, and what techique to use: Projective or Shadow Map.
Since
Lens Scripting Version 307
Default Value
ShadowType.None
specularEnvmapTexture
specularEnvmapTexture:
Texture
A color image applied to an imaginary skybox the light source will use for specular and reflection information.
Default Value
null
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
useEnvmap
useEnvmap:
boolean
Enable if you would like the LightSource to use information from the diffuseEnvmapTexture for light color information.
Default Value
false
Methods
destroy()
destroy():
void
Destroys the component.
Returns
void
Inherited from
getSceneObject()
getSceneObject():
SceneObject
Returns the SceneObject the component is attached to.
Returns
Inherited from
getTransform()
getTransform():
Transform
Returns the Transform this component is attached to.
Returns
Inherited from
getTypeName()
staticgetTypeName():TypeName<LightSource>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<LightSource>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
See also
Light and Shadows guide.