View Full Version : suface flow w/o effect
09-14-2003, 08:10 PM
I'm missing something here I'm sure and I hope somebody can hip me to what it is.
I've built a curve flow many many times using the curve as a goal and putting a ramp in the particles goalU. Whenever I try this with a surface the particles always lock themselves to the verts. Why is that?
09-15-2003, 12:43 AM
Have you ticked the 'Need Parent UV' box under "Basic Emitter Attributes" on the emitter?
Because it won't store the parentU and parentV without it!
09-16-2003, 05:40 AM
Thanks for the tip but I'm still not quite getting it. The particles aren't sliding across the surface but rather appearing at each vertex. If you could be so kind could you out line the steps to get a particle to slide down a nurbs surface? Thank you so much.
09-16-2003, 10:25 AM
How could I refuse after you asked so nicely!! Here's an example:
(Before we start, make sure your Playback Speed is set to 'Play Every Frame' in your preferences)
1. Create NURBS Cylinder
2. Select the cylinder and add particles by going to Particles > Emit from Object
3. Select the emitter and in the Channel Box, change the Emitter Type to 'Surface'.
4. Then change the Rate to something like 15 or 20.
This is just so that we can cleary see what's happening without thousands of particles making it too confusing. You can leave it on 100 if you like.
5. Still in the Channel Box, set Need Parent UV to 'on' instead of 'off'.
That tells Maya to record the position on the cylinder where each particle was created. It stores those values as the attributes 'ParentU' and 'ParentV'.
6. Now select the particles instead. Change the Particle Type to 'Spheres' to make them much easier to see.
7. With the particles still selected, shift-select the cylinder and go to Particles > Goal.
If you press play now you should see the particles spring around and stick to the cylinder, but they stick to the CVs, so we're not quite there yet!
8. In the Channel Box, change the Goal Weight for the particles to 1 instead of 0.5.
Just to remove the springiness!
9. Making sure the particles are still selected, open the Attribute Editor and open out the "Per Particle (Array) Attributes" section.
We need to add some custom particle attributes in order to control the way the particles use the cylinder's UV information.
10. Under "Add Dynamic Attributes", click the General button, to add some general attributes.
11. In the window that pops up, change over to the Particle tab at the top.
This shows us a list of particle attributes that are not shown by default, but are already understood by Maya when used.
12. Select the attributes 'goalU', 'goalV', 'parentU' and 'parentV' (holding down Ctrl to select more than one) then press Add.
The attributes are added to the list in the Attribute Editor. You may need to close and reopen the Attribute Editor for them to display though.
13. Close the window that popped up if you haven't already.
14. Right click on the new goalV attribute and choose 'Creation Expression'.
This will let us write an expression to control what this value does when the particles are first born/created.
15. In the Expression Editor, type the following:
goalV = parentV;
goalU = parentU;
This is telling Maya that we want the goal for each particle to be the position on the cylinder at which it was born. Even though we right-clicked on the 'goalV' attribute we can still add expressions that tell other attributes what to do. All the Creation Expressions for one object end up in the same place anyway. So it doesn't really matter what attribute we right-click on to get here.
16. Press 'Create' to finish the expression. Next time you look at the expression, Maya will have added the name of the particles to each attribute (eg MyParticles.goalV = MyParticles.parentV).
Now if you rewind and play back your scene, the particles should start appearing at random places on the surface of the cylinder! Not on the CV's like before!
Next we'll make the particles slide down the cylinder. For that, we just need one simple line of expression.
17. Right click on the 'goalU' attribute and this time choose Runtime Expression.
A runtime expression tells Maya what to do each time a frame goes by when we play our animation.
18. Type this into the Expression Editor and press Create to create this new Runtime Expression.
goalU -= 0.01;
(That's "goalU minus equals 0.01")
"Minus equals 0.01" means "subtract 0.01 from the current goalU value". So on each frame, 0.01 will be subtracted from 'goalU'. I used a tiny number like 0.01 so that the particles don't slide down super fast. I chose 'goalU' instead of 'goalV' because of the U and V directions of the cylinder. Using 'goalV' would make the particles swirl around the cylinder rather than slide down.
Now if you play back your scene, the particles should appear at random locations on the cylinder and then slide down and collect at the bottom!
Because the particles collect at the bottom though, the calculation can quickly become intense and slow everything down. So let's now make it that once the particles arrive at the bottom of the cylinder, they die.
We can do that with one more simple line of expression!
19. Firstly, set your particle's Lifespan Mode to 'lifespanPP only'.
Which means that the lifespan of each particle can be controlled through expressions.
20. Back at the list of custom attributes in the Attribute Editor, right-click on 'lifespanPP' and choose Runtime Expression.
21. Type this into the Expression Editor:
if (goalU <= 0.02) lifespanPP = 0;
"If a particle's goal in the U direction is less than or equal to 0.02 (a position very close to the bottom), kill the particle"
22. Click Edit to save the changes.
Now if you play back your animation, the particles should slide down and then vanish once they reach the bottom of the cylinder!
And that's it! I hope I've written all of this correctly, I'm fairly tired and so forgive me if there are any mistakes!
I've attached my finished scene file (Maya 5) in case you don't understand something. And be sure to ask questions if you have any!
09-16-2003, 12:28 PM
That gets one particle at one point on the surface to flow along the surface but what if you want to get many particles on top of each other as in a avalanche
09-16-2003, 05:31 PM
>>> Jozvex - Thank you~!
People like yourself are what keep this kick ass forum alive. I can't wait to try this when this huge fluid render finishes :)
09-16-2003, 11:19 PM
josvex - that one's good enough to make into a full tutorial! Thanks again for teaching me something new.
09-17-2003, 03:57 AM
No problem guys! I can't believe how long it turned out to be...
And Kaiser_Sose, the instructions I gave should create lots of particles flowing on the surface, not just one. If you turn up the Rate on the Emitter you should be able to get a more avalanche-like effect.
You could also turn the goal weight down to something like 0.75 and then add a Turbulence field to get the particles to bounce around more etc
09-17-2003, 07:50 AM
All particles stick to the surface, in an avalanche you would want some to follow the motion of the surface but build layers and layers on top of each other as they are falling down
01-16-2006, 04:00 AM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.