CgFX

 
 
 

DEPRECATED. This shader is unsupported, but it may still get installed with Softimage to provide compatibility with older scenes that use it. It is recommended that you replace unsupported shaders in your scenes with equivalent shaders from the current Softimage shader library.

| Code | Images | CGFX_Parameters | Render Tree Usage | CgColor

Category: RealTime > Cg > CgFX

Shader Type: RealTime (RTShader)

Output: RealTime

Display Mode: OpenGL

The CgFX shader provides support for nVIDIA's CgFX file format, Microsoft's FX file format, and COLLADA's FX file format with the Cg profile.

The shader supports external file referencing as well as inlined code compilation for rapid prototyping.

Shaders should be installed to the Application\hsls\ directory of a workgroup.

You can also visit http://developer.nvidia.com/page/cg_main.html for more information about Cg shaders in general.

CgFX

General

Use External CgFX File

Enables .cgfx file referencing. Deselect the checkbox if you want to enter code directly in the text editor on the Code tab.

CgFX File

Specifies the path and file name of the .cgfx file. You can type in the file name or use a browser to locate the file.

The CgFX shader accepts a relative path to the effects file. The path should be relative to the root of the current project. This allows you to transfer your project to another path or machine without having to re-associate your referenced file to the new scene location.

Reload

Refreshes the effect display by reading and recompiling the .cgfx file. This is useful if you modify the .cgfx code.

The corresponding tweakable parameters property set is updated, keeping any parameter values that you tuned, provided they are still valid. Invalid parameter values are replaced with the default values.

Edit

Opens an editor where you can modify and save the currently displayed .cgfx file. After you save your .cgfx file, click Reload to apply the changes.

[IN. VariableName]

Specify the attribute to be passed to the vertex shader input register.

Edit

Opens the property editor for the associated attribute so that you can edit its parameters. For example, if you have set tangent data to be passed to the input register, pressing Edit will open the TangentOp2 operator property editor.

New

New Color At Vertices Color At Vertices

Creates a new Vertex_Color property.

New Weight Maps WeightMap

Creates a new Weight Map Cluster (WeightMapCls) property.

New Texture Projections

Defines the new texture projection to be created. You can choose from the following:

  • UV: Projects the texture along the U and V.

  • Planar XY: Projects the texture on X and Y coordinates only.

  • Planar XZ: Projects the texture on X and Z coordinates only.

  • Planar YZ: Projects the texture on Y and Z coordinates only.

  • Cylindrical: Projects the texture as though it is a cylinder wrapped around an object.

  • Spherical: Surrounds the object with a spherical mapping across the whole surface with some distortion.

  • Spatial: The texture is centered on the scene's origin.

  • Cubic: Applies the texture onto the object by first assigning the object's polygons to faces of a cube, and then projecting the texture onto each face by default. The layout of a cubic projection can be completely customized using the options in the Texture Support property editor.

  • Camera Projection: The texture is mapped relative to the camera's center. In this coordinate system, the camera is the center of the "world," with an up vector, looking toward the negative Z axis. The result resembles an image projected from a camera. The texture will move with the camera and will be affected by any scaling, rotation, and translation.

  • Unique Uvs (Polymesh): Applies a texture to polygon objects by assigning each polygon's UV coordinates to its own distinct piece of the texture so that no two polygons' coordinates overlap each other.

  • Advanced: Opens the Create Texture Support property page from which you can explicitly define a texture projection.

Code

Use external CgFX File

Disable this option if you do not have an external CgFX file that you want to reference and you want to inline CgFX code directly in the shader.

Include Path

Include path for the CgFX code.

CgFX code

Enter CgFX code in the editor.

CgFX files can contain Cg, assembly, and fixed-function shaders, along with the render states and environment information needed to render the effect.

The text editor supports text customization (font, color, size), syntax styling, folding (hiding blocks such as functions and subroutines), auto-completion and highlighting for keywords. You can also implement this text editor widget in your own plug-ins.

Compile

Compiles and executes the CgFX code.

Images

The CgFX shader automatically creates and connects realtime shader texture nodes for the corresponding textures specified in the .cgfx file.

CGFX_Parameters

The tweakable parameters UI is dynamically created when the effect is compiled. The UI is a custom property named CGFX_Parameters.

CgFX files often contain tweakable parameters UI that allow you to do the following:

  • Tune effect parameters.

  • Select from one or more techniques. A technique is intended to encapsulate the information needed to produce a visual effect — graphics state, shaders, and at least one rendering pass.

  • Pick input lights.

To modify the UI for the tweakable parameters, you have to edit the code in the .cgfx file.

When you reload the .cgfx file, the tweakable parameters property set is updated, keeping any parameter values that you tuned, provided they are still valid. Invalid parameter values are replaced with the default values.

Render Tree Usage

The CgFX shader is connected to the RealTime input of the material node. Other realtime shaders, such as texture shaders, can be connected to the CgFX shader's "previous" input.