Interface: SceneEffectLoader

Interfaces > Core Interfaces > SceneEffectLoader

 

   

Core Interfaces - Quick Navigation

This Core Interface exposes the Scene Effect Loader Utility to MAXScript.

Available in 3ds Max 9 and higher.

   

Methods:

<bool>SceneEffectLoader.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. For example, Sepia or edge detect.

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

#Env - Environmental effects. These are run in a separate pass and generally create data for object based shaders or shaders later on in the scene graph. For example, shadows or depth info.

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

The numberOfPasses: argumentis only used with Env type shaders. Environment shaders must specify how many passes it requires to the system, for example, to create a cubemap, the shader will need six 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 reorganize the list, simply remove all effects and apply them in the correct order.

   

<void>SceneEffectLoader.ResetEffects() 

Resets the Scene Effect Loader, removing all effects.

   

<bool>SceneEffectLoader.EnableSceneEffects <bool>enable 

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

   

<bool>SceneEffectLoader.IsSceneEffectsEnabled() 

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

   

<integer>SceneEffectLoader.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>SceneEffectLoader.RemoveSceneEffect <index>index effectType:<enum> 

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

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

   

<material>SceneEffectLoader.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 can be assigned to any slot of the Material Editor for tweaking or manipulated using MAXScript.

NOTE:You can run the following example only if the Viewport driver is legacy Direct3D.

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