MAYA Tools

MAYA Tools siteadmin Sun, 12/24/2006 - 18:12

Tools created for use with Maya

PDC Utils

PDC Utils siteadmin Fri, 12/29/2006 - 03:46

Maya Particle Disk Cache (PDC) Utils :

PDC Utils help in creating PDC files of external data. These file can then be used to drive particle system in Maya. It contains 2 programs one to create pdc files and another to read them. Both are command line only utility.

Writepdc program creates a pdc file using ascii input files
Readpdc program can read pdc files and display their content on the terminal window
Both programs are compatible with Maya 6 and 7 PDC format. No testing done for prior versions

Download: Source code and executible bundle (89 kb)Updated March 13th 2006

Tutorial: As time permits there would be a tutorial available showing how to put together things. Below are some clues to glue things together
Hints:

  1. Create a particle system in maya (Dynamics menuset)
  2. Save scene and set the project directory (Very Imporant)
  3. Solvers -> Create Particle Disk Cache
  4. Solvers -> Disable Memory Cache
  5. Save scene (Important)
  6. Browse to the project folder and then to particles/yourSceneName folder
  7. There should be *.#.pdc files in increments of 200 or 250 or something like that
  8. Now you just need to create your own pdc files using the writepdc tool above with same filename (They should match exactly) and replace/overwrite the one's that maya created.
  9. You should be able to see the changes in Maya instantaneously

Source Code Credits: Amit Chourasia (San Diego Supercomputer Center) and Peter J. Lu (Harward University) and generous help from John Moreland at SDSC.

Maya PDC format Simplified

The PDC file is used by Maya's particle disk caching and startup cache. It is a binary file that holds one frame's worth of data for a single particle object.

The unit for PDC files is always cm

Row no

Content

Byte Count

Description

Default

Extra Info

Example

Example Explanation

Row no

1
PDC file header
4
Characters indicating that this is a PDC file.

This will be the 4 characters "P", "D", "C", " ".
"P", "D", "C"," "
last one is space character (no commas or quotes)
"P", "D", "C", " "
Compulsory. No changes should be made here. 1
2
4
One Integer indicating the file format version number.
1
Avoid changing this untill you know for certain. No documentation about it.
1
Lets stick to default 2
3
4
One Integer holding bit information about whether the values stored in the file are BIG_ENDIAN or LITTLE_ENDIAN.
1

Maya only likes Big_Endian. So always use 1.

Make sure you swap the byte order for ints and doubles if on little endian machine. Chars are written without any swapping

1
Always use 1 for this 3
4
8
2 Integers holding extra bit information that various file format version might decide to use.
0, 0
Avoid changing these. No documentation about them

0

0

Lets stick to default 4
5
4
1 Integer indicating the number of particles represented in this file
"N"
N is the no of particle you need
5
Lets say our particle system contains 5 particles 5
6
4
1 Integer indicating the number of attributes that have values stored in this file.
" M "

M is the no of attributes you'll write in the file

(eg position, particleID, rgbpp,etc)

1
We'll just write 1 attribute for position on per particle basis. 6
 
Header size
28 Bytes
 
28 Bytes
   


There will be "M" records ie record for each attribute. Each record will consists of the following

7
Single Record

(There will be M records like this)
4
Integer indicating the length of the attribute's name =L

where L is the length of the name.
   
8
8 (no of characters in string "postion") 7
8
L
L Characters indicating the name of the attribute    
position
position 8
9
4
1 Integer indicating the type of data for the current attribute.

Choose the number from the following data type map below (Row no10)
 

Per Object Attributes are set for all particles so they are single numbers. (ie of type 0,2,4 ) See row 10

Per Particle attributes are set for each particle so naturally they are an array of the data. (ie of type 1,3,5 ) See row 10

5

As position is specified as 3 doubles ie a vector and we have to specify this on per particle basis our datatype becomes 5 (vector array).

See the info below on choosing data type.(Row No10)

9
10
P
Data Type

0 ---> Integer

1 ---> Integer Array

2 ---> Double

3 ---> Double Array

4 ---> Vector

5 ---> Vector Array
  0 ---> Integer (just one int=4 bytes - usually per object attribute)



1 ---> Integer Array
( N ints=N*4bytes - where N is the number of particles, usually per particle attribute)



2 ---> Double
(just one double=8bytes - usually per object attribute)



3 ---> Double Array

( N doubles=N*8bytes - where N is the number of particles, usually per particle attribute)



4 ---> Vector
(3 doubles=3*8bytes - usually per object attribute)



5 ---> Vector Array
( N vectors=N*3 doubles=N*3*8bytes - where N is the number of particles, usually per particle attribute)
1.0 1.0 1.0



2.0 2.0 2.0



3.0 3.0 3.0



4.0 4.0 4.0



5.0 5.0 5.0
x, y, z corrdinates for each particle. Maya stores floating points in double precision using 8 bytes. 10
 
Single Record Size

(The record size for each attribute will vary according to data type)

8+L+(N*B)

Bytes

N * B Bytes representing the data for this attribute, where

L is the no of characters in attribute name

N is the number of particles or 1 for non-array data

B is the number of bytes needed to represent the data type.
N*B= 5*(3*8)=120



8+L+N*B=8+8+120

=136 Bytes
x y z are 3 doubles occuring 5 times  


 
Total File Size

(Summation of header and M record size)

28+size of M record

Bytes

28 bytes of header M records of size (8 + L + B) (8 + L + B) is going to be different for each attribute
  28 + 1*(136)=148

Bytes
   
Reference: Maya Documentation

Caution: Since format contains data that is not word aligned there could be potential problems with different compilers. In a loose words what it means is when you read data from memory by providing a memory address or pointer you might get incorrect results. As compilers will hand you the data from a valid address rather than from where you asked from. Our implementation takes care of this.

Antibaker

Antibaker siteadmin Fri, 12/29/2006 - 03:41
AntiBaker:::::: Similar and more than Maya's Blendshape
Bake to external files :::::: AntiBaker
AntiBaker is created to ease and automate workflow for repetitive tasks. Specifically to reuse/share work. AntiBaker saves the configured info to external files which can be passed to different artists and re-used. AntiBaker saves transforms of selected objects to external files. This is analogous to keyframes but there is no keying involved. The external files are available as presets and morphs which user can utilize at will.

Example Use Scenarios:

  1. Lets say you have to hold state of few objects but dont want to keyframe them. Then use this state later on again and again. You can create presets/morphs in Antibaker and reuse them later.
  2. Creating emotions on joint based models. Lets say you have an emotion "anger". Now you wish to create variation of this without starting afresh for each variation. You can create presets/morphs in Antibaker and reuse them later.
  3. Copy the setup directory to other artist who are working on same model to use your presets/morphs and vice-versa.

Requirements: Windows 2000 + , Maya 5.x +

Features:

  • GUI based object transformation for simple control
  • (Presets) Save object transformations as external files
  • (Morphs) Save morphs between presets or object states as external files
  • Re-use presets and morphs with other users
  • Intuitive work-flow for repetitive tasks
  • Easy customization

Download: AntiBaker-0.92 ( 217 kb updated Feb 1st 2005)

Limitations:

  • Currently works for only translation, rotation and scale transforms
  • Uses short names for objects (all objects needs to have unique names)

Disclaimer: AntiBaker is provided 'As is'. Use it at your own risk. Copyright (C) 2005 Amit Chourasia


Usage and SetUp:
  1. Download and unzip
  2. Open Script Editor - In
    Maya go to Window > General Editors
    > Script Editor
  3. In Script Editor go to File > Source Script > Create_AntiBaker-0.92.mel (browse to folder where you unzipped AntiBaker source) (Important : Do not cut and paste code in script editor as there are dependencies which will get affected. Always source the script)
  4. Choose location where you'd like to save configuration (dont create directory - step 5 will create one later automatically)
  5. Type name of directory. (This will create a directory at above location ie step 4)
  6. Select objects to be in one ui group.(you can choose all but its better if its organised)
  7. Type name for this set of selected objects. Hit Enter
  8. Click "Add UI group" repeat step 6 and 7
  9. Click "Finish! and Run"

Running
AntiBaker at a later time - Open Script Editor File > Source Script > AntiBaker.mel (located at path chosen in step 4 )


Basic Utilization of AntiBaker
  1. Running AntiBaker (as configured above)- Open Script Editor go to File > Source Script > AntiBaker.mel (located at path chosen earlier )
  2. Mouse Roll over buttons to get tools tips about its function
  3. Click on buttons with object names to select them (Refer screen shot No. 8 -Your custom UI region shown in blue text below )
  4. Select object(s) - Use selection mode single or multiple (Refer screen shot No. 4)
  5. Tweak objects - Use top sliders to transform objects (Refer screen shot No. 3 - choose move/rotate/scale icons for changing modes of transform)
  6. Click Make Preset >Type Name>Load A button should appear under "User Presets" frame. This captures current state of objects. Later on you can click different preset button to change objects as they were when you created preset (Refer screen shot No. 5)
  7. Tweak objects - (step 4 & 5) and Make Presets: (step 6). Now click to see the magic of presets you created in User Presets frame.
  8. Morphing - Click 1)Base to mark initial state, tweak objects to your liking then click 2)Target >Type Name>Load. A control set is created under "User Morphs". This will create a morph from Base to Target state with linear interpolation. Use the slider to view in between states (Refer screen shot No. 6)
  9. Use Temp/Temp2 to set your ranges and increments and Recall Temp(2) for translation/rotation/scaling (Refer screen shot No. 2)
  10. Bind 2 Current Obj will associate the current ranges to the object. This will be recalled everytime that object is selected via UI. Recall Temp(2) could be used to override this setting (Refer screen shot No. 2)
  11. Utilize the key'ing and timeline for keyframing.

Screen shot and Interaction info

FAQ's:
  1. Why all my objects not present in the AntiBaker UI? During setup you did not choose them. Do the setup again.
  2. Some Object(s) state is not saved in preset why? You did not include the objects in your setup. Do the setup again. Antibaker needs to know before hand the objects it'll need to track and save their state.
  3. Why I cannot use slider when I select objects in Maya? You need to click "Direct Selection" button under slider controls when you select objects directly in Maya. There is no way of knowing when user selects objects in maya so you'd have to click the "Direct Selection" button everytime you wish to use sliders.
  4. Why do Morphs objects shrink to zero when I use the slider? You did not choose the base state for creating morph. Morph requires two states start and end, if start state is not chosen the default is zero (ie. all transform will start from zero)

License Agreement
AntiBaker is a freeware program and may be used and/or redistributed freely without modification, provided that: Redistributions must reproduce the exact original copyright notice (Copyright © 2005 Amit Chourasia. All rights reserved), this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Cam2Vista

Cam2Vista siteadmin Fri, 12/29/2006 - 03:42

Cam2Vista : MEL utility to read/import and write out camera files (camera matrices) to text files using Maya. The text file could then be used with Vista (command line volume renderer) and Mesh Viewer (interactive volume renderer) for custom camera movment and positioning.

Importing Camera files: The file should be in ascii format as follows. Each line contains only one camera martix of 16 floats after the keyword "CameraMatrix:" space or tab delimited. Each camera matrix is imported as a keyframe on a per frame basis
CameraMatrix: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0
CameraMatrix: 1.0 2.0 3.0 4.0 5.0 6.0 7.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0
.
.
. and so on

Requirements : Windows, Linux, Mac; Maya 5.0+ (untested for earlier versions)

Notes : Vista's volume size is always 1 unit cube. Thus the path should be created with this information in mind. Good idea is to create a default cube and test out camera path by scrubing in timeline or Step 7.

Limitations :

  • Jerky camera movement on preview of camera path.
  • Camera axis Y is always Upvector
  • Maya (PLE) does not allow write access to files so this script will show errors. The script prints out the info in the script editor when PLE option is checked.

Download : Cam2Vista-1.3 (36 kb) (right click and choose "Save Target As" or "Save Link As" ) Updated: Feb 22, 2008
Old Version : Cam2Vista-1.2(32 kb) (right click and choose "Save Target As" or "Save Link As" ) Updated: Jan 30, 2006

Running Cam2Vista :

  • Download and save Cam2Vista-1.3.mel
  • Open Script Editor - In Maya go to Window > General Editors > Script Editor
  • In Script Editor go to File > Source Script > Cam2Vista-1.3.mel (browse to folder where you saved Cam2Vista-1.3.mel)
  • Roll over buttons for tool tips

