Light Common Properties, Operators, and Methods

The following properties apply to all light types except for the Free_Point and Target_Point light types present in 3D Studio VIZ. The properties of the Point lights are described in Free Point and Target Point.

<light>.type                      Name        default: #freeDirect

the valid type values are:

#omni

#freeSpot

#targetSpot

#freeDirect

#targetDirect

<light>.enabled                   Boolean     default: true   -- alias: on

Turns the light on and off. When on, shading and rendering use the light to illuminate the scene. When off, the light is not used in shading or rendering.

<light>.excludeList               Array       default: #()

Objects in this array are excluded from the effects of the light.

<light>.includeList               Array       default: undefined

Objects in this array receive the effects of the light.

<light>.inclExclType Integer default: 3

Select the type of object in the Include/Exclude list:

1- Illumination

2- Shadow Casting

3- Both

<light>.castShadows               Boolean     default: false

When on, the light will cast shadows on objects.

<light>.rgb                       Color       default: (color 180 180 180)  -- animatable, alias: color

The red, green, and blue components of the light's color.

<light>.hsv                       Point3      default: [0,0,180]

Hue, Saturation, and Value color of light.

<light>.hue                       Integer     default: 0      

Hue component of hsv.

<light>.saturation                Integer     default: 0      

Saturation component of hsv.

<light>.value                     Integer     default: 180    

Value component of hsv.

<light>.multiplier                Float       default: 1.0    -- animatable

Amplifies the power of the light by a positive or negative amount.

<light>.contrast                  Float       default: 0.0    -- animatable

Adjusts the contrast between the diffuse and ambient areas of the surface. Leave this set to 0 for normal contrast. Increase the value to increase the contrast for special effects: for example, the harsh light of outer space.

<light>.softenDiffuseEdge         Float       default: 0.0    -- animatable, alias: Diffuse_Soften

Increasing the value of Soften Diffuse Edge softens the edge between the diffuse and ambient portions of a surface. This helps eliminate edges that can appear on a surface under certain circumstances.

<light>.affectDiffuse             Boolean     default: true

When on, the light affects the diffuse properties of an object's surface. When off, the light has no effect on the diffuse surface.

<light>.affectSpecular            Boolean     default: true

When on, the light affects the specular properties of an object's surface. When off, the light has no effect on the specular properties.

<light>.ambientOnly               Boolean     default: false

When on, the light affects only the ambient component of the illumination.

<light>.projector                 Boolean     default: false

Turn on to project projectorMap.

<light>.projectorMap              TextureMap  default: undefined

Assigning a TextureMap to projectorMap causes a new subAnim named Projection_Map to be created for the light. This subAnim contains the properties of the TextureMap.

<light>.useShadowProjectorMap Boolean default: false

When on, the light will project a map.

<light>.nearAttenStart            Float       default: 0.0    -- alias: animatable, alias: Attenuation_Near_Start

The distance at which the light begins to fade in.

<light>.nearAttenEnd              Float       default: 40.0   -- alias: animatable, alias: Attenuation_Near_End

The distance at which the light reaches its full value.

<light>.useNearAtten              Boolean     default: false

Enables/Disables near attenuation for the light.

<light>.showNearAtten             Boolean     default: false

When on, displays the near attenuation range settings in viewports. For spotlights, attenuation ranges appear as lens-shaped sections of the cone. For directional lights, the ranges appear as circular sections of the cone. For omni lights and spot or directional lights with Overshoot turned on, the ranges appear as spheres.

<light>.farAttenStart             Float       default: 80.0   -- animatable, alias: Attenuation_Far_Start

The distance at which the light begins to fade out.

<light>.farAttenEnd               Float       default: 200.0  -- animatable, alias: Attenuation_Far_End

The distance at which the light has faded to zero.

<light>.useFarAtten               Boolean     default: false

Enables/Disables far attenuation for the light.

<light>.showFarAtten              Boolean     default: false

Displays the far attenuation range settings in viewports. For spotlights, attenuation ranges appear as lens-shaped sections of the cone. For directional lights, the ranges appear as circular sections of the cone. For omni lights and spot or directional lights with Overshoot turned on, the ranges appear as spheres.

<light>.attenDecay                Integer     default: 1

