Light

From ActiveWiki
Jump to navigation Jump to search
Light
Build

N/A

Version

3.1

The light command causes an object to emit light into the surrounding scene. The light emits from the center of the object's bounding box and shines on any surrounding polygons facing towards the object.

Usage

light [type=type] [color=color] [brightness=brightness] [radius=radius] [name=name] [fx=fx] [time=time] [angle=angle] [pitch=pitch]
An unlit scene
The same scene, with the yellow cube emitting the intense red light
The source code of the red light

type

The type specifies the type of light source, which can be either "point" or "spot". "Point" light sources shine equally in all directions, and are the default if no type is specified. "Spot" light sources shine a "cone" of light in a particular direction.

color

The color argument specifies the color of the light source and can either be specified as one of many preset word values or as a "raw" hexadecimal value giving the red/green/blue component values (the same format as used for the "BGCOLOR=" tag in HTML).

brightness

The brightness specifies how brightly the light source shines. Brightness is specified as a positive floating-point value. The default brightness is 0.5.

radius

The radius specifies the maximum distance away the light shines, in meters. Objects beyond this distance from the light will receive no illumination from the light. The default radius is 10 meters. The radius is particularly useful for preventing lights from shining outside the room in which they are placed; since Active Worlds does not currently support shadows, walls and other objects do not stop lights from shining into adjacent rooms or buildings. Note that the radius is subject to a maximum value as set in the world features for each world.

fx

The fx argument specifies one of several optional lighting "effects" that can be applied to the light source. All of the effects cause the brightness of the object to vary over time. They include:

  • blink - light alternates equally between on and off
  • fadein - light fades in from dark to full brightness
  • fadeout - light fades out from full brightness to dark (after which it deletes itself from the object)
  • fire - light flickers randomly like a flame
  • flicker - light switches off for a brief period at random intervals
  • flash - light switches on for a brief period at random intervals
  • pulse - light fades in and then back out at regular intervals

If you omit the fx parameter, the light will be steady, and will not vary brightness over time.

time

The time argument specifies the interval in seconds for the blink, pulse, fadein, and fadeout effects. It has no effect for the other effects. The default time is 1 second.

angle and pitch

The angle and pitch arguments control "spot" light sources. The angle specifies how wide (in degrees) a cone of light emits from the spot; the default is 45 degrees. The pitch specifies the angle up from straight down that the spot light points. The default pitch is 0, meaning spot light point straight down by default.

name

The name specifies the name of another nearby object to place the new light on.

Note that light sources require additional GPU resources to render and thus should be used sparingly. Each new light source added to a scene will reduce the frame rate by a small amount. Excessive use of extra lights can severely impact the performance of an area or world. Some graphics cards or drivers may limit the number of light sources which will render at the same time on a given computer system.

Also, note that the degree to which a light source "shines" on a particular object is also a function of the diffuse component of the surface lighting properties of that object. The lower the diffuse lighting component of the object, the less a light source will influence it. If an object has no diffuse lighting, light sources will not have any effect on it.

Each object may have only one light source applied to it at a time.

Examples

create light
  • Creates a white point light source at the center of the object
create light color=orange fx=fire
  • Creates an orange light source that flickers like a flame.
activate light type=spot color=blue name=ceiling pitch=45
  • Creates an object that when clicked on, creates a spot light source pointing down at a 45 degree angle from any nearby objects named "ceiling".
create light color=red brightness=3 fx=pulse time=5
  • Creates a bright red light source (3 times normal brightness) that fades in and out every 5 seconds.
Object Scripting

Triggers: CreateBumpActivateAdoneAtCollideSdoneEnter ZoneExit Zone

Commands: AddforceAddtorqueAlpharefAnimateAstartAstopCameraColliderColltagColorCoronaEnviExamineFrameGroupLightLinkLockMatfxMediaMidiMoveNameNoiseOpacityPictureRotateSayScale SeqShadowShearSignSkewSkyboxSolidSoundTagTeleport / TeleportxTextureTimerURLVelocityVisibleWarpWeb nl:Commando:Light