Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Dynamics & Special Effects (https://simplymaya.com/forum/forumdisplay.php?f=33)
-   -   Particle Simulation (Very Technical, Need Help!) (https://simplymaya.com/forum/showthread.php?t=27643)

Kartzan 29-09-2007 03:22 PM

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!!!

kbrown 30-09-2007 07:00 AM

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>>;


Kartzan 30-09-2007 02:18 PM

Thanks a lot for the help! I'll give it a try tommorow and see how it work.

Kartzan 18-10-2007 07:07 PM

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!

Kartzan 18-10-2007 07:21 PM

Never mind, got it to work :D

Kartzan 20-10-2007 03:15 PM

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!


All times are GMT. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018