Post

DirectionalLight

Overview

DirectionalLight defines parallel light rays that illuminate geometric shapes. Lighting illuminates all geometry except lines and points. By default, light scope only illuminates peer geometry and children nodes within the scene graph hierarchy. No source location is needed since rays are parallel from an infinitely distant source. DirectionalLight nodes do not attenuate with distance. Lights have no visible shape themselves and lighting effects continue through any intermediate geometry.

The DirectionalLight node belongs to the Lighting component and requires at least level 1, 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
      + DirectionalLight

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 FALSE

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. Interchange profile

Hint

  • This field may be ignored, applying the default value regardless.

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

Orientation vector of light relative to local coordinate system.

Hint

  • Animate direction to simulate time-of-day sunlight effects.

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

Hints

  • Animate direction to simulate time-of-day sunlight effects.
  • The bound NavigationInfo controls whether headlight is enabled on/off. Interchange profile
  • Light might not be scoped by parent Group or Transform.

Example

See Also

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