Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 14-07-2004 , 11:23 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695

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

# 2 15-07-2004 , 12:27 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
I'm looking into it user added image 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
# 3 15-07-2004 , 06:40 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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! user added image


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 4 16-07-2004 , 11:38 AM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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. user added image

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!!! user added image

Attached Files
File Type: mb test_run.mb (50.2 KB, 267 views)

Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 5 16-07-2004 , 04:45 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
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, 256 views)
# 6 16-07-2004 , 05:17 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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! user added image

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 user added image
Good luck and i'll check in on this on monday.

Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 7 16-07-2004 , 05:52 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
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, 261 views)
# 8 16-07-2004 , 09:32 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
It's what we're here for user added image


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 9 19-07-2004 , 08:29 AM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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
# 10 19-07-2004 , 12:52 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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 user added image

Attached Files
File Type: mb new_version.mb (51.4 KB, 278 views)

Technical Director - Framestore

Currently working on: Your Highness

IMDB
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads