djorzgul
01-05-2007, 10:31 AM
-hello to all,
I would like to use an image sequence in 2D container (it is a short black and white animation I did)... I manage to do the thing I wanted with one frame, but I don't know how/if it is possible/ to do the same thing with a sequence.
Any guidance will be more than appreciated :)
----edited&merged posts-----
I found the answer on maya wiki (http://www.tokeru.com/twiki/bin/view/Main/MayaFluids)
by mr. Duncan :) himself
Here is a little expression that gets the alpha from a file texture node "file1" and adds this every frame to the fluid node "fluidShape1". It samples the file node based on the fluid resolution. If you want it to use an image sequence, simply turn on "useImageSequence" on the file texture node. To use color instead of alpha you can use RGB instead of A in the colorAtPoint call. Then in the loop you need to get the r,g and b values from the array, incrementing the index after each.
Duncan
int $nx = fluidShape1.resolutionW;
int $ny = fluidShape1.resolutionH;
int $i, $j;
float $colorArray[] = `colorAtPoint -o A -su $nx -sv $ny file1`;
int $index = 0;
for( $i = 0; $i < $nx; $i++ ){
for( $j = 0; $j < $ny; $j++ ){
setFluidAttr -at "density" -ad -fv ($colorArray[$index]) -xi $i -yi $j fluidShape1;
$index++;
}
BUT, for some reason I get errors every time I try to execute the expression.
Since the explanation is pretty straightforward maybe I am missing something else.
I tried both on square container /default one, and on the one I adjusted to my needs [720x360 is the size in container properties]
my workflow was like this:
1. I make 2D fluid container
2. I make one file texture node and load the 49frames sequence [white figure on black]
3. I try to execute the script so I connect the sequence with container but all I get is this error:
// Error: int $nx = fluidShape1.resolutionW; //
// Error: Invalid use of Maya object "fluidShape1.resolutionW". //
// Error: int $ny = fluidShape1.resolutionH; //
// Error: Invalid use of Maya object "fluidShape1.resolutionH". //
// Error: //
// Error: Syntax error //
So,
I am not very experienced with expressions so I am missing something for sure...
I'd appreciate if someone help me with this.
I would like to use an image sequence in 2D container (it is a short black and white animation I did)... I manage to do the thing I wanted with one frame, but I don't know how/if it is possible/ to do the same thing with a sequence.
Any guidance will be more than appreciated :)
----edited&merged posts-----
I found the answer on maya wiki (http://www.tokeru.com/twiki/bin/view/Main/MayaFluids)
by mr. Duncan :) himself
Here is a little expression that gets the alpha from a file texture node "file1" and adds this every frame to the fluid node "fluidShape1". It samples the file node based on the fluid resolution. If you want it to use an image sequence, simply turn on "useImageSequence" on the file texture node. To use color instead of alpha you can use RGB instead of A in the colorAtPoint call. Then in the loop you need to get the r,g and b values from the array, incrementing the index after each.
Duncan
int $nx = fluidShape1.resolutionW;
int $ny = fluidShape1.resolutionH;
int $i, $j;
float $colorArray[] = `colorAtPoint -o A -su $nx -sv $ny file1`;
int $index = 0;
for( $i = 0; $i < $nx; $i++ ){
for( $j = 0; $j < $ny; $j++ ){
setFluidAttr -at "density" -ad -fv ($colorArray[$index]) -xi $i -yi $j fluidShape1;
$index++;
}
BUT, for some reason I get errors every time I try to execute the expression.
Since the explanation is pretty straightforward maybe I am missing something else.
I tried both on square container /default one, and on the one I adjusted to my needs [720x360 is the size in container properties]
my workflow was like this:
1. I make 2D fluid container
2. I make one file texture node and load the 49frames sequence [white figure on black]
3. I try to execute the script so I connect the sequence with container but all I get is this error:
// Error: int $nx = fluidShape1.resolutionW; //
// Error: Invalid use of Maya object "fluidShape1.resolutionW". //
// Error: int $ny = fluidShape1.resolutionH; //
// Error: Invalid use of Maya object "fluidShape1.resolutionH". //
// Error: //
// Error: Syntax error //
So,
I am not very experienced with expressions so I am missing something for sure...
I'd appreciate if someone help me with this.
