Working with Atmospherics

The following 3ds max system global variables give you access to the global rendering environment:

backgroundColor

Lets you get and set a Color value that defines the global rendering environment (Rendering\Environment) background color.

backgroundColorController

Lets you get and set a Controller value that defines the global rendering environment (Rendering\Environment) background color controller.

ambientColor

Lets you get and set a Color value that defines the global rendering environment (Rendering\Environment) ambient lighting color.

ambientColorController

Lets you get and set a Controller value that defines the global rendering environment (Rendering\Environment) ambient lighting color controller.

environmentMap

Lets you get and set a TextureMap value that defines the global rendering environment (Rendering\Environment) environment map.

useEnvironmentMap

Lets you get and set the global rendering environment (Rendering\Environment) Use Map value. A Boolean value - true if Use Map is on, false if off.

lightTintColor

Lets you get and set a Color value that defines the global rendering environment (Rendering\Environment) Global Lighting Tint color.

lightTintColorController

Lets you get and set a Controller value that defines the global rendering environment (Rendering\Environment) Global Lighting Tint color controller.

lightLevel

Lets you get and set a Float value that defines the global rendering environment (Rendering\Environment) Global Lighting Tint Level.

lightLevelController

Lets you get and set a Controller value that defines the global rendering environment (Rendering\Environment) Global Lighting Tint Level controller.

numAtmospherics

Contains an Integer value that defines the number of atmospheric events, as shown in Rendering\Environment. This variable is read-only.

The following methods set options in the global rendering environment:

getUseEnvironmentMap()

setUseEnvironmentMap <boolean>

Lets you get and set the global rendering environment (Rendering\Environment) Use Map value. If <boolean> is true Use Map is turned on, false it is turned off.

getBackGroundController()

Returns the global rendering environment (Rendering\Environment) background color controller.

setBackGround <time> <point3>

Lets you set a Point3 value that defines the global rendering environment (Rendering\Environment) background color at the specified time. Each component of the Point3 value is in the range of 0 to 255.

setBackGroundController ( <color_controller> | <point3_controller> )

Assigns the specified controller as the global rendering environment (Rendering\Environment) background color controller.

Examples

ambientColor = color 10 10 25

environmentMap = bitmapTexture filename:"foo.bmp"

The following script shows an example of creating Volume Fog and Volume Light atmospherics.

Script:

-- Atmospheric Effects Test Bed

-- create a geosphere, sphere gizmo, onnilight, and targetted camera

geos=geosphere radius:24

sgizmo=spheregizmo radius:40

omni=omnilight farAttenStart:20 farAttenEnd:100 useFarAtten:true v=255

cam=targetcamera pos:[150,-50,100] target:(targetobject())

--

-- put a material on the geosphere

geos.material=standard()

geos.material.selfIllumColor = color 238 241 2

--

-- create a Volume Fog atmospheric. Set name so it has one in Environment dialog.

vf=volume_fog name:"VolFog" soften_gizmo_edges:0.7 exponential:1 density:75

vf.fog_color=color 255 157 0

vf.noise_type=2

vf.size=4

appendGizmo vf sgizmo

addAtmospheric vf

--

-- create a Volume Light atmospheric. Set name so it has one in Environment dialog.

vl=volume_light name: "VolLight" exponential:1 density:20

vl.fog_color=color 255 30 0

vl.attenuation_color= color 255 162 0

vl.Use_Attenuation_Color=1

vl.noise_on=1

vl.Noise_Amount=1

vl.size=5

vl.noise_type=2

appendGizmo vl omni

addAtmospheric vl

--

-- and render awayà

renderWidth=320

renderHeight=200

render camera:cam