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 11-06-2004, 09:09 PM   #46
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Lightbulb

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
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 14-06-2004, 10:52 AM   #47
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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 !
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 19-08-2004, 08:19 PM   #48
GuardHom
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

WoW, Pretty Good expressions~
GuardHom is offline   Reply With Quote
Old 16-12-2004, 04:52 AM   #49
vivi3d
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Pretty Good expressions~
vivi3d is offline   Reply With Quote
Old 18-12-2004, 06:09 PM   #50
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Holy cow Mind-raper!!!! GREAT posts bud!!!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 15-01-2005, 05:46 PM   #51
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default 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
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 15-01-2005, 06:13 PM   #52
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

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!
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 07-06-2006, 12:29 AM   #53
joed8349
Registered User
 
joed8349's Avatar
 
Join Date: Feb 2004
Posts: 261
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
__________________
<br><b><a href="http://euphrates.wpunj.edu/students/dimperioj" target = blank> My Website </a>
joed8349 is offline   Reply With Quote
Old 07-06-2006, 10:21 AM   #54
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

wow, this is an increible thread, I know very little myself but just glacing through this stuff, it is great.
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 13-07-2006, 01:32 PM   #55
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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 !!!!
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 13-07-2006, 02:11 PM   #56
mind_raper
Registered User
 
Join Date: Nov 2002
Location: Pakistan
Posts: 57
Thanks: 0
Thanked 3 Times in 3 Posts
Default Emit more with speed change

here's an example of playing with particles as the object changes the speed as mention'd above in detail ))





enjoy! particling

:p
Attached Files
File Type: ma emitparticle.ma (61.1 KB, 97 views)
__________________
Learn the Rules|Then|
Burn the Rules Book
mind_raper is offline   Reply With Quote
Old 13-07-2006, 11:31 PM   #57
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

a very beautiful effect. im just learning about particles now and that is one hell of a good look.
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 25-11-2006, 12:25 PM   #58
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

hey this is simply maya, not 'my space' drop the porn, be a good boy!
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 22-05-2008, 07:22 PM   #59
RaginRob
Registered User
 
Join Date: May 2008
Location: Europe (Germany)
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Default how to make object-dependent collision effects

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;
    if( $index != -1 )
    { 
    	string $geoC[] = `listConnections particleShape1.collisionGeometry[$index]`;
    	string $shape[] = `listConnections ( $geoC[0] + ".localGeometry" )`;
    	
    	if ($shape[0] == "cube_A") 
    		{
    		particleShape1.rgbPP = <<1,0,0>>;
    		}
    	if ($shape[0] == "cube_B") 
    		{
    		particleShape1.lifespanPP=0;
    		}
    }
Important: You have to set the lifespan mode to "lifespanPP only" under Attribute Editor --> particleShape1 --> Lifespan Attributes.

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!
Attached Files
File Type: mb collisions.mb (0, 11 views)
RaginRob is offline   Reply With Quote
The Following User Says Thank You to RaginRob For This Useful Post:
Old 14-09-2012, 04:13 PM   #60
David
SM Site Programmer
 
David's Avatar
 
Join Date: Apr 2002
Posts: 2,991
Thanks: 49
Thanked 385 Times in 300 Posts
Default

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
__________________
Worst Response To A Crisis:
From a readers' Q and A column in TV GUIDE: "If we get involved in a nuclear war, would the electromagnetic pulses from exploding bombs damage my videotapes?"
David is offline   Reply With Quote
The Following 3 Users Say Thank You to David For This Useful Post:
joverall22 (14-09-2012), lxhtin (04-11-2012)
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting / importing expressions djb123 Technical Issues 2 11-04-2012 12:52 AM

Thread Tools





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.