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 29-09-2007, 04:22 PM   #1
Kartzan
Subscriber
 
Join Date: Oct 2005
Location: US of A
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default Particle Simulation (Very Technical, Need Help!)

Hey all,
I'm working on a project, a sort of partical simulation. Basically the goal is to have a surface emit particles that float downward toward a sphere that attracts all nearby particles within a certain radius.

That was the easy part, and its all finished.

The task at hand is to be able to change the attributes of the particles once they've entered a certain radius around the sphere. For example, a particle enters the gravitational field of the sphere, and as it does so, it change color from blue to red and begins to emit a soft glow, growing stronger as it nears the sphere.

I've been doing some research and it looks like I'm going to have to do some MEL scripting to set it up correctly, and unfortunately I dont know a damn thing about MEL aside from what i've read today. I'm planning on learning MEL because I'm going to obviously need it to complete my goals, but any help, tips, pointers, or anything that could help would be much appreciated.

Thanks everyone!!!
__________________
Death is certain, Life is not.
Kartzan is offline   Reply With Quote
Old 30-09-2007, 08:00 AM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I at work now so I don't have time to finish this. Anyway here's one way for that particle going from blue to red within a specified radius of an object (pSphere1 in this case). Just add rgpPP and a cusom scalar attribute called effectRadius (set it bigger than the radius of your sphere to see the effect better) to your particle shape and enter the following into your runtime after dynamics expression:

Code:
vector $vWPos = worldPosition;
vector $vSPos = <<pSphere1.translateX, pSphere1.translateY, pSphere1.translateZ>>;
float $fDistance = mag($vWPos - $vSPos);

float $fEffect = 0;
if($fDistance < effectRadius);
	$fEffect = 1 - linstep(0, effectRadius, $fDistance);

rgbPP = <<$fEffect, 0, 1 - $fEffect>>;
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 30-09-2007, 03:18 PM   #3
Kartzan
Subscriber
 
Join Date: Oct 2005
Location: US of A
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for the help! I'll give it a try tommorow and see how it work.
__________________
Death is certain, Life is not.
Kartzan is offline   Reply With Quote
Old 18-10-2007, 08:07 PM   #4
Kartzan
Subscriber
 
Join Date: Oct 2005
Location: US of A
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for the help!

However, I've been playing around with the expressions and I'm trying to get the particles to die now once they are inside the target sphere, and well, its not working the way I would like.

When I try it one way, the particles die before moving, and then the other way nothing happens. Its almost as if the particles have a world position of 0,0,0 when they are born.

Any thoughts?

Thanks again all!
__________________
Death is certain, Life is not.
Kartzan is offline   Reply With Quote
Old 18-10-2007, 08:21 PM   #5
Kartzan
Subscriber
 
Join Date: Oct 2005
Location: US of A
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Talking

Never mind, got it to work
__________________
Death is certain, Life is not.
Kartzan is offline   Reply With Quote
Old 20-10-2007, 04:15 PM   #6
Kartzan
Subscriber
 
Join Date: Oct 2005
Location: US of A
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, now for something a little more complicated...

To recap, there is a plane emitting particles downward toward the origin, where a sphere rests. This sphere attracts all nearby particles, and the particles that get close change color from blue to red.

My next goal is to make it so the surface of the sphere changes color as a particle nears it. I dont mean the entire sphere, I just mean a small localized region that is near the particle.

For example, I have a green sphere, and as a particle approaches it, I want the point on the surface of the sphere to glow orange gradually as the particle moves closer to the surface of the sphere.

Thanks all!
__________________
Death is certain, Life is not.
Kartzan is offline   Reply With Quote

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.