OpenGL VRML Shockwave 3D
Home Tutorials Books Applications Tools Docs Models Textures

Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Group
Transform
Collision
Anchor
Billboard
Switch
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

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.



    Site designed and maintained by António Ramires Fernandes
    Your comments, suggestions and references to further material are welcome!

    Lighthouse 3D privacy statement