SpotlLight 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 Spot Lights are discussed. 

Spot Lights define a light source in a specified location pointed at a particular direction. The light rays from this type of light are constrained to the interior of a cone, the cone's apex coinciding with the light's location. The following figure attempts to define a Point Light graphically (the point where the light rays start is the light location

 

The cone of light is defined by two fields: cutOffAngle and beamWidth. The cutOffAngle defines the angle of the cone, in radians. The beamWidth defines the angle of an inner cone within which the light intensity is constant. The light rays which fall between the inner cone and the outer cone have a decreasing intensity from the inner to the outer cone. If the beamWidth is larger than the cutOffAngle then the light has a constant intensity within the cone. 


A Spot light lits all nodes regardless of their position in the file, i.e. this light is not scoped. There is however a way of limiting the volume which is lit by this light, one can specify a radius which defines the maximum distance that the light rays can travel. Objects which are further away from the light source than the radius, or lie outside the outer cone are not lit by the light source. 

There is still another way to control the attenuation. Using the attenuation field one can specify how the light grows dimmer with distance, within the sphere defined by the radius. 

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.. 
  • location which specifies a vector in 3D defining the coordinates of the light in your world. 
  • direction which specifies a vector in 3D defining the aim of the light. 
  • attenuation is a 3D vector that specifies how the light looses its intensity as distance from the light source increases. All vector values must be greater than or equal to zero 
  • radius specifies the maximum distance for the light rays to travel. Must be greater than or equal to zero. 
  • cutOffAngle specifies the cone within which the light rays are constrained. Must be greater than or equal to zero, and less than or equal to 180 degrees, approximately 1.57 radians. 
  • beamWidth specifies an inner cone within which the light rays have a uniform intensity . Must be greater than or equal to zero, and less than or equal to 180 degrees, approximately 1.57 radians. 
  • Syntax: 
    SpotLight { 
    on TRUE 
    intensity 1 
    ambientIntensity 0 
    color 1 1 1 
    location 0 0 0 
    direction 0 0 0 
    attenuation 1 0 0 
    radius 100 
    cutOffAngle 0.78 
    beamWidth 1.57 
    Note: Due to the default location and direction of the Spot Light the initially loaded world is black. 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.