The type of decay to use:

1- None (Applies no decay. The light maintains full strength from its source to infinity, unless you turn on far attenuation.)

2- Inverse (Applies inverse decay. The formula is luminance=R0/R, where R0 is the radial source of the light if no attenuation is used, or the Near End value of the light if Attenuation is used. R is the radial distance of the illuminated surface from R0.)

3- Inverse Square (Applies inverse-square decay. The formula for this is (R0/R)2. This is actually the "real-world" decay of light, but you might find it too dim in the world of computer graphics.)

<light>.DecayRadius               Float       default: 40.0   -- animatable, alias: Decay_Falloff

The distance over which the decay occurs.

<light>.useGlobalShadowSettings   Boolean     default: false

Turn on to use global settings for shadows cast by this light. Turn off to enable individual control of the shadows.

<light>.raytracedShadows          Boolean     default: false

When true, ray traced shadows are produced. When false, shadow-mapped shadows are produced.

<light>.ShadowColor               Color       default: (color 0 0 0) -- animatable, alias: Shadow_Color

The color of shadows cast by this light.

<light>.shadowMultiplier          Float       default: 1.0    -- animatable, alias: Shadow_Density

<light>.shadowProjectorMap        TextureMap  default: undefined

Assigning a TextureMap to shadowProjectorMap causes a new subAnim named Shadow_Projection_Map to be created for the light. This subAnim contains the properties of the TextureMap.

<light>.lightAffectsShadow        Boolean     default: false

When on, blends the light's color with the shadow color (or shadow colors, if the shadow is mapped).

<light>.atmosShadows              Boolean     default: true

When on, atmospheric effects cast shadows as the light passes through them.

<light>.atmosOpacity              Float       default: 100.0  -- animatable, percentage, alias: Atmosphere_Opacity

Adjusts the opacity of the shadows. This value is a percentage.

<light>.atmosColorAmt             Float       default: 100.0  -- animatable, percentage, alias: Atmosphere_Color_Amount

Adjusts the amount that the atmosphere's color is blended with the shadow color.

If Shadow Maps are being used (raytracedShadows = false), the shadow properties are:

<light>.mapBias                   Float       default: 1.0    -- animatable, alias: map_bias

Moves the shadow toward or away from the shadow-casting object (or objects).

<light>.mapSize                   Integer     default: 512    -- animatable, alias: map_size

Sets the size (in pixels squared) of the shadow map that's computed for the light.

<light>.sampleRange               Float       default: 4.0    -- animatable, alias: map_range

Determines how much area within the shadow is averaged. This affects how soft the edge of the shadow is.

<light>.absoluteMapBias           Boolean     default: false  -- animatable

When on, the bias for the shadow map is not normalized, but is instead based on a fixed scale expressed in 3ds max units. This value does not change during an animation. You must choose the value, based on the size of the scene extents.

When off, the bias is computed relative to the rest of the scene, and then normalized to 1.0. This provides a common starting bias value in scenes of any size. If the scene extents change, this internal normalization can vary from frame to frame.

<light>.absolute_Bias             Integer     default: 0      -- integer alias of absoluteMapBias

If Ray Traced Shadows are being used (raytracedShadows = true), the shadow properties are:

<light>.raytraceBias              Float       default: 0.2    -- animatable

Moves the shadow toward or away from the shadow-casting object (or objects). If the Bias value is too low, shadows can "leak" through places they shouldn't, produce moire patterns or making out-of-place dark areas on meshes. If Bias is too high, shadows can "detach" from an object. If the Bias value is too extreme in either direction, shadows might not be rendered at all.

<light>.maxDepth                  Integer     default: 7      -- animatable

Adjusts the depth of the quadtree used by the raytracer. Greater quadtree depth values can improve ray-tracing time at the cost of memory use. However, there is a depth value where the performance improvement is offset by the time it takes to generate the quadtree itself. This depends on the geometry of the scene.

Notes

Setting includelist or excludelist sets the other to undefined.

Assigning a Projector TextureMap adds a subAnim to the properties list. The properties of the subAnim are the properties of the TextureMap.

The Attenuation Parameters/Decay/Show and Shadow Parameters/Map/Enable properties are not accessible by MAXScript in 3ds max 4.

See also