VRML : Cameras and Lights
Whilst it is probably good practice to setup cameras and lights in your
worlds, in many VRML viewers it isn't required. Netscape's plugin will
automatically move the camera so that all the objects in the scene are in
view unless a camera node is used. It will also give some background
lighting if no lights are defined in the scene. Cameras define where the
viewer starts in the world, as well a certain other values such as in which
direction they are looking, focal distance etc. Light nodes define what
colour the lights are, where they are, how bright they are etc.
Cameras
Cameras by default are located at (0,0,1) and look towards negative z. The
default focaldistance is 5. Cameras are affected by the current cumulative
translation and rotation values.
- OrthographicCamera
- An OrthographicCamera does not diminish objects with distance, whereas
the PerscpectiveCamera does. The viewing volume for an OrthographicCamera
is a box. The
position
parameter defines where it is
initially placed, whilst the orientation
parameter decides the
direction in which the camera is "looking". The height
parameter sets how "tall" the viewing volume is. The focalDistance
sets the distance at which an object is in focus, although out of
focus objects may be drawn as in-focus by many browsers.
Example: Setup a camera at (4,1,5).
OrthographicCamera {
height 1.7
position 4 1 5
}
- PerspectiveCamera
- Unlike the OrthographicCamera, this camera diminshes objects with
distance. Whereas the OrthographicCamera has a box for it's viewing volume,
a PerspectiveCamera has a pyramid as it's viewing volume, with the camera
at the top peak of the pyramid, looking straight down. The
heightAngle
parameter defines the total vertical viewing angle of
the camera. All other parameters are the shared with OrthographicCamera.
Example: Setup a PerspectiveCamera at (0,0,0), looking towards positive x.
PerspectiveCamera {
position 0 0 0
orientation 1 0 0 0
}
Lights
- DirectionalLight
- Use this node to create a light source that illuminates along a
defineable 3D vector. The
DirectionalLight
is unlike the
two other lights in that it isn't a point source (e.g. a bulb), but more
like a flat light-emmiting surface. It could also be thought of as a point
source an infinite distance away, similar to the sun at mid-day. The
direction
parameter selects the direction which the light
shines in, NOT from. Like the other lights, you can set it's colour
using the color
parameter.
Example: Create a yellow light coming from positive x.
DirectionalLight {
color 1 1 0
direction -1 0 0
}
- PointLight
- This creates a point light source at a definable point in space. The
light shines in all directions (i.e. it is omnidirectional). The
location
parameter defines where the light is.
Example: Create a dim cyan light source at (4,3,-3).
DirectionalLight {
color 0 1 1
intensity 0.3
location 4 3 -3
}
- SpotLight
- This creates a light source as a definable point in space. Unlike the
PointLight
, a SpotLight provides a cone shaped illumination.
The direction
parameter defines the central axis of this cone,
whilst the location
parameter defines where the apex of the
cone is. The dropOffRate
defines how quickly the intensity
of the light drops (the intensity decays in accordance with the inverse
square law). The cutOffAngle
parameter defines the angle of
the cone.
Exmaple: Create a red spotlight at (1,2,3) shining "down".
SpotLight {
color 1 0 0
direction 0 -1 0
location 1 2 3
}
Next Topic (Materials and Separators)
Previous Topic (Shapes)
Back to the VRML Reference
Back to the Main Page
©Tom Thurston, 1997
Please feel free to use and redistribute this NONcommercially!