Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 15-07-2004, 12:23 AM   #1
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default 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
Dann is offline   Reply With Quote
Old 15-07-2004, 01:27 PM   #2
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 15-07-2004, 07:40 PM   #3
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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!
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 16-07-2004, 12:38 PM   #4
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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


My guess is no one here will know either, but I figured it was worth a shot.
oh ye of little faith!!!
Attached Files
File Type: mb test_run.mb (50.2 KB, 22 views)
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 16-07-2004, 05:45 PM   #5
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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
Attached Files
File Type: ma normaltest.ma (64.6 KB, 21 views)
Dann is offline   Reply With Quote
Old 16-07-2004, 06:17 PM   #6
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 16-07-2004, 06:52 PM   #7
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.
Attached Files
File Type: ma normaltest2.ma (66.2 KB, 22 views)
Dann is offline   Reply With Quote
Old 16-07-2004, 10:32 PM   #8
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

It's what we're here for
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 19-07-2004, 09:29 AM   #9
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 19-07-2004, 01:52 PM   #10
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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
Attached Files
File Type: mb new_version.mb (51.4 KB, 25 views)
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.