PDA

View Full Version : particle size based on lifespan


cowboy71
03-18-2010, 05:57 PM
Ok, there was an old thread about this awhile back, and from what I gathered from it was the particle radius was increasing on lifespan. Here is the code that was used.

particleShape1.radiusInc = rand (.0001,.00015);
particleShape1.radius = rand(.5,.6);

Here is what I'm trying to achieve. I created some fountains in RealFlow and just imported the particles into maya. I would like to try and have them disipate on their way down, which I would think having the radius decrease would do the trick. I'm just not sure how to achieve this, and also achieve this when the particles are on their way down.

thanks for any help.

mandark1011
03-18-2010, 07:40 PM
im not sure if you can change the particles once you have imported them from RF.
If they are straight maya partciles tho write this code or something similar.
//creation
randInc = rand(.0001,.005);
radiusPP = rand(.5,1);
//runtime
radiusPP -= radInc;
if(radiusPP <=0)
lifespanPP = 0;

that should slowly shrink the radius of your particles then when they reach a 0 radius kill them.

good luck

cowboy71
03-18-2010, 08:27 PM
ok, so I have included a link a few screen shots of what is happening. The particles are decreasing in size which is nice, but not over time. You can see the two numbers I use in the expression to increase and decrease the size. I'm not sure what I'm doing wrong.
http://www.sixshotdesign.com/client/fountains.jpg

Thanks again.

Aikiman
03-18-2010, 08:41 PM
If they are not decreasing over time then how are they decreasing at all? Do you mean lifespan instead? Make sure lifespanPP is 'on'. The above code ought to work as particles get to zero they will die. If you actually want your particles to get smaller over lifespan and die at lifespanPP you use a linstep function.

BTW you have a screen shot of creation only.

efecto
03-18-2010, 08:44 PM
In runtime


particleShape1.radiusPP = particleShape1.radiusPP * (1-(particleShape1.age/particleShape1.lifespanPP));

mandark1011
03-18-2010, 09:20 PM
your expressions are just in creation...you need to use runtime as well

cowboy71
03-18-2010, 10:49 PM
sorry if I wasn't clear about things. Trying to wrap my head around expressions, still kinda new, very new.
I did have this on (runtime -
particleShape1.radiusPP = particleShape1.radiusPP * (1-(particleShape1.age/particleShape1.lifespanPP));

when I do a sim the particles either stay large or stay small when i run the sim in maya. All I did was change the creation numbers a bit. Those screenshots are what the particles look like throughout the simulation when I run it in maya.
Also, does the above code reside in both runtimes?

thanks

Aikiman
03-18-2010, 11:38 PM
Have a closer look at mandarks post.



//creation
randInc = rand(.0001,.005);
radiusPP = rand(.5,1);

//runtime
radiusPP -= radInc;
if(radiusPP <=0)
lifespanPP = 0;

cowboy71
03-19-2010, 12:02 AM
I pretty much just pasted his code right in, but changed the randInc and radInc to my custom attribute radiusInc. Was this not right? Also I did put the top portion in creation and the bottom in both runtimes. runtime beforeDynamics and after.
So I guess I'm just not understanding something. I do want to have the particles slowly decrease in size over time, but is this possible at a certain point like when the particles start to drop?

Aikiman
03-19-2010, 12:47 AM
Looks like there is a syntax error in Mandarks code radInc should be randInc. But if you have created a custom attribute thats fine too, make sure its a per particle float attribute. Also make sure you load up radiusPP

"is this possible at a certain point like when the particles start to drop?"

Yes you can query your velocity in Y to activate your runtime expression.


vector $vel = velocity;
if ($vel.y < 0)
{
runtime code here
}

cowboy71
03-19-2010, 12:57 AM
awesome! I will give this stuff another shot this evening.
Thanks so much for the help.

cowboy71
03-19-2010, 06:30 PM
Well, I tried and tried again with getting those particles to decrease in size on the way down, but nothing came about. I feel like this is key with getting these water bursts to look correct, but I'm running out of time with them. Might just have to fake it for now. I can upload the file if anyone wants to take a peek, but it would come with a sequence from RF so the file would be a bit heavy.
Anyway, I appreciate all the help, and maybe it's something I will come back to later with a better understanding of code.

CGTalk Moderation
03-19-2010, 06:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.