Post

SpotLight

SpotLight

Overview

SpotLight is a light source that illuminates geometry within a conical beam. Lighting illuminates all geometry except lines and points. By default, light scope only illuminates peer geometry and children nodes within the scene graph hierarchy. Lights have no visible shape themselves and lighting effects continue through any intermediate geometry.

The SpotLight node belongs to the Lighting component and requires at least level 2, its default container field is children. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
+ X3DNode
  + X3DChildNode
    + X3DLightNode
      + SpotLight

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFBool [in, out] global TRUE

Global lights illuminate all objects within their volume of lighting influence. Scoped lights only illuminate objects within the same transformation hierarchy.

Warning

  • DirectionalLight default global=false to limit scope and avoid inadvertently illuminating every object in a large scene. PointLight and SpotLight default global=true since their effects are each limited by maximum radius value.

SFBool [in, out] on TRUE

Enables/disables this light source.

SFColor [in, out] color 1 1 1 [0,1]

color of light, applied to colors of objects.

Hint

SFFloat [in, out] intensity 1 [0,∞)

Brightness of direct emission from the light.

SFFloat [in, out] ambientIntensity 0 [0,1]

Brightness of ambient (nondirectional background) emission from the light.

SFVec3f [in, out] attenuation 1 0 0 [0,∞)

Constant, linear-distance and squared-distance dropoff factors as radial distance increases from the source.

Hint

  • attenuation = 1/max(attenuation[0] + attenuation[1] ⨯ r + attenuation[2] ⨯ r2 , 1)

SFVec3f [in, out] location 0 0 0 (-∞,∞)

Position of light relative to local coordinate system.

SFVec3f [in, out] direction 0 0 -1 (-∞,∞)

Orientation vector of light relative to local coordinate system.

SFFloat [in, out] radius 100 [0,∞)

Maximum effective distance of light relative to local light position, affected by ancestor scaling.

SFFloat [in, out] beamWidth π*3/16 (0,π/2]

Inner conical solid angle (in radians) where light source has uniform full intensity.

Hints

  • beamWidth is inner angle of full intensity, cutOffAngle is outer angle of zero intensity. Therefore set beamWidth <= cutOffAngle.
  • Radian units for angular measure

Warning

  • If beamWidth > cutOffAngle, then beamWidth is reset to equal cutOffAngle.

SFFloat [in, out] cutOffAngle π/2 (0,π/2]

Outer conical solid angle (in radians) where light source intensity becomes zero.

Hints

  • BeamWidth is inner angle of full intensity, cutOffAngle is outer angle of zero intensity. Therefore set beamWidth <= cutOffAngle.
  • Radian units for angular measure

Warning

  • If beamWidth > cutOffAngle, then beamWidth is reset to equal cutOffAngle.

SFBool [in, out] shadows FALSE

shadows field indicates whether or not this light casts a shadow behind illuminated X3DShapeNode geometry.

SFColor [in, out] shadowColor 0 0 0 [0,1] non standard

Color of shadow, applied to colors of objects.

SFFloat [in, out] shadowIntensity 1 [0,1]

shadowIntensity field defines how much light is obscured by shapes that cast shadows, ranging from 0 (light not obscured, no visible shadows) to 1 (light completely obscured, full-intensity shadows).

SFFloat [in, out] shadowBias 0.005 [0,1] non standard

The shadowBias value controls the visibility of shadow acne.

SFInt32 [ ] shadowMapSize 1024 [0,∞) non standard

Size of the shadow map in pixels, must be power of two.

Advice

Hint

  • The bound NavigationInfo controls whether headlight is enabled on/off.

Example

See Also

This post is licensed under CC BY 4.0 by the author.