Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: fcache specification

  1. #1

    fcache specification

    hey,

    does anybody know how i could find information on how the .fcache files are structured? i did have a look in the SDK, but i couldn't find the right information. currently i'm trying to reverse engineer it, looking at the hex values. but it's tedious. it's similar to all the other cache files like .mdd or .pfx, but a solid information about it would be useful. what i'm looking for is a cache format with particle rotation, because i would like to write an exporter for houdini and 3dsmax to get particles into lightwave - it seems pfx doesn't support that - position is not enough!

    for your information: fcache ist the cache file of the new flocking system in lw11

    thanks,
    Philipp

  2. #2
    I think I can remember that in the latest pfx version ( which is of course undocumented ) there is an extension chunk for rotation. Had the same project 1 year ago, but switched completely to houdini for particle fx, which made the import export obsolete ..
    But thumbs up for your venture .. hope we will get some information on the caches .. me I would be very interested in the light-cache format .. a houdini Import export for those pointclouds would be marvelous ..
    martin dulovits
    technical director

    www.woogieworks.com

  3. #3
    offtopic:

    dulo ... haha, wie lustig. heute abend klettern?

  4. #4
    Quote Originally Posted by maxim capra View Post
    offtopic:

    dulo ... haha, wie lustig. heute abend klettern?
    Ritterfelsen hab ich gehoert
    martin dulovits
    technical director

    www.woogieworks.com

  5. #5
    ok ... i think i figured it out by myself with a hex editor. i hope that's right:

    everything in motorola big endian byte order, as usual

    -- PSEUDO CODE
    WriteLong numPoints

    for i=1 to numPoints (

    --BLOCK1 - the emitter
    --i don't know yet what's in here, it's 9 float or long values.
    --it changes, when i change the transform matrix of the emitter for example.
    --but it doesn't matter, if you just want to import self made fcache files
    --you could just fill it with zeros - it works! BLOCK2 is the important one....
    WriteLong startFrame
    WriteLong endFrame
    for i=startFrame to endFrame (
    for j=1 to 9 (WriteLong 0)
    )

    --BLOCK2 - the points (the position and rotation at every Frame):
    WriteLong startFrame
    WriteLong endFrame
    for i=startFrame to endFrame (
    WriteFloat PositionX
    WriteFloat PositionY
    WriteFloat PositionZ
    )
    WriteLong startFrame
    WriteLong endFrame
    for i=startFrame to endFrame (
    WriteFloat RotationX
    WriteFloat RotationY
    WriteFloat RotationZ
    )
    )


    maybe this does help someone..

    still looking for .PFX files, especially the undocumented rotation chunk? someone?

    Philipp
    Last edited by maxim capra; 07-05-2012 at 09:03 AM.

  6. #6
    actually i still don't know how the rotation values work in fcache files. can someone point me in the right direction? getting lost here. it's 3 float values for every frame for every point, but it's not euler angles (not degrees, not radians), obviously no quaternions, no matrix. then i thought it might be something like normal directions, but this also doesn't make sense. i could send simplified cache files if someone is interested where i nailed it down just to the rotation part. the values don't make sense to me.

  7. #7
    here's the simplified fcache file. i zeroed everything out, BLOCK1 and the position part. if you put this on a new flock generator you should get 1 particle, timefame from 0 to 9, staying in position(0,0,0), just rotating around. look at the rotation values in the file. how do they correlate to this behaviour? i don't get it....
    Attached Files Attached Files
    Last edited by maxim capra; 07-06-2012 at 03:10 AM.

  8. #8
    For anyone interested I have an old definition of the pfx format .. its strangely mangled by some automated translation, but still usable ..
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	PFX-(ParticleFX)-Dateiformat---Disutomu-Inc-1.jpg 
Views:	118 
Size:	492.6 KB 
ID:	105413  
    martin dulovits
    technical director

    www.woogieworks.com

  9. #9
    NewTek Developer jameswillmott's Avatar
    Join Date
    Dec 2004
    Location
    Gold Coast
    Posts
    3,171
    Hey everyone, I've been directed to this thread and will post both the fcache and pfx format specs here later today for you all and make sure they get added to the SDK docs.
    LightWave3D training, assets, news and discussion at www.liberty3d.com
    My opinions are my own and do not represent the opinions of any other entity, Liberty3D is not officially endorsed by NewTek.

  10. #10
    Quote Originally Posted by jameswillmott View Post
    Hey everyone, I've been directed to this thread and will post both the fcache and pfx format specs here later today for you all and make sure they get added to the SDK docs.
    thx man ..

    Maybe you could also add the GI Cache specs ??? Please !!!
    martin dulovits
    technical director

    www.woogieworks.com

  11. #11
    Quote Originally Posted by jameswillmott View Post
    Hey everyone, I've been directed to this thread and will post both the fcache and pfx format specs here later today for you all and make sure they get added to the SDK docs.
    thank you!

  12. #12
    NewTek Developer jameswillmott's Avatar
    Join Date
    Dec 2004
    Location
    Gold Coast
    Posts
    3,171
    Here goes: ---


    PFX format:

    PFX is a binary format with the following structure.

    int32: 4 byte integer.
    float: 4 byte floating point value.



    struct PFX{

    int32 version;
    //Version number for the file format, if the version is >=5 , the PFX file has stored rotations.

    int32 number of particles;
    //number of total particles stored, regardless of when they are alive or dead.

    int32 number of frames;
    //This is the sum of the lifetime of each particle plus 1. For example, if you have ten particles from frame 0 to 120, the number of frames becomes 10 * ( ( 120-0 ) +1 ) or 1210.

    struct {
    int32 start_f;
    //The frame that this particle becomes alive.

    int32 end_f;
    //The frame that this particle dies.

    int32 life;
    //The lifetime of the particle in frames.

    float mass;
    //Mass of the particle

    float resistance;
    //Wind resistance of the particle

    float size;
    //Size of the particle.

    } particle_data [ number of particles ];

    //if the file version >= 5
    struct {
    float heading;
    float pitch;
    float bank;
    //The heading, pitch and bank angles ( that match LightWave's rotations )

    float dummy[3];
    //Unused data.
    } rotation_data [ number of particles ];
    };



    FCache info:
    FCache is a binary format with the following structure.

    int32: 4 byte integer.
    float: 4 byte floating point value.
    struct Vector3 { float x,y,z; };
    struct Matrix3 { float data[9]; };
    typedef double LWTime;

    struct FCache {

    int32 version;
    int32 agent_count;

    struct Agent {
    struct Cache{
    int32 version;
    LWTime start, end; //start and end times that the agents have values stored for.
    int32 frames; //number of frames stored
    Matrix3 data[frames]; //the actual data
    } orientation;

    struct Cache{
    int32 version;
    LWTime start, end;
    int32 frames;
    Vector3 data[frames];
    } position;

    struct Cache{
    int32 version;
    LWTime start, end;
    int32 frames;
    Vector3 data[frames];
    } velocity;
    } agents [ agent_count ];
    };
    LightWave3D training, assets, news and discussion at www.liberty3d.com
    My opinions are my own and do not represent the opinions of any other entity, Liberty3D is not officially endorsed by NewTek.

  13. #13
    NewTek Developer jameswillmott's Avatar
    Join Date
    Dec 2004
    Location
    Gold Coast
    Posts
    3,171
    Quote Originally Posted by dulo View Post
    thx man ..

    Maybe you could also add the GI Cache specs ??? Please !!!
    I'll see if management thinks it's appropriate and post accordingly!
    LightWave3D training, assets, news and discussion at www.liberty3d.com
    My opinions are my own and do not represent the opinions of any other entity, Liberty3D is not officially endorsed by NewTek.

  14. #14
    Hey James,

    thanks again for your help. I've got a few questions:

    1. I think you forgot the position part in PFX??
    2. the rotation part in PFX: this is not a rotation per frame per particle? only one rotation for every particle throughout his life?
    3. i know it's picky, but it would be useful to see, where the loops go (loop through frames or particles or agents). a pseudo code on how to read the files for example would be better for understanding....
    4. i still don't get the rotation part in fcache. example: i bake one agent, flying and rotating around. if i zero out the orientation part (matrix), the movement of the agent stays exactly the same. it seems, the orientation part is not needed? can i use just the matrix for orientation of every agent and don't use the velocity? or is it best to use both?

    would be great if you can shed some light on these issues,

    thank you,
    philipp

  15. #15
    actually my researches led to this PFX file structure. your's seem to be wrong or insufficient? anyway. this format is not usable for importing particle data from other 3d packages. only position is per frame AND per particle. rotation and scale cannot change over time ... sigh ....

    PFX file format (particles) version 5

    Motorola Big Endian byte order!
    WriteLong = 4 byte integer
    WriteFloat = 4 byte float


    WriteLong format_version (5) //Version number for the file format, if the version is >=5 , the PFX file stores rotations.
    WriteLong total_particles //number of total particles stored, regardless of when they are alive or dead.
    WriteLong total_frames //This is the sum of the lifetimes of all particles in the stored framerange.

    for i=1 to numPoints (

    WriteLong startFrame //The frame that this particle becomes alive.
    WriteLong endFrame //The frame that this particle dies.
    WriteLong lifeFrame //The lifetime of the particle in frames.
    WriteLong mass //Mass of the particle
    WriteLong resistance //Wind resistance of the particle
    WriteLong size //Size of the particle.

    for i=startFrame to endFrame (
    WriteFloat PositionX
    WriteFloat PositionY
    WriteFloat PositionZ
    )
    )
    if format_version >= 4 ( //this chunk defines the rotation/scale/spin values per particle
    for i=1 to numPoints (
    WriteLong 0 (unknown)
    WriteFloat rotateX
    WriteFloat rotateY
    WriteFloat rotateZ
    WriteFloat scaleX
    WriteFloat scaleY
    WriteFloat scaleZ
    WriteFloat spinX
    WriteFloat spinY
    WriteFloat spinZ
    WriteFloat unknownX
    WriteFloat unknownY
    WriteFloat unknownZ
    )
    )


    Quote Originally Posted by jameswillmott View Post
    Here goes: ---


    PFX format:

    PFX is a binary format with the following structure.

    int32: 4 byte integer.
    float: 4 byte floating point value.



    struct PFX{

    int32 version;
    //Version number for the file format, if the version is >=5 , the PFX file has stored rotations.

    int32 number of particles;
    //number of total particles stored, regardless of when they are alive or dead.

    int32 number of frames;
    //This is the sum of the lifetime of each particle plus 1. For example, if you have ten particles from frame 0 to 120, the number of frames becomes 10 * ( ( 120-0 ) +1 ) or 1210.

    struct {
    int32 start_f;
    //The frame that this particle becomes alive.

    int32 end_f;
    //The frame that this particle dies.

    int32 life;
    //The lifetime of the particle in frames.

    float mass;
    //Mass of the particle

    float resistance;
    //Wind resistance of the particle

    float size;
    //Size of the particle.

    } particle_data [ number of particles ];

    //if the file version >= 5
    struct {
    float heading;
    float pitch;
    float bank;
    //The heading, pitch and bank angles ( that match LightWave's rotations )

    float dummy[3];
    //Unused data.
    } rotation_data [ number of particles ];
    };
    };

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •