View Full Version : Re-cache a re-timed fluid cache ?

04-11-2009, 05:09 PM
Ive got a fluid cache , I've re-timed with a new time node to slow the motion at certian frames.

Can anyone think of a way to 'export' the retimed cache in to a new .mcfp cache file ? I'm using an external renderer that reads cache files outside of maya, so any re-timing I do in maya will not be respected.

Cheers, and thanks

04-11-2009, 08:06 PM
Create a secondary fluid object, have an expression to copy all the info from the re-timed fluid to the secondary one, and cache the secondary fluid?

04-11-2009, 09:37 PM
I was thinking exactly the same thing.

Here is a start:
Duplicate your original fluid, so that all of your ramps are identical.
Run this expression-

string $myOrigeFluid = "fluidShape1";
string $myDupeFluid = "fluidShape2";
float $myRes[] = `getAttr $myDupeFluid.resolution`;
int $cellX = -1;
int $cellY = 0;
int $cellZ = 0;
int $rezX = $myRes[0];
int $rezY = $myRes[1];
int $rezZ = $myRes[2];
int $i = 0;
for ($i = 0; $i < $rezX * $rezY * $rezZ ; $i ++){
$cellX +=1;
if ($cellX >= 10){
$cellX = 0;
$cellY += 1;

if ($cellY >= 10){
$cellY = 0;
$cellZ +=1;
if ($cellZ >= 10){
$cellZ = 0;
float $myDensity[] = `getFluidAttr -at "density" -xi $cellX -yi $cellY -zi $cellZ $myOrigeFluid`;
setFluidAttr -at "density" -fv $myDensity[0] -xi $cellX -yi $cellY -zi $cellZ $myDupeFluid;

float $myVelocity[] = `getFluidAttr -at "velocity" -xi $cellX -yi $cellY -zi $cellZ $myOrigeFluid`;
setFluidAttr -at "velocity" -vv $myVelocity[0] $myVelocity[1] $myVelocity[2] -xi $cellX -yi $cellY -zi $cellZ $myDupeFluid;


You will need to re-declare the original fluid and the duplicate fluid variables.
Also, add any other attributes you want to copy over... I just put in velocity and density.


04-13-2009, 06:20 PM
Thanks ! I ended up using a mel script to export my fluid as a point cloud, storing the data I need in the points at each frame....I can mess with the cache /transform/ what ever and export from there.



CGTalk Moderation
04-13-2009, 06:20 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.