MPassContext Class Reference

This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013, 3.4 Effect Overrides, 4.2 Lighting Interfaces.



Detailed Description

Class to allow access to pass context information.

MPassContext provides access to current pass context information. The term "pass context" is used to denote a logical breakdown of the render loop within a single frame to render.

A "pass" denotes the highest level elements of the breakdown. Each pass has a unique identifier and a list of semantics.

The identifier can either be an internally specified identifier or the name of a custom scene or user render operation (MSceneRender, MUserRenderOperation respectively).

The semantics provide a description of what is being rendered. The list of semantics is ordered, from first to last element, such that the first element provides the broadest description and additional elements refine (provides additional details) about the previous element.

The following is a list of semantics which may be returned as the first element of the semantic list. Possible refining semantics are also described.

  • A "color pass" semantic implies rendering for color output. Rendering for a color pass can be further broken down into the follow logical categorizations:
    • Color drawing of opaque surfaces. For this, an additional semantic can describe if a material override is being used.
    • Color drawing of transparent surfaces. For this, a breakdown of whether the drawing is occurring with back or front-face culling may be specified.
    • Color drawing of the UI for surfaces.
  • A "shadow pass" semantic implies rendering to create a shadow map.
  • A "depth" pass semantic implies rendering for depth output only and not color.
  • A "depth and normal" semantic implies rendering of depth and object normals as output.
  • A "user pass" semantic implies that a user operation (MUserRenderOperation) is the current operation being executed for the active render override (MRenderOverride)

As an example, the semantic list returned may contain these elements:

[ color pass, opaque surface drawing, material override ]

This indicates that the active pass is drawing to a color output. Also that the render items being draw are opaque, and that those render items are being drawing with a material override.

As a second example, the semantic list returned may contain these elements:

[ color pass, transparent surface drawing, back-face culling ]

This means that the active pass is drawing to a color output. Also that the render items being drawn are transparent, and that those render items are being drawing with back-face culling enabled.

Examples:

cgfxShaderNode.cpp, footPrintNode.cpp, and hwPhongShader.cpp.

#include <MDrawContext.h>

List of all members.

Public Member Functions

const MStringpassIdentifier () const
 Return the identifier for the pass context.
const MStringArraypassSemantics () const
 Return an array of semantics for the pass context.
bool hasShaderOverride () const
 Return if there is a shader instance override set for the current pass.

Static Public Attributes

static const MString kColorPassSemantic
 Semantic for a color pass.
static const MString kShadowPassSemantic
 Semantic for a shadow pass.
static const MString kDepthPassSemantic
 Semantic for a depth pass.
static const MString kNormalDepthPassSemantic
 Semantic for a normal and depth pass.
static const MString kOpaqueGeometrySemantic
 Semantic to indicate opaque surfaces are being drawn.
static const MString kUIGeometrySemantic
 Semantic to indicate UI for surfaces is being drawn. e.g. the wireframe or components.
static const MString kTransparentGeometrySemantic
 Semantic to indicate transparent surfaces are being drawn.
static const MString kCullBackSemantic
 Semantic to indicate that back-face culling is being applied.
static const MString kCullFrontSemantic
 Semantic to indicate that front-face culling is being applied.
static const MString kMaterialOverrideSemantic
 Semantic to indicate that a material override is being used.
static const MString kUserPassSemantic
 Semantic to indicate a user defined pass (MUserRenderOperation)

Member Function Documentation

const MString & passIdentifier ( ) const

Return the identifier for the pass context.

If a render override is active, then the name of the current operation will be returned.

Returns:
identifier string
Examples:
cgfxShaderNode.cpp, footPrintNode.cpp, and hwPhongShader.cpp.
const MStringArray & passSemantics ( ) const

Return an array of semantics for the pass context.

The array may contain the following semantics:

  • MPassContext::colorPassSemantic : Indicates a color pass.
  • MPassContext::shadowPassSemantic : Indicates a shadow map pass.
Returns:
semantic string array
Examples:
cgfxShaderNode.cpp, footPrintNode.cpp, and hwPhongShader.cpp.
bool hasShaderOverride ( ) const

Return if there is a shader instance override set for the current pass.

Returns:
true if override set
Examples:
hwPhongShader.cpp.

MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext
MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext MPassContext