View Full Version : Particle Instancer rotation options...
shanshore 08-02-2006, 03:58 AM Hi.
Im using particle Instancer to make some leaves float on wind. I want to have good control of the rotation of these leaves. First i want the leaves to aim at the direction they travel. im using AimDirection as worldVelocity to acheive this.
Along with this i want the leaves to have random rotation. Is there any method / expression to do this.
I prefer using rotationPP as rotation in such a way that worldVelocity vector is converted as a rotation values rx, ry, rz.
thanks in advance.
|
|
drGonzo
08-02-2006, 08:22 AM
I didnt test this, but it should get you going.
Along with this i want the leaves to have random rotation.
//in creation
randRotPP = <<rand (0, 360), rand (0, 360), rand (0, 360)>>;
//in runtime
randRotPP+=1;
rotation in such a way that worldVelocity vector is converted as a rotation values
First add speedPP attribute
//in runtime
speedPP = mag (worldVelocity);
randRot*=speedPP;
walkerk19
08-04-2006, 03:54 PM
Hi,
I'm doing the same thing also with shansore. I tried the first code on the rotation and it works great! Thanks drGonzo!!
HUGE !!
Thx drGonzo , so useful , and clean ... :thumbsup:
But one question , how " drive " the "range" of velocity decay.
Because i tried our tips , with a confettis rain...
And it works well , but only on short time , very quickly the intancer stop to rotate...:curious:
I have already try with the speed or conserve , but nothing seems to work...
Thanks in advance.
And sorry for my english.
Jerome
drGonzo
05-09-2007, 08:18 PM
HUGE !!
But one question , how " drive " the "range" of velocity decay.
Jerome
You could use a linstep or smoothstep function for that. Have a look in the docs for the usage.
And it works well , but only on short time , very quickly the intancer stop to rotate...:curious:
Jerome
That is odd, because "+=" will add a avlue (1 in the example) to the rotation every frame. There might be something else wrong with your setup. If you can, post your expression and I will have a look.
hi ,
First thanks for your fast reply ..! ^^
So in fact , the " randRotPP+=1;" work very well .
Just when i add the : speedPP = mag (worldVelocity);
randRot*=speedPP;
The instancer rotation is too much quickly braked .. :sad:
So i have creat e a new attribut ( float ,PP ) , that i use for brake the rotation
In creation :
particleShape1.Rot_PP = << rand(0,360),rand(0,360),rand(0,360)>>;
particleShape1.VarRot = rand ( 9 ,11) ;
In Runtimes
particleShape1.VarRot*= 0.98;
particleShape1.Rot_PP += particleShape1.VarRot;
And it works not so bad...
Thanks again
Jerome
drGonzo
05-10-2007, 09:25 PM
hi ,
Just when i add the : speedPP = mag (worldVelocity);
randRot*=speedPP;
The instancer rotation is too much quickly braked .. :sad:
Jerome
What probably happens is that your particle slows down (=has less speed) and hence the rotation slows down as well. In my example, this is what I had in mind: the slower the particle goes, the slower it rotates, the faster it goes, the faster it rotates.
You could remedy this by adding a simple multiplier and conditional to the runtime expression:
speedPP = mag (worldVelocity);
if (speed < 10)
//10 being the lowest speed where you want
//the particle to keep rotating
randRot*=(speedPP*10);
else randRot*=(speedPP*2);
Or you could get funky and do stuff like this:
rotationPP = ageNormalized * speedPP * noise(particleId);
hi .
So thanks for your interest . ^^
In fact i need of this effect for make "a conffetis rain " , so the particles live forever and i can t use ageNormalized.
So i try to do as you said :
speedPP = mag (worldVelocity);
if (speed < 10)
//10 being the lowest speed where you want
//the particle to keep rotating
randRot*=(speedPP*10);
else randRot*=(speedPP*2);
But it works strangely , perhaps i do something wrong.:blush:
So i give you the .mb and my other scene with my preceding method.
Certainly you will find a better way . ^^ ;)
cheers
drGonzo
05-11-2007, 08:50 PM
I had a look at your scene. I don't know what efefct you are going for, but it looks fine to me.
Do you want the confetti's to spin more uniformly? Or faster/slower? Tell me what you need, but personally i like their random and erratic behaviour as it is now ;-)
Maya128
05-12-2007, 03:52 AM
if(particleShape1.particleId%7 == 0)
{
particleShape1.ro = <<0,108000*smoothstep(0,8,particleShape1.age),0>>;
particleShape1.ro = <<0,864000*(1-smoothstep(8,18,particleShape1.age)),0>>;
particleShape1.ro = <<0,3600*smoothstep(18,25,particleShape1.age),0>>;
particleShape1.ro = <<0,900*(1-smoothstep(25,30,particleShape1.age)),0>>;
}
else if(particleShape1.particleId%2 == 0)
{
particleShape1.ro = <<sin(time*6)*30*smoothstep(5,15,particleShape1.age),sin(time)*30*smoothstep(0,15,particleShape1.age),0>>;
particleShape1.ro = <<sin(time*6)*70*smoothstep(15,30,particleShape1.age),sin(time)*70*smoothstep(15,30,particleShape1.age),0>>;
}
else
{
particleShape1.ro = <<0,63200*smoothstep(0,15,particleShape1.age),0>>;
particleShape1.ro = <<sin(time*6)*50*smoothstep(15,30,particleShape1.age),10800*(1-smoothstep(15,30,particleShape1.age)),0>>;
}
Hi ,
Thanks for your reply !! ^^
In fact what i need to do , its a confettis rain , like the astronaut are back on earth ( Appolo 11 ).
And unfortunalty i not enough time , the time of production is very short , and the artistic director , like, like that ... :rolleyes:
So thanks again guys , for your invaluable assistance.. :thumbsup:
When I could , i will show you the final result.;)
See you
Jerome
Sorry for my english
CGTalk Moderation
05-16-2007, 08:48 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.