while i was searching for my answers, i found this very usefull information from a siggraph contents
Understanding colorAtPoint MEL Command: One of the most visible and difficult aspects of water interaction is floating objects, such as particle foam and certain types of objects. Maya has a number of built-in tools to float boats and boat-like objects, tools such as addBuoy, addBoat, and addMotorBoat. All these tools have one very important thing in common, they’re all based on the colorAtPoint MEL command, By mastering this function, we can expand Maya’s capabilities and use it to create custom tools and effects such as floating curves or particles on the ocean shader. colorAtPoint can sample any combination of colors (RGBA) on an Ocean shader (or other texture) at a given UV address. While this can be put to many uses, we are primarily concerned with retrieving the height of the waves and applying it to the Y position of objects and particles. Like most displacement maps in Maya, Ocean outAlpha is used to calculate the displacement height. Since the Ocean shader’s UVs are based on Worldspace (X 3, Z 4 in Maya Worldspace = U 3, V 4 in Ocean shader UV) we can directly convert any point’s Worldspace to ocean UV space and sample the Alpha to get the appropriate Y height of the waves. colorAtPoint use: -convert point (object) Worldspace to Ocean UV; -sample Alpha at given UV address; -use returned Alpha value as Y height of point (object); floatSphere is ur object //myFloat_expression //float an object on the ocean surface //translate XZ are free, Y is constrained to ocean float $posu = floatSphere.translateX; float $posv = floatSphere.translateZ; float $posy[] = `colorAtPoint -o A -u $posu -v $posv oceanShader1`; floatSphere.translateY = $posy[0]; Expression explained: -o A : “A” samples the Alpha only. Other options are “RGB” and “RGBA”; -u and –v : place input variable for the Worldspace point you wish to sample (object’s position XZ you wish to float) IMPORTANT: since colorAtPoint is a MEL command, you have to use “`” (not single quote, the other one above TAB on your keyboard) on either end when in an expression. Also, you should use $variables for –u and –v since MEL can’t convert expression syntax such as “locator1.translateX” (MEL sees this as a string only). $locY[] : Since colorAtPoint returns a float Array, you can’t use it directly in translateY (requires a single float). NOTE : When a MEL commands such as colorAtPoint is embedded in an expression, it does not update when names it refers to are changed. E.g. If “oceanShader1” were changed to “myOcean”, the expression would return an error. Since many Maya floating tools (createBoat…) generate expressions with embedded MEL, it is very dangerous to rename the floating object/locator’s transform, or the oceanShader after the tool is invoked. You would have to manually edit the MEL lines in the expression after such a name change. hope it helps |
well this script can help u float particles on ocean surface like a foam and can be manuplate as wake happens u see more control..over ur foam
//float particles on ocean surface (runtime) //get ocean height at current particle position vector $ppos = foam_particleShape.position; float $pu = $ppos.x; float $pv = $ppos.z; float $cpoint[] = `colorAtPoint -u $pu -v $pv oceanShader1`; //when particle position lower than ocean, stick to ocean if($ppos.y <= $py) foam_particleShape.position = <<$pu, $cpoint[0], $pv>>; hope it helps ! |
WoW, Pretty Good expressions~
|
Pretty Good expressions~
|
Holy cow Mind-raper!!!! GREAT posts bud!!!
|
Emit More Particles as the emitter goes faster
here is the fairly advance trick you may find usefull ....Maya does not let u ...vary emission rates with velocity but this will allow such an effect
Create an Sphere and add expression to its Translation X attribute tx = sin(time*3); this will make the sphere oscillate back n forth along x smoothly - with the ball selected, choose Surface emitter type, setting the rate (Particles/sec) to 2000 and turning to the speed of 0 - In the Particle1 attribute Editor, Turn in herit Factor to 1 under emission attributes - Now, Under Lifespan Attributes, Select lifespanPP only. Go down to per particle (Array) attribute and right mouse click on lifespanPP and select runtime expression. Enter this expression: $magv = mag(velocity); if (rand(1)<linestep(0,1,$magv/3)) lifespanPP = 1 else lifespanPP = 0 you are done....play with attribute for more finner result this snippet was taken from Maya Killer tips book hope it helps :) |
ROCK ON!!!
Thanks again MR!! Now im off to test this on a shot where I use an exahust emitter that needs to slow to a crawl when my aircraft stalls out, then picks up again on desent!! You fail to surprise us all bud! Thankd again! |
How to convert particles to geometry, not just instances
I am creating a background scene that needs to be filled with a bunch of rocks and other small things. I figured I could place particles on a live surface, and then use the Instancer (Replacement) tool to add geometry in place of each particle.
Is there anyway to then convert each instanced geometry into its own object/geometry? I know there is a feature to convert paint effects into geometry, but I don't think there is a way to convert particles into geometry. I cannot select the instanced geometry, only the instancer node in the Outliner. Thank you to anyone that can help me out. |
wow, this is an increible thread, I know very little myself but just glacing through this stuff, it is great.
|
i guess there's an A.I plug for maya that give u more control over instanced geometry try googling for it, i really dont remmeber its offical web !!!!
|
Emit more with speed change
1 Attachment(s)
here's an example of playing with particles as the object changes the speed as mention'd above in detail ;)))
enjoy! particling ;) :p |
a very beautiful effect. im just learning about particles now and that is one hell of a good look.
|
hey this is simply maya, not 'my space' drop the porn, be a good boy!
|
how to make object-dependent collision effects
1 Attachment(s)
I was wondering if there's a way to make particles behave differently according to the object they collided with. After some hours of trial and error I found this solution:
Let's say you want to have particles raining down on two cubes. Particles that collide with cube 1 shall become red and bounce off the cube (and eventually collide with cube 2), cube 2 shall kill the particles once they collide with it. - Create an emitter that lets the particles rain down (omni, gravity field) - Create 2 (or more, it doesn't matter) poly cubes and place them under the emitter in a way that some particles collide with cube 1 and some with cube 2 - name the transform node (pcube1 not pcube1shape) to cube_A and the other one to cube_B - Make the particles collide with both of them (Particles-->Make collide) - Select the particleShape and add a per particle collisionGeometryIndex via Add Dynamics Attibutes-->General-->Particle-->collisionGeometryIndex - Also add an rgbPP Attribute (Add Dynamics Attibutes-->Color-->Add per particle attribute) - now create a runtime expression on the lifespanPP and rgbPP attribute: Code:
int $index = particleShape1.collisionGeometryIndex; You can easily add more collision objects with different effects on the particles, I think a switch-case condition would be more elegant for that. I attached a scene file with the stuff above, have fun! |
It's normaly bad practice to bring a thread back to life but this one popped up on a Google search I just did and as it's still relevant I thought I'd bump it back up to the top.
If anyone has anything they would like to share would be great to see it. I might even turn each expression into a tutorial with example then throw the lot out for free. All the best Dave |
All times are GMT. The time now is 06:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018