MAXScript Language Reference > 3ds Max Objects > Interfaces > Core Interfaces > Core Interfaces Documentation > I,J,K >

# Interface: IViewportShadingMgr

Interfaces> Core Interfaces > IViewportShadingMgr

| Viewport Shading - Quick Navigation | Core Interfaces - Quick Navigation

The IViewportShadingMgr Core Interface exposes some properties of the advanced hardware viewport shading (per-pixel illumination and shadow casting) to MAXScript.

This interface is available in 3ds Max 2008 and higher.

Some additional properties related to viewport shading have been exposed in 3ds Max 2010 via a different set of interfaces documented here.

    Interface: IViewportShadingMgr

Properties:

    IViewportShadingMgr.	 ShadingLimits : enum : Read|Write

    ShadingLimits enums: { #None | #Good | #Best }

Get/Set the Viewport Shading Limits:

- None - old mode, light limit dependent on graphics driver, typically 8 lights, per vertex lighting.

- Good (SM 2.0) - shadow casting is enabled. On graphics hardware that supports only the SM2.0 shader model, only the old-style per vertex lighting will be calculated.

- Best (SM 3.0) - shadow casting and per-pixel lighting are enabled, 64 lights are supported. This mode depends on the graphics hardware which must be SM 3.0 compliant.

This method is equivalent to the properties .ActivateViewportShading and .ShadingQuality exposed by the ViewportBasicSettings Interface in 3ds Max 2010 and higher.

    IViewportShadingMgr.AutoDisplaySelLights : bool : Read|Write

Get/Set the state of the "Auto Display Selected Lights" checkbox in the "Lighting and Shadows" tab of the "Viewport Configuration" dialog. When set to true, the currently selected lights will be enabled to illuminate/cast shadows, while unselected lights will be off. When set to false, all lights will be turned on.

    IViewportShadingMgr.DefaultLightCastShadows : bool : Read|Write

Get/Set the state of the "Cast Shadows for Default Light" checkbox in the "Lighting and Shadows" tab of the "Viewport Configuration" dialog. When set to true, the default lights will cast shadows. When set to false, default lights will not cast shadows.

    IViewportShadingMgr.GlobalShadowIntensity : float : Read|Write

Get/Set the value of the "Global Shadow Intensity" spinner in the "Lighting and Shadows" tab of the "Viewport Configuration" dialog. Controls the intensity of the viewport Shadows. When set to 0.5, shadows will be 50% less dense.

    IViewportShadingMgr.UseTransparencyInShadows : bool : Read|Write

Get/Set whether viewport shadows will respect transparency.

    IViewportShadingMgr.UpdateShadowsInActiveViewportOnly : bool : Read|Write

Get/Set whether viewport shadows will update in the active viewport only (true) or in all viewports (false, default).

    IViewportShadingMgr.MaxActiveLight : integer : Read|Write

Get/Set the maximum number of lights to be displayed in the viewport. Default is 64.

Available in 3ds Max 2009 and higher.

    IViewportShadingMgr.UseGITransparency : bool : Read|Write

Get/Set whether the Ambient Occlusion mode will respect transparency or not.

Available in 3ds Max 2010 and higher.

    IViewportShadingMgr.ShadowFilterSize : float : Read|Write

Get/Set the soft shadows filter size. Should be in the range from 0.0 to 1.0.

Available in 3ds Max 2010 and higher.

Methods:

    <void>IViewportShadingMgr.SelectShadowCastingLights()

Calling this method selects all lights currently set to cast shadows in the viewports.

Only the Light node's Interface: INodeShadingProperties . ViewportShadowCasting property value is taken into account, not the base object's shadow casting property.

    <void>IViewportShadingMgr.SelectIlluminatingLights()

Calling this method selects all lights currently set to illuminate in the viewports.

Only the Light node's Interface: INodeShadingProperties . ViewportIllumination property value is taken into account, not the base object's .on property.

    <void>IViewportShadingMgr.DisplayOnlySelectedLights()

Calling this method disables the viewport illumination for all lights that are not selected, enabling only the selected lights to illuminate in the viewports.

If no lights are selected, the illumination is disabled for all lights.

The method manipulates the Light Node's Interface: INodeShadingProperties . ViewportIllumination property, turning Viewport Illumination on and off based on the node's selected state. It does not affect the node's . ViewportShadowCasting property.

    <void>IViewportShadingMgr.LockSelectedLights <bool>locked

Locks/Unlocks the currently selected lights.

When the .AutoDisplaySelLights property is set to true, lights that are not selected will not illuminate the scene.

You can lock the current selection to keep on illuminating the scene even after it has been deselected using this method with argument of true , or unlock the selected lights again by passing an argument of false .

    <void>IViewportShadingMgr.GetViewportShadingLights <&node array>nodeList <enum>lightProperty

    nodeList is In and Out parameter
    lightProperty enums: {#ShadowCasting|#Illuminating|#Locked}

Returns the viewport shading lights into the by-reference array nodeList.

The lightProperty enum defines whether to collect the shadow-casting, the illuminating or the locked lights.

    <void>IViewportShadingMgr.CastShadowsSelectedOnly <bool>Enabled

When the argument is true, the system will be switched to cast shadows only from selected lights. When the argument is false, all lights will be allowed to cast shadows.

    <bool>IViewportShadingMgr.IsLightNodeSupported <node>LightNode

Returns true if the given light is supported by the Viewport Shading system.

    <bool>IViewportShadingMgr.IsShadingLimitValid <enum>ShadingLimits

    ShadingLimits enums: {#None|#Good|#Best}

Returns true if the given shading mode is valid on the current hardware.

    <void>IViewportShadingMgr.ReviewGPUDiagnostics()

Prints a GPU diagnostics report to the MAXScript Listener.

EXAMPLE
    IViewportShadingMgr.ReviewGPUDiagnostics()
    //////////////////////////////////////////////////////
    ////////// Review GPU Feature Support ////////////
    //////////////////////////////////////////////////////
    Graphics Vendor Information: Direct3D 9.0 (NVIDIA Quadro FX 4000)
    GPU Shader Model Support: SM3.0
    Maximum pixel shader instruction count: 4096
    Viewport Shading Quality: Best
    Real-time Sun and Sky: Supported
    Real-time Architectural Material: Supported
    //////////////////////////////////////////////////////
    OK

    <void>IViewportShadingMgr.SetViewportShadingLimits <enum>ShadingLimits Quiet:<bool>

    ShadingLimits enums: {#None|#Good|#Best}
    Quiet default value: true

Sets the viewport shading limit to the given mode. If the quiet: optional keyword argument is specified as true, no errors will be reported if the given node is not supported on the current system.

#### See Also

- Interface: INodeShadingProperties

- Viewport Shading Settings

- Interface: ViewportSSB

- Core Interfaces