Light Object Agents

 

Light Objects are created using the Light() constructor. The script can specify which light is used by passing the name of the Light, or using a Light index number. If no argument is passed, the first light is used.

	lgt = Light(); 		//Create a Light Object from the first light.
	lgt = Light(2);		//Create a Light Object from the second light.
	lgt = Light("Light1");	//Create a Light Object from the light named "Light1".

Note: Remember that not all of the common Data Members and Methods apply to Light Objects.

Data Members

type
type holds a constant (read-only) integer value that identifies the type of this Light (one of DISTANTLIGHT, POINTLIGHT, SPOTLIGHT LINEARLIGHT or AREALIGHT).

shadowtype
shadowtype holds a constant (read-only) integer value that identifies the shadow type of this Light (one of SHADOWRAYTRACE, SHADOWMAP or SHADOWOFF).

coneangles[]
coneangles[] holds an array of two floating-point numbers that represent the cone angles for this Light if it is a SPOTLIGHT. The first element [1] represents the radius as half the total Spotlight cone angle, and element [2] indicates the angular width of the Spotlight's soft edge.

range
range contains the maximum range (in meters) of the intensity falloff if this setting is enabled, and the light is not a DISTANTLIGHT.

flags[ ]
The flags[] data member is an array of six elements, each corresponding to the flag values returned by the SDK function. More specifically, each element provides the following information about the Light:

flags[1]true if Limited Rangeis enabled

flags[2] true if Affect Diffuse is enabled

flags[3] true if Affect Specular is enabled

flags[4] true if Affect Caustics is enabled

flags[5] true if Lens Flare is enabled

flags[6] true if Volumetric is enabled

Methods

ambient(time), rgbambient(time)
ambient(time), rgbambient(time) return a vector or array of three values that represent the global ambient Light's color values at the specified 'time' index. ambient() returns the channel value as a vector whose individual elements are a percentage between 0.0 and 1.0, while rgbambient() returns the channel value as a series of three integers, each between 0 and 255.

color(time), rgbcolor(time)
color(time), rgbcolor(time)return a vector or array of three values that represent the Light's color values at the specified 'time' index. color() returns the channel value as a vector whose individual elements are a percentage between 0.0 and 1.0, while rgbcolor() returns the channel value as a series of three integers, each between 0 and 255.

Examples:

This example creates a Light Object from the first light in the scene. It then displays some of the values stored in the Light Objectís Data Members and Methods.

@version 2.2 
@warnings 
@name LightObjectAgentTest 
@script generic 
 
//Set Globals
{
	light = Light(); 
 
	// Display some Data Members. 
	info("Name: ", light.name); 
	info("Type: ", light.type);
	//Display some Methods. 
	info("Position: ",light.getPosition(frame)); 
	info("Rotation: ",light.getRotation(frame)); 
	info("Ambient: ", light.ambient(frame)); 
	info("Color: ", light.color(frame));
}

Layout Commands

LensFlare();
LightColor("<red>","<green>","<blue>");
LightConeAngle("<angle>");
LightEdgeAngle("<angle>");
LightFalloffType("<type>");
LightIntensity("<intensity>");
LightIntensityTool();
LightQuality("<quality>");
LightRange("<distance>");
LightView();
AddAreaLight("<name>");
AddDistantLight("<name>");
AddLinearLight("<name>");
AddPointLight("<name>");
AddSpotlight("<name>");
AffectCaustics();
AffectDiffuse();
AffectOpenGL();
AffectSpecular();
AmbientColor("<red>","<green>","<blue>");
AmbientIntensity("<intensity>");>/b>
AreaLight();
BlurBackgroundRadiosity();LW 9.3.1 and above
CacheCaustics();
CacheRadiosity();
CacheShadowMap();
CastShadow();
CausticIntensity("<intensity>");
ClearAllLights();
ConeAngleTool();
DistantLight();
EditLights();
EnableCaustics();
EnableLensFlares();
EnableRadiosity();
EnableShadowMaps();
EnableVolumetricLights();
ExcludeObject("<ID>");
FlareIntensity("<intensity>");
FlareOptions();
GlobalIllumination();
IncludeObject("<ID>");
IndirectBounces("<limit>");
LinearLight();
NoiseReduction();
PointLight();
RadiosityIntensity("<intensity>");
RadiosityTolerance("<tolerance>");
RadiosityType("<type>");
SelectAllLights();
ShadowColor("<red>","<green>","<blue>");
ShadowExclusion();
ShadowMapAngle("<angle>");
ShadowMapFitCone();
ShadowMapFuzziness("<fuzziness>");
ShadowMapSize("<size>");
ShadowType("<type>");
Spotlight();