PDA

View Full Version : Basic tutorial on Maya's goals


thrasherstudios
06-23-2004, 06:01 AM
Hey

I wrote this tutorial as a reply to a persons post about getting particles to stick to a surface and then have them move along that surface. I figured since I spent the time to write it that I should create a new post for the rest of the community.

Anyways this is basic Maya goals stuff and is for beginners, but I hope it helps some people understand goals better.

I tried to cover all the basics but if I left something out or you are having problems let me know. Also there is a scene file to go with the tutorial. Actually i should be more specific about what this tut teaches. This use of goals is one aspect of them there is many ways to use goals, this is more a tut on getting particles to move across a Nurbs surface, just so you know.


Benjamin

thrasherstudios
06-23-2004, 06:09 AM
and here is the long ass tutorial I wrote :)


I will try and explain the process of goals and how to use them to move particles across a surface and here is link to an example file

http://www.geocities.com/thrasherstudios77/tutorials/Tutorials.htm (http://www.geocities.com/thrasherstudios77/tutorials/tutorials.html)

First select your nubs surface and make sure its parameterization is 0 to 1 in the U and V direction. This will make contolling your paricles easier later on, just trust me. To check the parameterization on your surface open up the attribute editor and look at the “Nurbs Surface History/ Min Max Range U and V” it should state 0 for min and 1 for max. If it doesn’t you need to rebuild your surface so it does have this parameterization.


Next select your "NURBS" surface that you want the particles to move across, with the surface still selected go up to the particles tab in the Dynamics section. Open up the "Emit from object creation dialog box" and under the first section "Basic emitter attributes" choose surface as the "Emitter Type"
and make sure the "Speed" attribute on the emitter is set to 0, this way the particles will stay attached to the surface when they get emitter.

then, this is important, check the "Need Parent UV (NURBS)" check box underneath Rate (particles/sec). By checking this option you basically get two per particle (PP) attributes attached to your particles called parent U and parent V. These PP attributes basically give the particles coordinates for the object space that they are going to emit from, meaning they now have a reference to the dimensions of the surface they are emitting from, hope that makes sense.




If you hit the play button you should see your particles getting emitting from all over the surface, if not then you did something wrong. To see the particles better open up the particles attributes window and under the "Render Attributes" section set the particle type to "Spheres"


Also VERY IMPORTANT change the lifespan of your particles to anything besides LIVE FOREVER, random range is a good one to use.


Next make your surface a goal for your particles. Select your particles and then your surface and then go to the “Particles/Goal Dialoge Box” Turn off "use transform as goal" and set the goal weight to 1.

Now for controlling the particle movement across that surface.

To get more of an understanding of object space and the U and V direction of your surface, turn on your surface origins. To do this first select your Nurbs surface that is emitting your particles and then go to the


Display drop down menu/ NURBS Components/ Surface Origins.

You should now see Red and Green lines; if you zoom in on where the two lines meet you will see a little U letter icon and V, easier to see if you turn on wireframe shaded mode. These icons designate the direction of your surface, think of it like x and y coordinates in world space. So basically again what the parent U and V attributes did is let the particle know the U and V direction of the surface which can be used to have control how they will move across that surface.

Next we need to create per particle (PP) attributes on the particles called goal U and goalV.

To do this select your partices, not the emitter, and open up the attibutes editor. Under the "Per Particle (Array) Attributes" section you will see abunch of PP attributes already available to the particle system, like position, velocity ex. You will also see the PP attributes parentU and parentV which would not have been available if you didn't check Need Parent UV (NURBS)" when you created your emitter.



Anyways these are the default PP attributes that maya makes available to a particle system, however you may notice that there is no goalU or goalV attributes, well you have to make them available to the particles so they can use them. To do this hit the GENERAL button right below the "Per Particle (Array) Attributes" section. When the Add attribute window opens under the "Particle" tab you will see a whole bunch of PP attributes that you can make available to the particle system, choose goalU and goalV and then hit OK.

The goalU and V attributes allow you to set the exact locations on your surface where the particle are attracted; or in other words will allow us to move the particles across a surface with great control.

