There is no translation available, please select a different language.
Contents
- Introduction
- Plug-in Installation
- Enabling the Plug-in in Maya
- Using the Plug-in in Maya
- The COLLADA "Maya" Profile
- Unsupported Maya Features
- Known Plug-in Issues
- Advanced Features
- Export Options
- COLLADA FX
- History
- License Information
Do more with COLLADA. Do it your way. Do it Faster. COLLADA Premium Services
Introduction
COLLADA
COLLADA is especially designed to facilitate 3D information interchange with other DCCs and to integrate easily within tool chains for game development. It is an open format, whose official web site is http://www.collada.org/. For more information on COLLADA, please check for following websites:
|
Khronos
|
|
|
Collada.org
|
|
|
COLLADA Schema
|
|
ColladaMaya Translator
This Maya COLLADA plug-in supports importing and exporting Maya scenes according to the COLLADA format specifications. The binaries, source code and all associated documents are released under the MIT License. Please take the time to read the documentation before using ColladaMaya. The official site for this plug-in is: http://www.feelingsoftware.com.
For an up-to-date feature list of ColladaMaya and other Feeling products related to COLLADA, consult this chart.
Plug-in Installation
Windows
Please download and use the automatic installer to install under Windows.
This plug-in is only tested on a regular basis on Maya 7.0, 8.0 and 8.5. Only binaries for Maya 6.5, 7.0, 8.0 and 8.5 are provided.
Mac OSX
Please download the Mac OSX package from this website. The binary provided is for Maya 8.5 only, and has been compiled in universal mode so that it can run on PowerPC and Intel machines equally. The package can be uncompressed anywhere. In a terminal window, run the provided shell script to install the necessary components. The script can be modified according to the user's preference or if copying errors occur due to non-standard installation paths of Maya 8.5.
Linux
Please download the Linux Fedora 6 package from this website. While the provided plug-in binary may work on other platforms, it is only tested on a standard Fedora Core 6 machine with Maya 8.0 and 8.5. The package can be uncompressed anywhere. In a terminal window, run the provided shell script for your version of Maya, to install the necessary components. The scripts can be modified if copying errors occur due to non-standard installation paths for Maya 8.0 or 8.5.
Enabling the Maya plug-in in Maya
To enable the plug-in, use the following instructions:
- Bring up the plug-in manager: Window->Settings/preferences/Plug-in manager.
- Verify that the folder you copied the .mll into is listed in the plug-in manager. If it isn't, it's likely that you have a Maya.env file that overrides the default plug-in path. Add the standard plug-in path to your Maya.env. Alternatively, click the browse button and manually browse to locate the .mll file.
- Make sure the COLLADA.mll file (or .so on Linux, or .bundle on Mac) is in the list, and that it is set to "loaded" and "auto load". If it refuses to load, check the script editor for error messages: Windows -> General editor -> Script editor.
- Save your preferences: File -> Save preferences.
Using the Maya plug-in
Maya supports various types of plug-ins. This plug-in is an importer/exporter, so you use it to load COLLADA files in Maya, and to save COLLADA files from a Maya scene. Here are two examples of how you can use the plug-in interactively:
To save a scene as a COLLADA file, bring up the File Export dialog: File -> Export all.
To load a COLLADA file into the scene, bring up the File Import dialog: File -> Import.
If you use file references in Maya, you must re-open the exported scene using File-> Open rather than File -> Import for the references to stay external.
Note that this plug-in can also be run in command-line mode, using the file MEL command described in the Advanced features section below. It can also be run in batch mode using a similar approach.
Plug-in Compilation
If you are a developer and you want to make changes to the plug-in, please follow the detailed instructions on how to set your build environment from the Maya online documentation: Developer Resources -> API guide -> Setting up your plug-in build environment.
Whether compiling for Windows, Linux or MacOSX, you will need to install the FCollada source code relative to the ColladaMaya source code such that from within the ColladaMaya project file: ../FCollada/FCollada.sln refers to the FCollada solution. Starting at 3.00, we are matching the version numbers of our COLLADA tools: to compile ColladaMaya 3.00, you will need FCollada 3.00.
Windows
Please follow the instructions below about environment variables, if you did not install Maya it its default path.
To compile Maya plug-ins on Windows, you need the Microsoft Visual Studio 2005 compiler. Open the following solution: C:\\ColladaMaya\\DaeTranslator.sln. Choose the desired configuration, for example, Maya6.5Debug. A post build step is provided such that, after a successful build, the .mll file is automatically copied into the Maya plug-in folder.
Environment Variables
ColladaMaya now supports environment variables if you did not install Maya in its default path. These environment variables are per-version of Maya: MAYA_PATH601, MAYA_PATH65, MAYA_PATH70 and MAYA_PATH80.
The first thing you MUST do, if you did not install Maya in its default path, is set the appropriate environment variable. To do this, on Windows XP:
- Open Control Panel->System->Advanced.
- Click on the "Environment Variables" button.
- In the "System Variable" section, click the "New" button
- In the "Variable Name" textbox, enter the name of Maya environment variable for your version. Example: "MAYA_PATH70".
- In the "Variable Value" textbox, enter your full Maya path in the textbox. Example: "C:\Program Files\Alias\Maya7.0".
- Click on the "Ok" button for the "New System Variable" dialog box.
- Click on the "Ok" button for the "Environment Variables" dialog box.
Your settings are now changed. If you have a command prompt or MSVC.NET opened, they will need to be restart for the changes to take effect. Here's a screenshot of my environment variables. I use the default paths for each version.
Linux
Please follow the instructions from Maya online documentation. Once you have your default Maya plug-in development environment set-up, and you have compiled FCollada in release, unicode and non-unicode modes, run scons -h to compile the binary for your version of Maya. Don't forget to copy the collada.so and scripts/*.mel in the right paths. Look at your maya.env file to find the default paths. You can use the provided shell scripts to copy everything to the proper folders. Modify the scripts if necessary.
Mac OSX
You can open the project in XCode 2.4: $COLLADAMAYA_SRC_DIR/COLLADA.XCodeProj and compile the plug-in for Maya 8.5. Use the provided shell scripts in a terminal window to copy over all the necessary files. Modify the scripts as needed if you want to change the installation paths.
The COLLADA "Maya" Profile
The COLLADA specification allows for custom parameter export through custom profiles. We have added a Maya-specific profile to the plug-in. The following is a list of the added technique nodes, their contents, and their domain.
|
Domain
|
Name
|
Type
|
Default
|
Description
|
<mesh> <source id="normals"> <technique>
|
<double_sided>
|
bool
|
true
|
Determines whether the faces of a mesh are meant to be rendered when viewed from both sides.
|
|
|
|
|
|
|
|
<scene> <extra> <technique>
|
<start_time>
|
float
|
-
|
Sets the animation start time in the range slider.
|
|
|
<end_time>
|
float
|
-
|
Sets the animation end time in the range slider.
|
|
|
<layer name=”X”>
|
layer
|
-
|
Contains a list of ids belonging to the named layer. The name of the layer is stored within the ‘name’ attribute.
|
|
|
|
|
|
|
|
<camera> <technique> <perspective/ortho>
|
<horizontal_aperture>
|
float
|
3.6
|
Sets the size of the camera horizontal view (in cm).
|
|
|
<vertical_aperture>
|
float
|
2.4
|
Sets the animation end time in the range slider (in cm).
|
|
|
<lens_squeeze>
|
float
|
1.0
|
The amount the camera's lens compresses the image horizontally.
|
|
|
|
|
|
|
|
<effect>
<profile_COMMON>
<[material_type]>
<[material_param]>
|
<blend_mode>
|
blend
|
NONE
|
Sets the texture blend mode, used only when multi-texturing. Possible values are listed here.
|
|
<texture> <extra> <technique>
|
<all place2dtexture params>
|
diverse
|
diverse
|
Includes all the parameters for the place2dTexture nodes, that are not included in the COMMON profile. The full listing is here.
|
|
|
|
|
|
|
|
<effect> <profile_COMMON>
<[material_type]>
<[material_param]>
<texture> <extra>
|
<type>
|
projection
|
PLANAR
|
Used to add a "projection" node in front of the file texture node. Possible values for the type of projection are listed here.
|
|
<technique> <projection>
|
<matrix>
|
float4x4
|
[identity]
|
Inverse projection matrix.
|
|
|
|
|
|
|
<animation> <source id="input"> <technique>
|
<pre_infinity>
|
infinity
|
CONSTANT
|
Sets the animation curve pre-infinity mode. Possible values are listed here.
|
|
|
<post_infinity>
|
infinity
|
CONSTANT
|
Sets the animation curve post-infinity mode. Possible values are listed here.
|
|
|
|
|
|
|
|
<animation> <sampler> <input>
|
IN_TANGENT_WEIGHT
OUT_TANGENT_WEIGHT
|
float
|
-
|
Identifies the array containing the inTangent or outTangent weights. Its presence indicates a weighted animation curve.
|
Texture Blend Mode
Following is a list of the valid values for the multi-texturing blend mode: NONE, OVER, IN, OUT, ADD, SUBTRACT, MULTIPLY, DIFFERENCE, LIGHTEN, DARKEN, SATURATE, DESATURATE and ILLUMINATE. The default blend mode is NONE.
You can get more information on each in the Maya documentation: "All About: layeredTexture node".
Animation Curve
Infinity Mode
Following is a list of the valid values for the animation curve infinity mode: CONSTANT, LINEAR, CYCLE, CYCLE_RELATIVE and OSCILLATE. The plug-in does not enforce a default infinity mode. Maya uses CONSTANT has its default infinity mode when creating a animation curve.
You can get more information on animation curve infinity modes in the Maya documentation: "All About: Graph Editor menu bar", under the "Pre and Post Infinity" sub-heading. Note that CYCLE_RELATIVE is also called "Cycle with offset".
Bezier Curve and Weighted Bezier Curve
COLLADA exports the bezier curves as follows: first, assume the inner control points are at equi-distant time values. Then, the inTangent and outTangent values represent offsets relative to the current and next output values, for the two inner control points: K2 = K1 + inTangent, K3 = K4 - outTangent.
The weights are supported only in the Maya-specific profile. So if you intend on using the weights, you will need to first convert the tangents back to angles: angle = atan(tangent / (time interval / 3)). Then, you get the relative (time,value) or (T, K) pairs for the inner control points as follows: T = ±weight * cos(angle), K = weight * sin(angle).
Texture Parameters
2D Texture Placement
Almost all of the parameters for the 2d texture placement nodes are exported in the COLLADA file. The wrapU, wrapV, mirrorU, mirrorV, coverageU, coverageV, translateFrameU, translateFrameV, rotateFrame, stagger, fast, repeatU, repeatV, offsetU, offsetV, rotateUV, noiseU, noiseV parameters are included in the Maya-specific profile. WrapU, wrapV, mirrorU, mirrorV, stagger, fast are boolean parameters, the rest are single-float parameters.
For more information about these parameters, please read the Maya documentation: "All About: place2dTexture node".
Projection 3D texture node
You can now export/import 3d projection texture nodes. A <program url="PROJECTION> node will be added to the Maya-specific technique of the texture description in COLLADA. The parameters included are listed above. The projection 3D texture node does include a 2D texture placement, with the parameters described here.
This is a list of the projection types accepted: NONE, PLANAR, SPHERICAL, CYLINDRICAL, BALL, CUBIC, TRIPLANAR, CONCENTRIC and PERSPECTIVE.
Per-Vertex Blind Data
The plug-in now supports the import/export of per-vertex blind data. Unfortunately, we are ahead of the COLLADA specifications once again. A new semantic was therefore added, unofficially, to the mesh <vertices><input> node: "EXTRA", which points towards the source of per-vertex blind data.
Unsupported features
Here is a short and incomplete list of features which are not currently supported:
- Modeling
- SubDs and NURBS are not exported.
- Tangent space export is not currently implemented.
- Geometry
- Animated normals are not supported by Maya. They will never be imported/export by the ColladaMaya plug-in.
- Only per-vertex blind data is supported.
- Lighting
- Area lights are not exported.
- Shading
- Only Lambert and Phong shaders and the constant Surface shader are currently supported. Most other shading nodes are unsupported: shading switches, procedural texture nodes. A possible work-around is to manually bake textures prior to export.
- Animation
- Joint clusters are exported and imported as skin cluster(s). Other types are ignored.
- Dynamics, including rigid and soft bodies, particles and fluids, are not supported.
- Expressions and constraints are exported using animation sampling. They will be keyed in on re-import.
- Cameras
- Camera position animations are supported only with the decomposed transforms.
Advanced Features
Maya transform export
By default, the bake transforms option is disabled. The plug-in therefore export a series of primitive decomposed COLLADA transformations. Here are two examples, of exported joints and transform respectively, that show the different possibilities:
<node id="joint3" name="joint3" type="JOINT">
<translate>2.000000 0.000000 0.000000</translate>
<rotate>0 0 1 -90.000000</rotate> <!-- joint orient -->
<rotate>0 1 0 0.000000</rotate>
<rotate>1 0 0 0.000000</rotate>
<rotate>0 0 1 0.000000</rotate> <!-- standard rotation -->
<rotate>0 1 0 0.000000</rotate>
<rotate>1 0 0 0.000000</rotate>
<rotate>0 0 1 0.000000</rotate> <!-- rotation axis -->
<rotate>0 1 0 0.000000</rotate>
<rotate>1 0 0 0.000000</rotate>
<scale>1.000000 1.000000 1.000000</scale>
</node>
<node id="pCube1" name="pCube1">
<translate sid="translate">0.000000 2.127322 0.000000</translate>
<translate sid="rotatePivot">0.000000 -2.015638 0.000000</translate>
<rotate sid="rotateZ">0 0 1 0.000000</rotate>
<rotate sid="rotateY">0 1 0 0.000000</rotate>
<rotate sid="rotateX">1 0 0 0.000000</rotate>
<rotate sid="rotateAxisZ">0 0 1 0.000000</rotate>
<rotate sid="rotateAxisY">0 1 0 0.000000</rotate>
<rotate sid="rotateAxisX">1 0 0 0.000000</rotate>
<translate sid="rotatePivotInverse">0.000000 2.015638 0.000000</translate>
<translate sid="scalePivot">0.000000 -2.015638 0.000000</translate>
<scale sid="scale">1.000000 1.000000 1.000000</scale>
<skew sid="shearXY">45.0 0 1 0 1 0 0</skew>
<skew sid="shearXZ">35.0 0 0 1 1 0 0</skew>
<skew sid="shearYZ">30.0 0 0 1 0 1 0</skew>
<translate sid="scalePivotInverse">0.000000 2.015638 0.000000</translate>
<instance url="#pCubeShape1-lib"/>
</node>
To obtain the right transform matrix, concatenate all of these operations in their exact order. For more information on the transform equation used by Maya, refer to the Maya documentation, for the MFnTransform and MFnIkJoint classes. Note that the following "sid" are currently supported: jointOrient[XYZ], translate, rotate[XYZ], rotateAxis[XYZ], scale, rotatePivot, rotatePivotInverse, rotatePivotTranslation, scalePivot, scalePivotInverse, scalePivotTranslation, shear[XY/XZ/YZ]. The "sid" attribute should not be used to identify where to put the transform within the stack, as you will not be able to import files from other DCC tools and we do not guarantee that the "sid" names will keep their current values in future versions.
Nearly all transformations can be animated; the only exceptions being the pivots: their associated translation and inverses, and skews that are currently assumed constant. For more information, refer to the source code in DaeTransform::exportDecomposedTransform().
Export Options
This is a list of the available export options in the UI and through the command line. The default value is given in parentheses.
- cameraXFov (false)
- cameraYFov (true)
- bakeTransforms (false)
- bakeLighting (false)
- exportCameraAsLookat (true)
- exportTriangles (false)
- isSampling (false)
- curveConstrainSampling(false)
- samplingFunction ("")
- enablePhysics (false)
- exportWeaklyTypedArrays (false)
- exportPolygonMeshes (true)
- exportLights (true)
- exportCameras (true)
- exportJointsAndSkin (true)
- exportAnimations (true)
- exportControllerTargets (true)
- exportInvisibleNodes (false)
- exportBoundingBoxes (true)
- exportNormals (true)
- exportTexCoords (true)
- exportVertexColors (true)
- exportTangents (false)
Baked (sampled) transform matrices
The plug-in has an option to exporting transforms using baked matrices, sampled every frame.
Import/export of static baked transform is supported. Export of animated baked transforms is supported, but import isn't yet. The code in DaeAnimationLibrary::importAnimation() would need to be extended to do so. Note that information loss occurs when baking these transforms then re-importing, for example, joint angles may not be preserved even if the final transform looks identical.
Baked lighting
This option can be used to force the export of per-vertex color, with the lighting information baked in. The "convertLightmap" MEL function is used, so that your mesh will be changed as a result of the export. After the export, you must manually undo to remove the effect of the light baking.
Export camera as look-at
The COLLADA spec allows two ways to specify the transform associated with a perspective camera. One is to use the <lookat> element. The other is to use regular transform elements (e.g. translate, rotate, etc.) The advantage of the former is that it's very easy to parse and it directly specifies the object which is the center of the attention. This is useful for simple viewer applications, which want to allow the user to pivot around the some important part of the scene. The disadvantage of this technique is that it cannot be animated. Therefore if you want animations, disable this option, which will force the exporter to use regular Maya transforms. NOTE: the bake transforms option above takes priority. If it is enabled, the camera transforms are exported as baked matrices regardless of the value of the "exportCameraAsLookat" option.
Filtering export
Sometimes it is desirable to disable the output of some elements of the scene. For example, you may want to export only the geometry (along with materials and texture) and joints/skin. In this case, you may want to use these options to disable the export of lights and cameras.
Export invisible nodes will include the default cameras: "persp", "top", "side" and "front". The reference transform nodes that are marked invisible will not be exported, regardless of the value of the "exportInvisibleNodes" export option.
You can select which per-vertex attributes to export, as unwanted per-vertex attributes can quickly bloat your COLLADA files. These are the per-vertex export options: "exportNormals", "exportTexCoords", "exportVertexColors" and "exportTangents". The "exportTangents" option includes both tangents and bi-normals.
NOTE: Some combinations of these options may not make sense... in a production setting, it may be preferable to do an Export Selection instead.
Weakly-typed array export option
COLLADA 1.3 adopted strongly-typed arrays, to support an API that is code-generated automatically from the COLLADA schema. So basically, a pre-1.3, weakly-typed array, looks like this:
<array type="float" id="blabla1" count="3"> 1.0 2.0 3.0 </array>
while a strongly-typed array looks like this:
<float_array id="blabla1" count="3"> 1.0 2.0 3.0 </float_array>
Even though weakly-typed arrays have been deprecated in COLLADA 1.3, the plug-in can import and export both types of arrays. By default, the export uses strongly-typed arrays. To enable weakly-typed array export (e.g. for backward-compatibility purposes), use the exportWeaklyTypedArrays.
Variable Animation Sampling
You can force the plug-in to sample all animations at a user-defined rate. This is useful when exporting non-keyed animations, for instance, when using expressions that include the time variable. When re-imported, keys will be placed at each of the sampled times/attribute pairs. You need to set the sampling function in order to get a variable sampling rate.
This is the sampling function syntax: Start with a string value that corresponds to a list of three floating-point values. The three numbers identify the sampling start time, end time and the sampling period. A list of such numbers allows the user to choose different sampling rates at different times in the animation. Additionally, the user could enter just one number representing a constant sampling period or an empty string to disable sampling.
Unordered time intervals or time intervals smaller than the sampling period are considered invalid inputs. Subsequent time intervals with discontinuities are treated independently.
To deal with overlapping time intervals, the overlapping sample period should be the linear interpolation of the new and old sample periods, with respect to the time left in the old period: Overlap Period = Time left in first interval + (1 - Time left in first interval / First interval sample period) * Second interval sample period.
Some examples:
- “0.03333” implies a constant sampling rate of 30 fps.
- “0, 100, 5” requests samples: from the time 0, in seconds, to the time 100, in seconds, with one sample every 5 seconds, for a total of 21 samples.
- “100, 0, 5” is an invalid input.
- “0, 100, 5, 100, 200, 10, 200, 300, 5” requests one samples every 5 seconds in the interval [0s, 100s[, one sample every 10 seconds in [100s, 200s[, and one sample every 5 seconds in [200s, 300s].
- “0, 100, 5, 200, 300, 5, 100, 200, 10” is an invalid input.
- “0, 18, 8” requests 3 samples, at times 0s, 8s and 16s.
- “0, 18, 8, 20, 40, 12” requests 5 samples at time 0s, 8s, 16s, 20s, 32s. This is because of the discontinuity.
- “0, 18, 8, 18, 40, 12”, requests 5 samples, at time 0s, 8s, 16s, 27s and 37s. 25% of the overlapping sampling period is done at a rate of 1 / 8s, between 16s and 18s. 75% of the overlapping sampling period is done at a rate of 1 / 12s after time 18s.
- “0, 18, 8, 18, 20, 10, 20, 24, 1” is an invalid input.
Curve-constrain sampling is a new sampling method where only the sampled times that are within the sampled curve are used. If no sampled curve is found, for example: when exported an IK handle, the full sampling is done. You cannot constrain the sampling of transforms exported with the 'bake transforms' export option, otherwise it will work nicely with any variable animation sampling function.
Import/export through command line
To run the plug-in in a batch mode using MEL, use the file command with the following arguments:
file -op "exportWeaklyTypedArrays=false;bakeTransforms" -typ "COLLADA" -pr -ea "C:/path/filename.dae";
Options can be combined, by separating them with semicolons, as in the above example. As of now, all options are disabled by default. If an argument of false or 0 is provided, the option is kept disabled. Otherwise, it is enabled. So in the above example, the export will produce a file called 'C:/path/filename.dae'. The weakly-typed array option will be kept disabled. The bake transform option will be enabled. Other options are kept at default.
External References Export
Two export options allow you to tweak how external references are hanlded by the exporter: "exportXRefs" defaults to true and you can unset it to filter out the external references. The "dereferenceXRefs" export option specifies the exporter's behavior when encountering an external reference. It defaults to false and if set, it will not export a COLLADA external reference, but will simply step through the Maya external references as if they were a part of the exported scene.
COLLADA FX
Overview
ColladaMaya also has a COLLADA FX capability, which allows artists and developers to create, modify, assign and visualize complex Cg shaders. It is designed to display advanced hardware rendering effects and to give immediate feedback while a shader is developed. ColladaMaya's hardware shader is fully integrated with Maya's Hypershade node-based shader editor, and creates dynamic GUIs for interactive parameter controls. Using the plug-in, artists can import a COLLADA document, exported from Maya or nVidia's FXComposer, and manipulate it in Maya, then export in the COLLADA 1.4 format. The plug-in also supports references to legacy CgFX shader files. Certain features aren't supported in the plug-in for Maya 8.5, due to internal differences in Maya.
Dependencies
Make sure to install Cg 1.5 for the COLLADA FX functionality of ColladaMaya to work properly.
ColladaFX Shading Nodes
In the context of this maya plug-in, a ColladaFX Shader is a hardware shader that consists of a vertex and a fragment shader program. Shader parameters are retrieved from the programs and added to the node as dynamic attributes. Artists can tweak the parameters using the Attribute Editor and view the rendering effects in Maya's OpenGL viewports. Another hardware shader is available through ColladaMaya: ColladaFX Passes nodes. ColladaFX Shader nodes are added to a single ColladaFX Passes node to create more complex shaders.
Figure 1. A ColladaFX Shader with environment reflection effect, implemented using Cg vertex and fragment shaders. The shader is part of a single-pass ColladaFX Passes node. Click to view a larger version of the image.
ColladaFX Passes
Figure 2. The ColladaFX Passes editor UI.
The Passes editor exposes three functionnalities. You can use the Load CgFX button to populate the Passes node with the content of a CgFX shader, including all its techniques and passes. Using this option will remove all previously added techniques or passes. You can also add or remove techniques using the Add and Remove buttons at the right of the "Techniques" label. The selected technique in this editor is the one displayed in Maya's OpenGL viewports. When a technique is selected, you can then add or remove passes to it by pressing on the Add or Remove buttons at the right of the "Passes" label. These buttons affect the last pass in the list. Once a pass is added to a technique, you have to bind it to a ColladaFX Shader node to define it.
ColladaFX Shader
Figure 3. Overview of the ColladaFX Shader node editor UI.
The ColladaFX Shader node editor UI has a lot of functionalities. This is where you assign the Cg or CgFX source(s) for the shader, where you edit or animate its uniform and varying parameters, and where you add or remove the render states affecting the pass rendering.
Figure 4. The shading tab.
Open the Shading tab in order to specify the source for your Cg shader(s). Click on the folder button to open a "Open" dialog. Select your Cg shader and click on "Open". The default entry point for both Vertex and Fragment programs is "main". You can change this by modifying the "Entry point" fields and then press the "Reload" button. Reloading a shader will not erase existing parameters and their animations, unless the parameter itself is not in the shader anymore. You can edit the source of your shader by pressing the "Edit" button. Again, pressing the "Reload" button will validate your changes. This tab can also be used to load a CgFX effect file. Simply press any of the two folder buttons, and choose to open a ".cgfx" file (the extension name must match). You will be asked to select from which technique and which pass of the effect you want to load the programs. Then this will affect the CgFX source file to both Vertex and Fragment program fields, and set the entry points to "VertexProgram" and "FragmentProgram" respectively. It will also match the selected pass' render states in the Render States tab.
Figure 5. The Material Parameters tab.
The Material Parameters tab is subdivided in two inner tabs: Uniform parameters and Varying parameters.
The Uniform tab's content is created dynamically and reflects the parameters found in the shaders loaded in the Shading tab. Each uniform parameter is held internally in a Maya attribute. This mean that they can be animated like any other Maya attribute. A description of the supported Cg parameters and their associated UI can be found in the next subsection of this document. When loading shaders from a CgFX effect, annotations are read and affect certain parameter properties. UIName will set the parameter name in the UI, UIMin and UIMax will affect the range of a single float parameter, and ResourceName will, for a texture parameter, automatically assign the specified texture to the sampler parameter. You can also change the range of a parameter by pressing the "<>" button. Vector parameters (float|half|3|4) are by default represented by a color parameter. You can switch the UI of these parameters by pressing the "+" button. Available UI types are Color, Navigation or Vector.
Figure 6. Editing the range of a parameter.
Figure 7. Editing the UI type of a parameter from Color to Navigation.
Varying parameters are set on a per-vertex basis. Specify a colorSet or uvSet name in a field to feed it to the shader. By default, texture coordinates ("map1") are assigned to the TEXCOORD0 channel and texture tangent data ("tangent" and "binormal") are assigned to TEXCOORD1 and TEXCOORS2 respectively.
Parameter Types
Below are the parameter types currently supported.
in Cg
|
in Maya |
bool
|
bool
|
half
|
float
|
half2
|
float2
|
half3
|
color
|
half4
|
color with alpha set to 1.0 |
half4x4
|
matrix
|
| float |
float |
float2
|
float2 |
float3
|
color |
| float4 |
color with alpha set to 1.0 |
| float4x4 |
matrix |
| sampler2D |
color connected to a file pointing to a .dds texture |
| samplerCUBE |
color connected to a file pointing to a .dds cubemap texture |
Color or vector parameters are exposed as color slider controls in the Attribute Editor, and samplers are exposed as navigation bars. If any transform node is drag-and-dropped on the color slider, its translate will be connected to the color. A file texture node can also be connected to a sampler through drag-and-drop.
Binding Semantics
ColladaFX shaders support binding special parameters through so-called binding semantics. These were selected for backward compatibility with FXComposer and the CgFX runtime implementation. The following semantics are currently recognized.
| POSITION |
vertex position |
| NORMAL |
vertex normal vector |
| COLOR0 |
per-vertex color |
| TEXCOORD0-7 |
uv coordinate or per-vertex color |
| VIEWPROJ, WORLDVIEWPROJECTION |
model view projection matrix |
| WORLDVIEWPROJECTIONINVERSE |
model view projection matrix inverse |
| WORLDVIEWPROJECTIONINVERSETRANSPOSE |
model view projection matrix inverse transpose |
| WORLDVIEW |
model view matrix |
| WORLDVIEWI, WORLDVIEWINVERSE |
model view matrix inverse |
| WORLDVIEWIT, WORLDVIEWINVERSETRANSPOSE |
model view matrix inverse transpose |
| OBJECT |
object space |
| OBJECTI, OBJECTINVERSE |
object space inverse |
| OBJECTIT, OBJECTINVERSETRANSPOSE |
object space inverse transpose |
| WORLD |
world space |
| WORLDI, WORLDINVERSE |
world space inverse |
| WORLDIT, WORLDINVERSETRANSPOSE |
world space inverse transpose |
| VIEW |
view matrix |
| VIEWI, VIEWINVERSE |
view matrix inverse |
| VIEWIT, VIEWINVERSETRANSPOSE |
view matrix inverse transpose |
| PROJECTION |
projection matrix |
| PROJECTIONI, PROJECTIONINVERSE |
projection matrix inverse |
| PROJECTIONIT, PROJECTIONINVERSETRANSPOSE |
projection matrix inverse transpose |
Render States
Figure 8. Render States tab.
In this tab, you can enable or disable any OpenGL state while your shader is rendering. The first list box contains all the states driven by value, wether it is a simple boolean flag, a blend mode or a RGBA color. The second list box contains all the indexed states - these can be added multiple times to a shader, as long as the index remains unique. This way you can, for example, specify light attributes on a per-light basis. To add or remove a render state, simply select it in the list box and press on the appropriate Add or Remove button.
Collada Translator
The Collada translator for Maya makes it possible to export and import ColladaFX shaders and passes in the COLLADA document (.dae) format. A typical ColladaFX type effect is defined according to the latest schema (1.4.1) and looks like this:
<effect>
|
|
|
|
|
|
 |
<profile_CG> |
|
|
|
|
| |
 |
<include>
|
|
|
|
| |
 |
<newparam>
|
|
|
|
| |
|
 |
<semantic>
|
|
|
| |
|
 |
<type>
|
|
|
| |
 |
<technique>
|
|
|
|
| |
|
 |
<pass>
|
|
|
| |
|
|
 |
<shader>
|
|
| |
|
|
|
 |
<name>
|
| |
|
|
|
 |
<bind>
|
If multiple <pass> elements are detected under the <technique> element, the translator will create a colladaFX shader for each pass and collect them in a colladaFX passes node.
<bind_material>
|
|
|
|
|
<param>
|
|
|
|
<technique_common>
|
|
|
| |
|
<instance_material>
|
|
| |
|
 |
<bind semantic="LIGHTPOS1" target="light1.translate">
|
When binding material to geometry instance, object connections and animation targets will be exported as above.
More examples
Figure 9. This layer example demonstrates the use of colladafxPasses. Click to view a larger version of the image (using an older version of the plugin).
Figure 10. Fractal noise generated from random texture. Click to view a larger version of the image (using an older version of the plugin).
Figure 11. Velvet lighting model in Cg. Click to view a larger version of the image (using an older version of the plugin).
History
Feeling Software is the official maintainer for this plug-in. We were originally contracted by Alias to improve and extend it. To learn more about contract work, contact claforte@feelingsoftware.com or check our web site at www.feelingsoftware.com.
An early version of this plug-in was originally developed by Vangelis Kokkevis (SCEA), Gordon Bradley (Alias) and Gabor Nagy (SCEA). We would like to thank all the contributors who graciously sent patches and bug reports: Mark Barnes, Ray Donnelly, Richard Forster, Greggman, Jason Hoerner, Nathan Martz, Cedric Perthuis, Richard Stenson, Kevin Thacker, Lilli Thompson, Rob Withey, and others.
License Information
ColladaMaya
FCollada
LibXML2Except where otherwise noted in the source code (e.g. the files hash.c, list.c and the trio files, which are covered by a similar licence but with different Copyright notices) all the files are: Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: the above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.
|