|08 August 2003|
Once you have the uv point on your surface you can emit into that uv position on a fluidTexture2d(applied presumably as a displacement map). To get a ripple simulation set the fluid solver to "spring mesh".
In your particle runtime expression you can determine the grid index at the collision point by dividing the uv by the grid resolution uv.
// assuming you have defined the variables collideU +V
// if the particle collides do the following:
int $dropSize = .5; // depth of ripple to create
int $indexU = $collideU/(float)fluidTexture2DShape1.resolutionH;
int $indexV = $collideV/(float)fluidTexture2DShape1.resolutionW;
setFluidAttr -xi $indexU -yi $indexV -at density -ad -fv $dropSize fluidTexture2DShape1;
The above adds in a density to the fluid texture at the particle collide location which will generate a ripple at that point. I'm assuming that your code already initializes a colldeU and V variable and that you have created a texture called fluidTexture2DShape1 that is assigned to the same surface being collided with.
|08 August 2003|
it took me a few hours but i got it to work with the following code :
float $colU = particleShape1.collisionU;
float $colV = particleShape1.collisionV;
if ($colU > 0)
$dropSize = 1; // depth of ripple to create
$indexU = (float)fluidTexture2DShape1.resolutionH*$colU;
$indexV = (float)fluidTexture2DShape1.resolutionW*$colV;
setFluidAttr -xi $indexV -yi $indexU -at density -ad -fv $dropSize fluidTexture2DShape1;
there is probally a lot better way of writting this code but i am new to mel and this was the best i could do. One thing that you have to make sure of is that the UV of your nurbs mesh lines up with the XY or hight width of your fluid texture. I had a look at your scene file and you should lie your fluid texture on top of your nurbs mesh easier to see whats happening
|01 January 2006|
Thread automatically closed
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.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|