Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 46 11-06-2004 , 08:09 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57
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
# 47 14-06-2004 , 09:52 AM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57
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
# 48 19-08-2004 , 07:19 PM
Registered User
Join Date: Aug 2004
Posts: 1
WoW, Pretty Good expressions~

# 49 16-12-2004 , 04:52 AM
Registered User
Join Date: Dec 2004
Posts: 1
Pretty Good expressions~

# 50 18-12-2004 , 06:09 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Holy cow Mind-raper!!!! GREAT posts bud!!!


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 51 15-01-2005 , 05:46 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

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


Learn the Rules|Then|
Burn the Rules Book
# 52 15-01-2005 , 06:13 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
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
# 53 06-06-2006 , 11:29 PM
joed8349's Avatar
Registered User
Join Date: Feb 2004
Posts: 261

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="https://euphrates.wpunj.edu/students/dimperioj" target = blank> My Website </a>
# 54 07-06-2006 , 09:21 AM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
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
# 55 13-07-2006 , 12:32 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57
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
# 56 13-07-2006 , 01:11 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

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





enjoy! particling user added image

:p

Attached Files
File Type: ma emitparticle.ma (61.1 KB, 1426 views)

Learn the Rules|Then|
Burn the Rules Book
# 57 13-07-2006 , 10:31 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
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
# 58 25-11-2006 , 12:25 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
hey this is simply maya, not 'my space' drop the porn, be a good boy!


take it easy and life will be easy
# 59 22-05-2008 , 06:22 PM
Registered User
Join Date: May 2008
Location: Europe (Germany)
Posts: 7

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)
# 60 14-09-2012 , 03:13 PM
David's Avatar
SM Tea Boy
Join Date: Apr 2002
Location: Prague
Posts: 3,228
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


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?"
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