Class: SpotLight

X3D: 3.3
Component: Lighting
Status:
fully implemented

.nodeTypes. SpotLight

The SpotLight node defines a light source that emits light from a specific point along a specific direction vector and constrained within a solid angle. Spotlights may illuminate geometry nodes that respond to light sources and intersect the solid angle defined by the SpotLight. Spotlight nodes are specified in the local coordinate system and are affected by ancestors' transformations.

HTML Encoding and Default Values

<SpotLight ambientIntensity='0' attenuation='1,0,0' beamWidth='pi * 3/16' color='1,1,1' cutOffAngle='pi/2' direction='0,0,-1' global='false' intensity='1' location='0,0,0' metadata='X3DMetadataObject' on='true' radius='100' shadowCascades='1' shadowFilterSize='0' shadowIntensity='0' shadowMapSize='1024' shadowOffset='0' shadowSplitFactor='1' shadowSplitOffset='0.1' zFar='-1' zNear='-1' ></SpotLight>

Inheritance


Constructor

SpotLight(ctx)

Constructor for SpotLight

Parameters:
Name Type Argument Default Description
ctx Object <optional>
null context object, containing initial settings like namespace

Fields

These are the X3D / X3DOM fields of this node. Values should usually be received / set as strings via DOM functions (i.e., using setAttribute("myFieldName", "myFieldValue") and getAttribute("myFieldName")).
Name Type Default Value Range Inheritance Standard Description
ambientIntensity SFFloat 0 [0, 1] X3DLightNode The ambientIntensity specifies the intensity of the ambient emission from the light. Light intensity may range from 0.0 (no light emission) to 1.0 (full intensity).
attenuation SFVec3f 1,0,0 [0, inf] SpotLight node's illumination falls off with distance as specified by three attenuation coefficients. The attenuation factor is: 1/max(attenuation[0] + attenuation[1] × r + attenuation[2] × r^2, 1) where r is the distance from the light to the surface being illuminated. The default is no attenuation. An attenuation value of (0, 0, 0) is identical to (1, 0, 0). Attenuation values shall be greater than or equal to zero.
beamWidth SFFloat pi * 3/16 [0, pi/2] The beamWidth field specifies an inner solid angle in which the light source emits light at uniform full intensity. The light source's emission intensity drops off from the inner solid angle (beamWidth) to the outer solid angle (cutOffAngle). If the beamWidth is greater than the cutOffAngle, beamWidth is defined to be equal to the cutOffAngle and the light source emits full intensity within the entire solid angle defined by cutOffAngle.
color SFColor 1,1,1 [0, 1] X3DLightNode The color field specifies the spectral colour properties of both the direct and ambient light emission as an RGB value.
cutOffAngle SFFloat pi/2 [0, pi/2] The cutOffAngle field specifies the outer bound of the solid angle. The light source does not emit light outside of this solid angle. The light source's emission intensity drops off from the inner solid angle (beamWidth) to the outer solid angle (cutOffAngle). If the beamWidth is greater than the cutOffAngle, beamWidth is defined to be equal to the cutOffAngle and the light source emits full intensity within the entire solid angle defined by cutOffAngle.
direction SFVec3f 0,0,-1 The direction field specifies the direction vector of the light's central axis defined in the local coordinate system.
global SFBool false X3DLightNode Specifies whether the light is global or scoped. Global lights illuminate all objects that fall within their volume of lighting influence. Scoped lights only illuminate objects that are in the same transformation hierarchy as the light; i.e., only the children and descendants of its enclosing parent group are illuminated.
intensity SFFloat 1 [0, 1] X3DLightNode The intensity field specifies the brightness of the direct emission from the light. Light intensity may range from 0.0 (no light emission) to 1.0 (full intensity).
location SFVec3f 0,0,0 The location field specifies a translation offset of the centre point of the light source from the light's local coordinate system origin. This point is the apex of the solid angle which bounds light emission from the given light source. Location is affected by ancestors' transformations.
metadata SFNode X3DMetadataObject X3DNode Field to add metadata information
on SFBool true X3DLightNode The on field specifies whether the light is enabled or disabled.
radius SFFloat 100 [0, inf] The radius field specifies the radial extent of the solid angle and the maximum distance from location that may be illuminated by the light source. The light source does not emit light outside this radius. The radius shall be greater than or equal to zero. Radius is affected by ancestors' transformations.
shadowCascades SFInt32 1
shadowFilterSize SFInt32 0 X3DLightNode Sets the smoothness of the shadow umbra.
shadowIntensity SFFloat 0 [o, 1] X3DLightNode Defines the attenuation of the shadows
shadowMapSize SFInt32 1024 [0, inf] X3DLightNode Specifies the resolution of the used shadow map.
shadowOffset SFFloat 0 X3DLightNode Defines the shadow offset for the back projection of the shadow map.
shadowSplitFactor SFFloat 1
shadowSplitOffset SFFloat 1
zFar SFFloat -1 -1 or [0, inf] X3DLightNode Specifies the placement of the far plane of the light projection. Objects that are farther away from the light source than the far plane do not cast shadows. If the zFar value is not set, the far plane is placed automatically.
zNear SFFloat -1 -1 or [0, inf] X3DLightNode Specifies the placement of the near plane of the light projection. Objects that are closer to the light source than the near plane do not cast shadows. If the zNear value is not set, the near plane is placed automatically.