PDA

View Full Version : Writing a file for Point Cache


Mathieson
02-23-2009, 05:44 PM
I am hoping to be able to manually write files that can be interpreted by point cache modifiers. The mc and pc2 files seem to be encrypted though, so I am not sure what the formatting should look like or if this is even going to be possible.

Has anybody done anything like this before or have any suggestions?

Any input appreciated. Thanks guys.

Mathieson
02-23-2009, 06:13 PM
If anybody is curious why I want to manually write these files and not just use the methods included in the cacheOps struct, this is for use with the Nvidia PhysX plugin. I am looking to record the simulations. I figured it would be most practical to just write to files that could be interpreted by the Point Cache modifiers. No point in re-inventing the wheel.

JHN
02-23-2009, 09:20 PM
Your best bet is the xml filetype then, don't know what version of max you are on. But I think since max9 you can use xml as input for pointcache. Just cache a simple object out and interpret the file. PC files are not encrypted but they are binair. I don't know if then can be created with a filestream saved as binair, someone else may be able to answer that question.

-Johan

Mathieson
02-23-2009, 11:42 PM
Thanks for the reply Johan. I was looking into the XML file earlier and it seems like the XML file that is created only stores information about how the point cache should be interpreted back into Max. There is an associated MC file created along with the XML file which I assume holds all the data for the vertices.

Didn't realize the PC2 files were binair and not encrypted, but still leaves me in the same situation at the moment. I'm guessing the MC files are the same then. It would be great if a filestream could be saved out as binair, hopefully someone can provide a little more information on whether that is possible or not.

magicm
02-25-2009, 09:31 PM
Here's the pc2 file structure:

header
char : header (12) -- "POINTCACHE2" followed by a null char
int : version -- currently 1
int : number of points -- points per sample
float : start frame
float : samplerate
int : number of samples

positions
float : x
float : y
float : z
...
...

I wrote a pc2 exporter during my time at Frantic (in Python though) but obviously can't share it.. So hopefully this will get you on the way ;)

Cheers,
Martijn

Mathieson
02-26-2009, 02:22 PM
Awesome! Thanks Martijn. I'm going to play around with that later today.

CGTalk Moderation
02-26-2009, 02:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.