Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Dynamics & Special Effects (https://simplymaya.com/forum/forumdisplay.php?f=33)
-   -   rain splotches (https://simplymaya.com/forum/showthread.php?t=12612)

Dann 14-07-2004 11:23 PM

rain splotches
 
OK, this is a tricky one. (at least for me it is).

I have this rain falling in a canyon and the camera is a crane shot. Now the canyon is actually made out of a light colored sand, so when the rain hits, besides little splashes I want to have the sand get darker in those spots. I've got it working that on the collision event, and particle with an instanced object is created it that spot with no movement, and I plan to get it looking right in the composite. This part all works fine.

Here's where I'm stuck. The little instanced planes are always pointing up. This would work well if the canyon were flat, but it's not. When a rain drop hits the walls, the splotch still points up rather than having the appropriate perspective. What I think I need to do is figure out a way to read the tangent at which the drop hit the wall, and the set the aim direction of the instanced particle to be perpendicular to it. This is the part I have no idea how to do.

My guess is no one here will know either, but I figured it was worth a shot.

Thanks,
-dann

Alan 15-07-2004 12:27 PM

I'm looking into it :) I'll get back to you when I figure it out. i know what to do but I can't get the info I need back from maya at the moment.

Alan

Alan 15-07-2004 06:40 PM

ok I got quite far but maya is being infuriating and not letting me grab the data I want from the particles so it's a little difficult to orientate the planes at the moment. But I'm getting there! :)

Alan 16-07-2004 11:38 AM

1 Attachment(s)
ok success but looking back at yoiur post it's maybe not exactly what you wanted. But it's pretty cool anyways and it should show you roughly how to orientate the particles to the plane.


1. create a particle emitter.
2. create a small nurbs plane (to be instanced) and a large one (to collide with). Deform the big on e a bit so you can see this in action.
4.create some gravity for the particles.
5. make the large plane and the emitter collied together.
6.instance the small plane onto the particles.
7. add the collisionU and collisionV particle attributes. Add two more vector attributes (per particle arrays) one called normal and one called inverseNormal. These are th normals of the point of collision.

8. put this expression on the particleShape


//CODE---------------------------------------
//object to collide with
string $obj = "nurbsPlane2";

//dont really need to do this but it's easier
float $cV = particleShape1.collisionV;
float $cU = particleShape1.collisionU;

//when collision occurs these values change so only do the next bit when they do!
if($cU != -1 || $cV != -1)
{
//build up our pointone surface command. Which will return the xyz of the uv collision point
string $tmp = "pointOnSurface -u "+ particleShape1.collisionU +" -v "+ particleShape1.collisionV +" -position nurbsPlane2";
//eval it
float $collInfo[] = eval($tmp);

//build up another command to do the same for the normal
$tmp = "pointOnSurface -u "+ particleShape1.collisionU +" -v "+ particleShape1.collisionV +" -nn nurbsPlane2";
//eval it
float $iNormal[] = eval($tmp);

//assign the values to the vector attributes created earlier
particleShape1.inverseNormal = <<$iNormal[0] * -1, $iNormal[1] * -1, $iNormal[2] * -1>>;
particleShape1.normal = <<$iNormal[0], $iNormal[1], $iNormal[2]>>;
}
//CODE---------------------------------------

9.set the particle instance options in the particleshape to be

aimdirection: iNormal
aimAxis: normal

10. Hit play... it's should work. ;)

check out the attatched scene file to see it working

post again if it doesnt work.

Alan


Quote:

My guess is no one here will know either, but I figured it was worth a shot.
oh ye of little faith!!! :ninja:

Dann 16-07-2004 04:45 PM

1 Attachment(s)
Alan,

Thanks for the help, but you seem to have left something out because it doesn't work the way I tried it.

"6.instance the small plane onto the particles."
this doesn't make sense because now my little objects are falling from the sky when they shouldn't appear until the hit the collision object. Shouldn't there be a collision event to kill the particles falling from the sky and spawn a new one?

To more easily view the normals, what I did was I instanced cones instead of planes. When they hit the collision object, they flip 180 degrees and then they slowly slide down the slope rather than staying put where they are.

I've attached my test file so you can see if I implemented your code incorrectly.

Thanks,
-dann

Alan 16-07-2004 05:17 PM

right you need to change the pointOnSurface plane to be the big deformed nurbs plane not the little one.

The cones still dont seem to align quite right but it's friday and I'm off for a beer! ;)

As for stopping them, what you can do is set another attribute that is set to true once it has collided. Then you can set the velocity per particle to 0 and thus it should stop moving. If that doesnt work store the position per particle and manually set it's position to that.


And as for making them appear when another particle hits, if you have already got that working before (as you said above) you should be able to use what i have done here to make that apply in your one ;)
Good luck and i'll check in on this on monday.

Alan

Dann 16-07-2004 05:52 PM

1 Attachment(s)
Alan,

You truly kick ass!! I wish I had someone like you at my company. You got me 98% of the way there, and I just had to clean up a few things to get it working.

To get the cones to stop setting velocity and acceleration to 0 didn't help, but setting the mass to 0 did the trick.

You were also right that the alignment wasn't quite right, but by setting your "normal" attribute to AimWorldUp rather than AimAxis, the alignment looks spot on.

Thanks again,
-dann

p.s. It wasn't that I had little faith, but figured with something this tough I was going to have to throw down the gauntlet if I had hopes someone would respond.

Alan 16-07-2004 09:32 PM

It's what we're here for ;)

Alan 19-07-2004 08:29 AM

I was thinking about this, ther eis another way you could do this which might work better.

Create a function that will make a small plane (as a collision event) then you could orientate the planes using a normal constraint. Just a thought.

Alan

Alan 19-07-2004 12:52 PM

1 Attachment(s)
take a look at this one. it works a bit better and the planes dont move after they hit the ground plane.

EDIT

Actually add a geometry constraint on the end of the expression and it will stick to the geometry if it deforms or moves etc. That way you could have it on water or whatever you wanted ;)


All times are GMT. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018