Shader semantics supported by Viewport 2.0

The following semantics are recognized and supported for use with shaders in Viewport 2.0. They can be used when authoring full effects which are accessed as MShaderInstance objects using the MShaderManager class. They may also be applied to the parameters of fragments which are registered using MFragmentManager.

Note: The dx11Shader.mll and glslShader.mll plug-ins are both MPxShaderOverrides. Therefore, each must parse the effects to determine and bind the semantics manually. By comparison, both the fragment system and MShaderInstance do all this automatically; however, they are both also more restrictive.

The world co-ordinate system can be further divided into different locales, each with a different origin. A node can then be specified in any of these locales. This allows the node position to be made with greater precision than if it were defined in the world co-ordinate system.

All matrices that belong to the FrameLocale group are re-applied when the locale of a current node is different from the locale of a previous node. At render time, camera and lights are transformed into the current node's locale space so that the object, the camera, and the lights are all represented in the same local co-ordinate space and can be stored and represented with single precision floating point values.

SemanticUsageTypeGroup
WorldWorld transformationMatrix

Item FL

WorldTransposeWorld transformation, transposedMatrix

Item FL

WorldInverseWorld transformation, invertedMatrix

Item FL

WorldInverseTransposeWorld transformation, inverted and transposedMatrix

Item FL

PreviousWorldPrevious world transformationMatrixItem
NextWorldNext world transformationMatrixItem
    
ViewView transformationMatrixFrameLocale
ViewTransposeView transformation, transposedMatrixFrameLocale
ViewInverseView transformation, invertedMatrixFrameLocale
ViewInverseTransposeView transformation, inverted and transposedMatrixFrameLocale
    
ProjectionProjection transformationMatrixFrame
ProjectionTransposeProjection transformation, transposedMatrixFrame
ProjectionInverseProjection transformation, invertedMatrixFrame
ProjectionInverseTransposeProjection transformation, inverted and transposedMatrixFrame

ProjectionZSense

Denotes whether the projection matrix flips the Z component of a point when transformed: if so, -1.0; otherwise 1.0.FloatFrame
    
WorldViewWorld-view transformationMatrix

Item FL

WorldViewTransposeWorld-view transformation, transposedMatrix

Item FL

WorldViewInverseWorld-view transformation, invertedMatrix

Item FL

WorldViewInverseTransposeWorld-view transformation, inverted and transposedMatrix

Item FL

WorldLocaleOrigin

Apply an offset to the locale transformation matrix to obtain the true (global) world transformation matrix.

Applying this offset can result in a lack of precision in cases where double precision is required to represent an accurate position in large coordinate systems.

Float3

FrameLocale

    
ViewProjectionView-projection transformationMatrixFrameLocale
ViewProjectionTransposeView-projection transformation, transposedMatrixFrameLocale
ViewProjectionInverseView-projection transformation, invertedMatrixFrameLocale
ViewProjectionInverseTransposeView-projection transformation, inverted and transposedMatrixFrameLocale
PreviousViewProjectionPrevious view-projection transformationMatrixFrameLocale
    
WorldViewProjectionWorld-view-projection transformationMatrix

Item FL

WorldViewProjectionTransposeWorld-view-projection transformation, transposedMatrix

Item FL

WorldViewProjectionInverseWorld-view-projection transformation, invertedMatrix

Item FL

WorldViewProjectionInverseTransposeWorld-view-projection transformation, inverted and transposedMatrix

Item FL

The following are MultiDraw versions of other semantics, used as alternates for rendering MultiDraw consolidation if MPxShaderOverride::supportsMultiDraw() is overridden to return true.

WorldMDMultiDraw array of World transformationMatrix[64]

Item FL

WorldTMDMultiDraw array of World transformation, transposedMatrix[64]

Item FL

WorldIMDMultiDraw array of World transformation, invertedMatrix[64]

Item FL

WorldITMDMultiDraw array of World transformation, inverted and transposedMatrix[64]

Item FL

    
WorldViewMDMultiDraw array of World-view transformationMatrix[64]

Item FL

WorldViewTMDMultiDraw array of World-view transformation, transposedMatrix[64]

Item FL

WorldViewIMDMultiDraw array of World-view transformation, invertedMatrix[64]

Item FL

WorldViewITMDMultiDraw array of World-view transformation, inverted and transposedMatrix[64]

Item FL

    
WorldViewProjMDMultiDraw array of World-view-projection transformationMatrix[64]

Item FL

WorldViewProjTMDMultiDraw array of World-view-projection transformation, transposedMatrix[64]

Item FL

WorldViewProjIMDMultiDraw array of World-view-projection transformation, invertedMatrix[64]

Item FL

WorldViewProjITMDMultiDraw array of World-view-projection transformation, inverted and transposedMatrix[64]

Item FL

    
ViewDirectionWorld-space direction of the view (camera)Float3FrameLocale
ViewPositionWorld-space position of the view (camera)Float3FrameLocale
LocalViewerDenotes whether a local or non-local view direction is to be usedBoolFrame
    
IsOrthoGraphicDenotes whether the projection matrix is orthographicBoolFrame
    
ViewportPixelSizeDimensions of the current viewport in pixels, width and heightFloat2Frame
    
ClippingPlanesThe coefficients of active clipping planes, one float4 per planeFloat4 ArrayClipping
ClippingPlaneCountThe number of active clipping planesIntClipping
NearClipPlaneThe camera’s near clipping planeFloatFrame
    

Time

AnimationTime

Sas.Time.Now

Time in seconds

Note:

Only applicable to shading overrides created using an MPxShaderOverride. The MPxShaderOverride must support auto-binding of MUniformParameters to the shader uniform parameters.

That is, the MPxShaderOverride must create an MUniformParameter for each uniform parameter, retrieve each MUniformParameter value based on its associated semantic, and bind this value to the shader uniform parameter.

This is automatically done by the dx11Shader and glslShader plug-ins.

In addition, Time and Frame are only available when the effects file is loaded from the glslShader plug-in.

FloatFrame

Frame

FrameNumber

Frame in frame units

Note:

Only applicable to shading overrides created using an MPxShaderOverride. The MPxShaderOverride must support auto-binding of MUniformParameters to the shader uniform parameters.

That is, the MPxShaderOverride must create an MUniformParameter for each uniform parameter, retrieve each MUniformParameter value based on its associated semantic, and bind this value to the shader uniform parameter.

This is automatically done by the dx11Shader and glslShader plug-ins.

IntFrame
    
AlphaTestFunctionThe alpha test comparison function

1 = Never

2 = Less

3 = Equal

4 = Less or Equal

5 = Greater

6 = Not Equal

7 = Greater or Equal

8 = Always

IntAlpha Test
AlphaTestReferenceThe alpha test reference value, in the range of (0.0, 1.0)FloatAlpha Test
    
RelativeViewportDimensionsSpecifies relative viewport dimensionsFloat2Frame
    
MayaReceivesShadowOnDenotes whether the object receives shadowsBoolItem
    
EnableXRayCompDenotes whether xray component mode is enabledBoolFrame
    
MayaViewportModesViewport modes

0 = Does not contain bounding box

1 = Contains bounding box

IntFrame
    
FogEnabledDenotes whether hardware fog is enabledBoolFrame
FogModeHardware fog falloff mode

0 = Linear

1 = Exponential

2 = Exponential-squared

IntFrame
FogStartHardware fog start z-distance in view spaceFloatFrame
FogEndHardware fog end z-distance in view spaceFloatFrame
FogDensityHardware fog densityFloatFrame
FogColorHardware fog colorFloat4Frame

Note: FL denotes that the semantic is also frame locale dependant.