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.
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.
Semantic | Usage | Type | Group |
World | World transformation | Matrix |
Item FL |
WorldTranspose | World transformation, transposed | Matrix |
Item FL |
WorldInverse | World transformation, inverted | Matrix |
Item FL |
WorldInverseTranspose | World transformation, inverted and transposed | Matrix |
Item FL |
PreviousWorld | Previous world transformation | Matrix | Item |
NextWorld | Next world transformation | Matrix | Item |
View | View transformation | Matrix | FrameLocale |
ViewTranspose | View transformation, transposed | Matrix | FrameLocale |
ViewInverse | View transformation, inverted | Matrix | FrameLocale |
ViewInverseTranspose | View transformation, inverted and transposed | Matrix | FrameLocale |
Projection | Projection transformation | Matrix | Frame |
ProjectionTranspose | Projection transformation, transposed | Matrix | Frame |
ProjectionInverse | Projection transformation, inverted | Matrix | Frame |
ProjectionInverseTranspose | Projection transformation, inverted and transposed | Matrix | Frame |
ProjectionZSense |
Denotes whether the projection matrix flips the Z component of a point when transformed: if so, -1.0; otherwise 1.0. | Float | Frame |
WorldView | World-view transformation | Matrix |
Item FL |
WorldViewTranspose | World-view transformation, transposed | Matrix |
Item FL |
WorldViewInverse | World-view transformation, inverted | Matrix |
Item FL |
WorldViewInverseTranspose | World-view transformation, inverted and transposed | Matrix |
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 |
ViewProjection | View-projection transformation | Matrix | FrameLocale |
ViewProjectionTranspose | View-projection transformation, transposed | Matrix | FrameLocale |
ViewProjectionInverse | View-projection transformation, inverted | Matrix | FrameLocale |
ViewProjectionInverseTranspose | View-projection transformation, inverted and transposed | Matrix | FrameLocale |
PreviousViewProjection | Previous view-projection transformation | Matrix | FrameLocale |
WorldViewProjection | World-view-projection transformation | Matrix |
Item FL |
WorldViewProjectionTranspose | World-view-projection transformation, transposed | Matrix |
Item FL |
WorldViewProjectionInverse | World-view-projection transformation, inverted | Matrix |
Item FL |
WorldViewProjectionInverseTranspose | World-view-projection transformation, inverted and transposed | Matrix |
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. |
|||
WorldMD | MultiDraw array of World transformation | Matrix[64] |
Item FL |
WorldTMD | MultiDraw array of World transformation, transposed | Matrix[64] |
Item FL |
WorldIMD | MultiDraw array of World transformation, inverted | Matrix[64] |
Item FL |
WorldITMD | MultiDraw array of World transformation, inverted and transposed | Matrix[64] |
Item FL |
WorldViewMD | MultiDraw array of World-view transformation | Matrix[64] |
Item FL |
WorldViewTMD | MultiDraw array of World-view transformation, transposed | Matrix[64] |
Item FL |
WorldViewIMD | MultiDraw array of World-view transformation, inverted | Matrix[64] |
Item FL |
WorldViewITMD | MultiDraw array of World-view transformation, inverted and transposed | Matrix[64] |
Item FL |
WorldViewProjMD | MultiDraw array of World-view-projection transformation | Matrix[64] |
Item FL |
WorldViewProjTMD | MultiDraw array of World-view-projection transformation, transposed | Matrix[64] |
Item FL |
WorldViewProjIMD | MultiDraw array of World-view-projection transformation, inverted | Matrix[64] |
Item FL |
WorldViewProjITMD | MultiDraw array of World-view-projection transformation, inverted and transposed | Matrix[64] |
Item FL |
ViewDirection | World-space direction of the view (camera) | Float3 | FrameLocale |
ViewPosition | World-space position of the view (camera) | Float3 | FrameLocale |
LocalViewer | Denotes whether a local or non-local view direction is to be used | Bool | Frame |
IsOrthoGraphic | Denotes whether the projection matrix is orthographic | Bool | Frame |
ViewportPixelSize | Dimensions of the current viewport in pixels, width and height | Float2 | Frame |
ClippingPlanes | The coefficients of active clipping planes, one float4 per plane | Float4 Array | Clipping |
ClippingPlaneCount | The number of active clipping planes | Int | Clipping |
NearClipPlane | The camera’s near clipping plane | Float | Frame |
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. |
Float | Frame |
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. |
Int | Frame |
AlphaTestFunction | The 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 |
Int | Alpha Test |
AlphaTestReference | The alpha test reference value, in the range of (0.0, 1.0) | Float | Alpha Test |
RelativeViewportDimensions | Specifies relative viewport dimensions | Float2 | Frame |
MayaReceivesShadowOn | Denotes whether the object receives shadows | Bool | Item |
EnableXRayComp | Denotes whether xray component mode is enabled | Bool | Frame |
MayaViewportModes | Viewport modes
0 = Does not contain bounding box 1 = Contains bounding box |
Int | Frame |
FogEnabled | Denotes whether hardware fog is enabled | Bool | Frame |
FogMode | Hardware fog falloff mode
0 = Linear 1 = Exponential 2 = Exponential-squared |
Int | Frame |
FogStart | Hardware fog start z-distance in view space | Float | Frame |
FogEnd | Hardware fog end z-distance in view space | Float | Frame |
FogDensity | Hardware fog density | Float | Frame |
FogColor | Hardware fog color | Float4 | Frame |