weird n-particle issues


#1

Hello All,

I was trying out a script its so simple,

I want a grid of n-particles which is given with an expression on speed and lifespanPP

I want those n-particles should die whose speed is greater than 1 .

so ,I simply created the speed a float variable and assign the Mag(particleShape1.velocity)

so it would be easy for me to check the numeric mode of velocity in integer value ok,

I simply used if statement to run the statement and it is working fine with classic particles.

that is only those particles are dying whose speed is greater than 1 after assigning the turbulence field with volume type.I also enabled secondary particles from first one(grid) and used if speed is greater than one then based on per-point emission rate let the rate is multiplied by speed.So with that I can have only those particles emitting secondary ones that are having speed and rest should not emit any secondary.

to let the first particles which are having speed,they must also die for those i prepared the lifespanepp = 1 or 2 . but this is not working with n-particles but perfect with classic particles.

so my question is why is it working fine with classic particle but Why not with N-particles.


#2

The order of evaluation can cause problems when emitting from one nParticle to another due to the common nucleus node. A simple workaround is to assign a different nucleus node to the second nParticle system. If you need the two systems to collide with each other, however, then a different workaround can be to change the order… emit from B into A instead of A into B.


#3

All right Thanks Mr.Duncan so kind of you.

U know I am stuck in a situation,What i want is I had created the baked simulation of n-cloth paper destruction,everything is ok .I want to goal the particle1 on to that, for that I have UV-sets and the particles are also responding to goal.

Sir,My question is I have created an expression of Velocity which is per-particle and this is Magnitude of velocity.This is easy for me to see the numeric type velocity of goal particles.

Now What I want is Duncan.The particle1 is given with another set of particle emission from particle1 and using per-point emission rates.

I am using a script if particle1Shape.speed >1 ,particle1Shape.emitter2RatePP = speed.

else the particle1Shape.emitter2RatePP = 0;

with this duncan I want only those goal particles to emit second particles which are actually in motion.

But my problem is that I am not able to make particle1 to die out.I dont want a consistent emission or I want to stop the emission of second particle quickly.

N-cloth torn faces are taking long time to settle.

So whats the work-around to let the first particle die lets say after 2 seconds of velocity expression. :rolleyes:


#4

So you want the first particle to only emit for 2 seconds after the first moment it emits?

One could create a per particle attribute called something like “emitStartTime”, then initialize it to -1 in a particle creation expression. In your runtime expression do something like:

if( particle1Shape.speed >1){
… (emit)
if( emitstartTime == -1 ){
emitStartTime = time;
} else if( time - emitStartTime > 2.0 ){
lifespanPP = -1; //kill particle
}
}

I’ve not tested it but I think it should work OK.
An alternative might be to emit a fixed number of particles… you could create a per particle attribute called something like numEmitted. Initialize it to zero in the creation expression and increment it when you emit a particle then if it is greater than then some maximum count kill the particle.


#5

Hello Mr.Duncan.

Thanks for your reply.

Well I am also doing one thing wrong.I am making a lifespanpp for all the particle grid that is generated in first frame,so obviously if in the expression one is writing

if(particleShape1.speed>1)
{
particleShape1.lifespanPP = 1;

particleShape1.emitter1RatePP = 50;
}
else
{
particleShape1.emitter1RatePP = 0;
};

so when i was introducing a turbulence volume shape field,which was touching the initial half way particles it was working fine till 24 frames and after that the emission of per points was stopped. but I will surely try your method. and thanks a lot sir for yours reply.I will look forward to talk to you More.


#6

Your expression sets the particle lifespan to 1 second or 24 frames. If you set it instead it to -1 it will kill the particle that frame. Also I assume you are setting “speed” to something like “mag( velocity )”.


#7

Yes Sir,U are right I am using the speed = mag(velocity).

My situation is I have cached n-cloth simulation which is undergoing tearing.The first particles are created from cache mesh using emit from surface and gave goalPP bcoz i want the first particles to move along with the cache mesh (or simply saying with the position of vertices of mesh) which goalpp is just doing fine.

Now the effect which i want , first particle which are moving with cache mesh should emit some particles,this I had achieved with using per-point emission rates.

now, Sir my problem is I have to make first particle die let say they survive for only 1 sec or 24 frames or 2 sec, i dont wants to emit consistent secondary particles from per-point emission rates and have to make first particle die.

I am unable to achieve that with using speed = mag(velocity).

Since I want only when first particle is in motion only then it should emit second particles,when first particle is at rest or say no velocitypp no emission of secondary particles. but after few frames I want to first particle to stop emitting second particles.

I hope,if you have better solution to tackle it. kindly enlighten my path .

and Thanks a lot Mr.Duncan.


#8

The technique I first described should do what you want… kill the emitter particles a fixed time after they start emitting. I’m not sure exactly what your problem is, but for good emission control I usually use the emit command in an expression rather than emit from object when control is needed. This way you could do things like have more particles emitted when the particle is moving faster, for example:


float $emitRate =1.0;
float $emitSpeed = 1.0;
int $numParticles = particleShape1.speed * $rate + rand(1.0.);
int $i;
vector $p = particleShape1.position;
for( $i = 0;$i < $numParticles; $i++ ){
    float $vx = $emitSpeed *( rand(1.0)-0.5);
    float $vy = $emitSpeed *( rand(1.0)-0.5);
    float $vz = $emitSpeed *( rand(1.0)-0.5);
    emit -o particleShape2
           -pos ($p.x) ($p.y) ($p.z)
           -at "velocity" -vv $vx $vy $vz;
}

#9

Thanks A lot Sir Duncan,I will send you the final result.

Thanks for your time and really appreciate your kind answers. :keenly: