This website is no longer updated, our new website is at vis.sdsc.edu. To request content please us send a note here.

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.

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

Old version: Source Code plus demo executible bundle : Updated Feb 5th 2006

Old version info on WritePDC_Demo program shows how the code could be used to create pdc files. At this time there is no executible available to create synthetic pdc files in a general manner. You'll need to edit the code to suit your needs. All methods are in place, the external data handling needs to be taken care by developer. A demo windows executible is included to show capability. See corresponding movie created by Peter (AVI 8 mb) by generating 200 (frames) pdc files from demo program.

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.