There is a difference in behavior between the Default renderer, the Hardware renderer and the Viewport 2.0 renderer in terms of CgFX state assignments. The default value of the DepthMask state is different. The default is the value used when it is left unspecified by the CgFX shader and is as follows for the different renderers:
Therefore, a CgFX shader might appear to work correctly when using the Hardware renderer and yet give an incorrect result with the Default and Viewport 2.0 renderer. In this case, adding a DepthMask = false state assignment to some of the shader passes may workaround the issue.
When using Viewport 2.0, if you enable the Consolidate world option in the Viewport 2.0 options, CgFx plug-ins that depend on local vertex position may not behave as expected.
You can enable or disable Consolidate world by selecting Renderer > Viewport 2.0 > to open the Hardware Renderer 2.0 Settings window; or, open the Render Settings window and click on the Maya Hardware 2.0 tab. For more information, see Viewport 2.0 options.