Interface: SceneEffectLoader

new.gif NEW in 3ds Max 9: This Interface exposes the Scene Effect Loader Utility to MAXScript.


<bool>LoadSceneEffect <filename>effectFile effectType:<enum> numberOfPasses:<integer>

effectType enums: {#Post|#Pre|#Env}

effectType default value: #Post

numberOfPasses default value: 0

Loads the specified effects file into the Scene Effect Loader.

Loads the specified file and registers it with the Scene Effect system. The system maintains three lists: Post, Pre and Env.

#Post = The effect is applied at the end of the scene graph. E.g Sepia, or edge detect

#Pre = Runs before any geometry is rendered. Useful for background effects. Only the first pre effect loaded will be used.

#Env = Environmental effects - these are run in a seperate pass and general create data for object based shaders or shaders later on in the scene graph. An example would shadows, or depth info

To specify which list the effect belongs to, use the effectType: argument.

The numberOfPasses: argument is only used with Env type shaders. Environment shaders need to tell the system how many passes it requires, for example to create a cubemap the shader would need 6 passed.

The lists are maintained in the order they are generated. This means that the effects are run in the same order. So if you want to reorganise the list, simply remove all effects and apply them in the correct order.



Resets the Scene Effect Loader, removing all effects.

<bool>EnableSceneEffects <bool>enable

Enables or disables the Scene Effect Loader depending on the boolean argument. If there are not "post" effects present then the system will not be enabled. There need to be at least one post effect for the system to be able to render.


Returns true if the Scene Effect Loader is enabled, false otherwise.

<integer>GetNumberOfSceneEffects effectType:<enum>

effectType enums: {#Post|#Pre|#Env}

effectType default value: #Post

Returns the number of scene effects currently loaded in the Scene Effect Loader. By default, returns only Post Effects unless the effect type is specified explicitly.

<bool>RemoveSceneEffect <index>index effectType:<enum>

effectType enums: {#Post|#Pre|#Env}

effectType default value: #Post

Removes the indexed scene effect from the Loader. By default affects the Post Effects list. A different effect type can be specified to affect the corresponding effects list.


<material>GetSceneEffect <index>index effectType:<enum>

effectType enums: {#Post|#Pre|#Env}

effectType default value: #Post

Returns a DirectX Shader material hosting the indexed effect from the specified effects list. For example, if the Post list contains the effect post_corona.fx, calling this method with index 1 will create a DirectX Shader with this fx file loaded which could be assigned to any slot of the Material Editor for tweaking or manipulated using MAXScript.

For example:

theFile = (GetDir #maxroot + "maps\\fx\\scene\\post_corona.fx") --the FX file

SceneEffectLoader.LoadSceneEffect theFile --add the file to the Post list.

theShader = SceneEffectLoader.GetSceneEffect 1 --get the first Post effect

theShader.GlowCol = blue --set the glow color to blue

theShader.Bias = 8.0 --set the bias to 8

meditmaterials[1] = theShader --assign to MEdit slot 1 for manual tweaking

SceneEffectLoader.EnableSceneEffects true --enable the scene effects