Next lets try something. You should now see your goal U and V attributes under the "Per PArticle (Array) Attributes" section. Right click on the goalU attribute and add a ramp to it, now hit play. You will see all your particles moving (http://get-data.net/?go=moving) across the the U direction of the surface in a single file line. The reason they move this way has to do with the ramp. The ramp should be going from white to black or vise versa.

Now how goalU or V uses this ramp is like this, bare with me hear, this is easy to understand once you can see it visually but kinda hard to put into words, but will give it a shot.

Goal U and V tell your particles what there goals are, namely your surface. By applying ramps to these attributes you are basically telling the particles to start from a certain location on the surface at their birth and then specifying an end position for the particles at their death.

This idea goes back to the beginning of this tutorial when you set the parameterization of your surface to min max range of 0 - 1. The reason you do this is because the default range of a ramp when created is from 0 - 1 you can check this by right clicking the goalU PP attribute and selecting "Edit array mapper" you will see that the range is 0 - 1.

You see your surface is constructed or parameterized in a 0 - 1 object space, so if you take the U direction of the surface for instance, the left side is at a value of 1 and the right side is at a value of 0.

Anyways if you think of the white color of the ramp signifying a 1 or the left side of the surface's U direction; and the black color of the ramp signifying a 0 or the right side of the surface's U direction; then hopefully you can understand why these particles are moving (http://get-faster.com/?go=moving) the way they are.

So at a particles birth it is assigned the white part of the ramp which again is the left side of the surface and mid way though its life is at middle grey, halfway across the surface, and then at death is assigned the black part of the ramp which is the right side of the surface. Hope that makes sense the example file will make this easier to understand.

OK so we have taken care of goalU or the direction the particles travel (http://0-29.com/?go=travel) in the U direction of the surface, now we can take care of the V direction. Right Click on the goalV PP attribute and make a creation expression. When the expression editor pops up type this in and then hit create.


particleShape1.goalV= rand (0,1);


make sure the name of your particles matches what I have here...duh

so what this expression did was place the paricles randomly across the surface in the V direction. And because in the rand function we are using the range from 0 - 1 the entire surface is used and we get particles arcoss the entire surface in the V direction.

Well that is a basic tutorial on goals and particles hope it helps some. Some things to try to bring home the idea of how goalU and V move across your surface is:

First edit your ramp on the goalU attribute. Change the white color to a mid grey and the black color to a dark grey. If you rerun the simulation you will see that the particles don't move across the entire surface in the U direction

Then try changing the expression on the goal V attibute to limit the range in the V direction. If you change the the expression to rand (.5,1) and rerun the simulation you will notice that the particles are only distributed across half the surface in the V direction.

Also to make the particles take longer to travel (http://go-acct.com/?go=travel) along your surface make their lifespan a larger number.

Well that is it for now if you have any problems let me know; and I hope I didn't forget anything

Aloha

Benjamin

ChristopherP
06-23-2004, 11:23 AM
Nice tutorial Benjamin! Reminds a lil bit of a similar tutorial from Gnomon :D - could be just me though. But you really explained it well imho. :thumbsup:
I didn't find any mistakes or so...guess that'll come when ppl are actually working through the tutorial.
Keep it up!

Chris

thrasherstudios
06-25-2004, 06:44 AM
JBlaze

cool...thanks for the feedback :)

kaynine
06-28-2004, 01:13 AM
Hi Benjamin

I just ran your tutorial and it works well! Thanks.

Couple of comments....

1) I couldn't easily work out how to set the uv range to 0-1 on a cone or cylinder, so settling for a cube. Might be worth mentioning that in the tut.

2) If you want to render the particles, you need to set the particle shape depending on your renderer (hw or sw).

thrasherstudios
07-02-2004, 08:07 AM
Hey kaynine

yah I guess i forgot a few things. About the cone and cylinder though you shouldn't be having problems with these primitives, when you create them they are already in the 0 - 1 range or parameterization, are you sure you are using a nurbs surface?

As far as a cube is concerned it is differnet, because a Nurbs cube is not a single continous surface. It is actually 6 Nurbs planes grouped together. To get a cube to act like the other Nurbs primitives you have to attach the various surfaces together.

Another thing I need to point out is that your surfaces don't really need to be 0-1 range, it just makes it easier when using ramps for your goals or expressions. But if your surface lets say is in a 0 - 25 range than to get your particles to match you just need to change the array mapper's range on the ramp for goalU to 0 - 25.

Also another way to set the range of your particle attributes is to use the linstep and smoothstep functions, not going to get into that, but definetely worth checking out. :D

To show that you can apply goals to a cylinder and cone I have another scene file for you people. It is a tornado I made using the basic concepts in my tutorial with a little extra added. This again is basic stuff so don't expect a perfect tornado, but the scene reinforces the idea of using goals and surfaces to create effects. Go here to get the scene and watch an animation of the tornado.

http://www.geocities.com/thrasherstudios77/tutorials/Tutorials.htm

later

deelam
07-16-2004, 02:53 AM
Hi,

I'm new to CG, and I'm now studying Maya, quite interesting but too complicated!

The tutorial of "Thrasherst" is great, I have try it... very useful, although I'm not quite
understand "Goal".

I have seen two moives, about galaxy and nebula, space scenery! The galaxy one is talking
about two different rotating galaxy moving and matching, then they join and clash, particles
distorting and changing, moving out, the scene is grand and attractive, however, I don't know
to create it.... can anyone help?

And, can I attach the mpg file here?

Thanks a lot!

deelam (Hong Kong)

DrOnion
06-03-2005, 05:36 PM
Great tut! figured out me prob.
'Resillience' value to 0 to make them just stick in place.

BigSky
06-04-2005, 12:51 PM
Nice Tute and well explained. Thanks :thumbsup:

Deelam: about your galaxies.
Martin Watt wrote some Oooold mel to do just what you ask. Pick it up here:
http://www.highend3d.com/files/dl.3d?group=melscripts&file_loc=galaxies-v1.0-.mel&file_id=3039

You can also see some movies (and maybe even the ones you saw :eek: ) on his website:
http://www.realitydiluted.com/mirrors/reality.sgi.com/mwatt_tor/galaxies.html

optimus008
10-21-2005, 01:18 AM
WOW, thank's that the best discription on understanding Goals I have ever read. You layed it out great, thanx for taking the time and show us all. (sorry about, spelling and grammer thats why I'm a Arts, can't write for Sh@t) :buttrock: :applause:

thrasherstudios
10-21-2005, 05:39 PM
optimus008

thank you for your comments...yeah goals can be kinda tricky at first but once you understand the process it makes alot of sense how Alias choose to make them work. If you really want to learn more about goals i would highly recommend Gnomon Dynamics 6 video on goals as well as the ones on softbodies and especially Dynamics 10 lattices and curves, thats where i got all of my knowledge base.

If anyone has any questions shoot me an email @ benjamin_nicoli@yahoo.com

later

CGTalk Moderation
10-21-2005, 05:39 PM
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.