DirectionalLight Node

If you're new to lighting in VRML, there is a Lighting section in this tutorial which discusses general features of lighting in VRML. In here only the aspects which are particular to Directional Lights are discussed. 

Directional Lights define a light source which is placed very far away from your world (don't worry you don't have to specify a location for the light). The light rays when they reach the world are parallel to a given direction). This field specifies a vector in 3D to which the light rays are parallel. The following figure attempts to define graphically a Directional Light. 

 

This light should only affect the nodes which are defined within the same group, i.e. objects placed outside the group where the Directional Light is defined are not lit. I say should and not must because not all browsers support this feature. 

The following fields are present in this node: 
  • on specifies if the light is active. This is a boolean field. 
  • intensity has values between 0.0 and 1.0. Higher values specify stronger lights. 
  • ambientIntensity specifies how much this light contributes to the overall lighting .Values must be between 0.0 and 1.0 
  • color is a RGB field to specify the color of the light.. 
  • direction which specifies a vector in 3D. The light rays are parallel to this vector. 
  • Syntax: 
    DirectionalLight { 
    on TRUE 
    intensity 1 
    ambientIntensity 0 
    color 1 1 1 
    direction 0 0 -1 

    Note: On the VRML world presented as example the sphere is placed at -2.5 0 0, the cone is placed at the origin, and the cylinder is placed at 2.5 0 0. If you're not familiar with placing shapes other than at the origin see the Transform node.