Presentation >
Using CgFX-based materials

Mudbox supports the CgFX material specification on qualified graphics cards. CgFX is a shader specification that lets you create custom materials that use the power of your computer’s graphics card to produce many interesting materials and rendering effects in real time.

The main advantage of developing and using CgFX materials is that they are portable across many hardware and software applications (for example, between Maya and Mudbox) as well as other hardware platforms that support the CgFx specification (for example, games consoles).

For more information about the CgFX specification and how its structured as well as an in-depth tutorial, refer to the following resource: http://http.developer.nvidia.com/CgTutorial/cg_tutorial_appendix_c.html.

Notes on using CgFX files within Mudbox

- The CgFX file must contain at least one valid technique. A technique is a set of instructions that describe how to achieve a particular effect.
- If the CgFX material file contains annotations for the assigned variables they will be used to generate the properties items within the Properties window for the CgFX material when it is compiled.
- If the CgFX file contains float3 vCameraLocalPosition, float3 vLightLocalPosition and float4x4 mModelViewProject variables, Mudbox automatically assigns the appropriate values to them.
- Mudbox lets you specify textures in your CgFX files that you can paint on in Mudbox. Using the MetaSampler structure you can define a sampler containing a texture and select it as a paintable channel in Mudbox.
- Mudbox supports a subset of the SAS annotations and semantics. The following semantics are supported: World, WorldInverse, WorldTranspose, WorldInverseTranspose, WorldView, WorldViewInverse, WorldViewTranspose, WorldViewInverseTranspose, WorldViewProjection, WorldViewProjectionInverse, WorldViewProjectionTranspose, WorldViewProjectionInverseTranspose, View, ViewInverse, ViewTranspose, ViewProjection, ViewProjectionInverse, ViewProjectionTranspose, ViewProjectionInverseTranspose, Projection, ProjectionInverse, ProjectionTranspose, ProjectionInverseTranspose.
- The following annotations are supported: UIWidget, UIName, UIMin, UIMax.

NoteThe definitions for the above semantics and annotations can be found on the NVIDIA Web site.

Loading CgFX files into Mudbox

Mudbox automatically generates the materials user interface for a CgFX material in the CgFX Based Material properties window for any CgFX file that is located in the effects directory. See Notes on using CgFX files within Mudbox on this page.

- (Windows) <drive>:\My Documents\Mudbox\2011.5\data\Effects
- (Mac OS X) /Users/<username>/Library/Application Support/Autodesk/Mudbox 2011.5/Effects
- (Linux) /home/<username>/Mudbox/2011.5/data/Effects

NoteThe effects directory also contains some example CgFX materials. Files placed in this directory can be in .cgfx format (unencrypted) or in .bin format (encrypted).

CgFX materials are compiled each time you launch Mudbox. The more complicated the CgFX materials in the effects directory, the longer Mudbox takes to launch.

Related topics

Create and apply materials