Usage :

  1. Choose Camera set up single camera=1cam; five camera setup for dome=5cam; seven camera setup for dome=7cam; eleven camera setup for dome=11cam (see Screenshot below - Step 1) Camera order for 5Cam dome rendering : Up, Front, Back, Left, Right
  2. Choose aim or look at direction (see Screenshot below - Step 2)
  3. Draw your own curve or create a test one (see Screenshot below - Step 3)NOTE: The maximum volume size in Vista is a unit size cube so make sure the path is appropriately scaled.
  4. Enter the number of frames you want to have on camera path (see Screenshot below - Step 4)
  5. Select the aim curve on which you want to move the camera's aim. (see Screenshot below - Step 5 optional ) Choose Camera looking towards MyPath or Norm2MyPath in Step 2
  6. Select the path curve on which you want to move the camera. Scale the size of the camera for if needed (see Screenshot below - Step 6)
  7. Save Camera File at desired location ".cam" would be appended to the typed filename (see Screenshot below - Step 7) or Save Reversed Camera File at desired location ".cam" would be appended to the typed filename (see Screenshot below - Step 7)
    NOTE:When the camera position and aim are coincident. You'll notice warnings on script editor. Make sure you have correct camera Aim option selected in Step 2
  8. Preview the camera path and camera aim (Make sure the camera aim is selected correctly in Step 2) . Also Accesed via "View" drop down menu.
  9. Import an existing camera file. (File>Import)
  10. Path curve smoothing options. Look under "Tools" drop down menu.

Cam2Vista Screenshot
(Roll over buttons for tool tips)

Poly2Vista

Poly2Vista siteadmin Fri, 12/29/2006 - 03:44

Poly2Vista : MEL utility created for writing out poly object info (vertex and normals) from Maya to a text file. The output file could be used with Vista (command line volume renderer) and Mesh Viewer (interactive volume renderer) for slicing of volumes in desirable manner.

Requirements : Windows, Linux, Mac; Maya 6.0+ (untested for earlier versions)

Notes : Poly objects in Maya should fit in bounding box for corresponding volume dimension.

Limitations : Polygons only (No NURBS, No Subdivision)

Download : Poly2Vista-0.3 (9 kb) (right click and choose "Save Target As" or "Save Link As" ) Updated: Aug 31th 2005

Running Poly2Vista :

  • Download and save Poly2Vista-0.2.mel
  • Open Script Editor - In Maya go to Window > General Editors > Script Editor
  • In Script Editor go to File > Source Script > Poly2Vista-0.2.mel (browse to folder where you saved Poly2Vista-0.1.mel)
  • Roll over buttons for tool tips

Usage :

  1. Select one or more objects (The object should be polygon type)
  2. Choose output setup (see Screenshot below - Step 2)
    • Write a point and a normal per face = vtx+norm (Default)
    • Write 3 points(vertices) per face = 3 vtx
    • Write all vertices and vertex normals = all(vtx+norm)
  3. Save Clip File at desired location ".clp" would be appended to the typed filename (see Screenshot below - Step 3)

Poly2Vista Screenshot
(Roll over buttons for tool tips)

PolyVtxCoords

PolyVtxCoords siteadmin Fri, 01/25/2008 - 10:18

PolyVtxCoords : Sometimes there is a need to see the vertex number and the actual coordinates of vertices . Doing so, using the Channel Editor or Attribute Editor could be cumbersome. The PolyVtxCoords mel utility addresses this issue by providing a simple user interface to display the vertex number and coordinate of the selected polygon vertices (See figure below). The scripts supports keyboard shortcuts to quickly see the coordinates of consecutive vertices by using arrow keys in addition to point and click selection. The vertex coordinate info is also shown in the script editor and the coordinates of the first selected vertex is displayed on the Maya's command feedback line.

Download : PolyVtxCoords.mel (7kb) (right click and choose "Save Target As" or "Save Link As" ) Updated: Feb 6th 2006

Limitations : Works only for polygon objects.

Notes : A scriptjob is created which auto reloads the vertex list and displays their coordinates in UI when selection changes. The scriptjob will persist if not killed through the interface untill maya is closed and started again.


PolyVtxCoords Screenshot
(Roll over buttons for tool tips)