PDA

View Full Version : RadiusPP


tempo3d
04-21-2007, 08:35 PM
I want to make blobby particles to be very tiny at the moment of birth (let's say random number between 0.1 and 1 units). So I wrote a creation expression:

particlesShape.radiusPP = rand (0.1, 1.0);

After particles were born I would like to gradually increase particle radius within first 30 frames, but to keep their sizes different. So at frame 31 (after particles rich their maximum radius) I would like the radius range to be between 20 and 45 units.
I understand that I need to write Runtime expression...

tempo3d
04-21-2007, 09:01 PM
Ok, I couldn't figure out how to control the maximum radius for individual particle taking into the account that particle radius at the moment of birth. But I ended up with simple runtime expression that looks like this:

if (frame <= 30)

particlesShape.radiusPP = particlesShape.radiusPP * 1.1;

The rest is just to find multiplier for radiusPP wich is currently 1.1
It would be great if I could control the maximum particle size based on percentage of radius at the moment of birth. So IF statement would be something like:

if (frame <= 30 || particlesShape.radiusPP <= 400% of the size it was born)
.....

Als
04-22-2007, 05:53 PM
Create another attribute per particle, and in creation expression give it random value as you wanted so for example
maxRadPP = rand (20,45)
and make start value as value in similar fashion so something like
minRadPP = rand ( .1, 1)

and then make some runtime expression like:
radiusPP = smoothstep ( 1, 31, frame) * ( maxRadPP - minRadPP);



Als

Xsiv
04-24-2007, 07:37 PM
Ok, I couldn't figure out how to control the maximum radius for individual particle taking into the account that particle radius at the moment of birth. But I ended up with simple runtime expression that looks like this:
....



You can control the max particle radius based on the relative size of the particle at the moment of birth, by taking the percentage of the size of each particle as they are born, relative to the MAX size they can be.

You need to create new PP attrs - or variables, whichever you prefer:

radiusNewSize = rand(20,40);
random_radius = (0.1,1.0); //gives a random radius (Rmin,Rmax)
radRelativeSize = random_radius/1.0; //random_radius/Rmax which gives you the percent size of the particle

now, you have to figure out how long into the particle's life 31 frames is...
do you know?
Otherwise, if the event you are going for, always happens at frame 31, then it is like this:

if (frame >= 31)
radiusPP = radiusNewSize * radRelativeSize * radiusPP;
else
radiusPP = random_radius * radRelativeSize * radiusPP;

Have fun...

alexx
04-25-2007, 08:26 AM
a quite easy solution for what you need is using a PP creation expression and a ramp:

create a PP attribute called: initScalePP
give it a creation expression like: initScalePP = rand(20, 45);

now create a PP ramp: rampScalePP

create a runtime expression:
radiusPP = initScalePP * rampScalePP;


with the ramp you can no control the overal size and the particles still are randomly sized.

cheers

alex

CGTalk Moderation
04-25-2007, 08:26 AM
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.