PDA

View Full Version : Spawning percentage of particles


bandini
05-17-2006, 07:46 AM
I'm sure this is simple, but I can't quite figure it out...

I have a particle system that is spawning particles. I would only like a certain percentage (let's say 7%) to spawn particles. I know how to make all the particles spawn, but I'm not sure how to make only 7% of the original particles spawn.

Can anyone help me out?

paulselhi
05-17-2006, 08:49 AM
There is an example in this thread..i think you read this thread before but missed the file

http://forums.cgsociety.org/showthread.php?t=355124&page=2&pp=15

ChrisCousins
05-18-2006, 01:53 AM
I'm sure this is simple, but I can't quite figure it out...

I have a particle system that is spawning particles. I would only like a certain percentage (let's say 7%) to spawn particles. I know how to make all the particles spawn, but I'm not sure how to make only 7% of the original particles spawn.

Can anyone help me out?

Hi bandini - here's a file that does the job. Not sure it's the best way though, so if anyone else wants to jump in they're most welcome.

Pretty simple setup - basically the particle is assigned one of two groups at birth, depending on a random number. Trouble is that the random number is calculated once per frame, so however I set this up you always end up with 'bursts' of emitters and then none. You can hide this with speed variations but it's not ideal.

Hope this helps anyway.

Cheers - Chris

bandini
05-18-2006, 03:25 AM
Thank you Paul and Chris.

I had seen that example in the other thread, but I had problems with the clumping Chris described. I wanted to see if there was another solution, or a way to get rid of the clumping without changing the velocity of the particles.

It would be really great if there was a percentage value built into the PPass node. It would make these types of operations so much simpler.

paulselhi
05-18-2006, 06:14 AM
The clumping is a sub frmae issue ( or lack of sf sampling )


here are some ideas that were given to me :

from darf:

One solution is to utilize the TP 'DT Factor' data channel. It is used to scale the delta time evaluation between frame sampling. It defaults to 1 ( 100% ), setting it to 0.1 makes the particles evaluate ten times slower, setting it to 10 makes the particles evaluate ten times faster, etc... It has to be set per particle I beleive ( is there a global setting? I do not know for sure ). Have to look. Very easy way to do bullet time like effects.


Srek suggest a slight velocity and distance variation, by varying the distance he means to vary the distance from the emitter at birth, helps to stagger particles
Apparently core particles velocity node can help..not tried it

bandini
05-18-2006, 08:27 AM
Paul, you would definitely know better than I do about the subframe sampling issue. But, I can tell you that increasing the frame rate does not solve the problem (I increased to 90fps to see if that fixed it). I don't think messing around with the DT Factor will fix it either.

I've taken Chris' file and stipped it down - setting the FOV and Angle values to zero to better show the clumping problem. Red particles are the original particles. Green are the particles that have been passed to group 2.

JPEG example is here... (http://www.adamswaab.com/cgtalk/percentage_split_render.jpg)

I'm not sure what to do about this, as this is definitely not the random look one would want.

Also, the reason I'm using this example is because I am trying to do something very close to this... Particles in a straight line, constant velocity, but some randomization based on belonging to different groups.

Srek
05-18-2006, 08:31 AM
I don't think this is solvable without seeing your setup/scene.
If you want to place particles randomly in different groups on creation then just use a random node with the particles seed value and determine the group depending on the return value.
Cheers
Björn

bandini
05-18-2006, 08:39 AM
I don't think this is solvable without seeing your setup/scene.

Set-up scene is here (http://www.adamswaab.com/cgtalk/splitter_01_as.c4d). Like I said, this is Chris's scene. I just stripped it of the excess stuff.

If you want to place particles randomly in different groups on creation then just use a random node with the particles seed value and determine the group depending on the return value.
Cheers
Björn

I'm new to the TP/Xpresso world, as you can probably tell, so I have to take some time to figure out what that means :)

I've got to get some sleep, but I'll try to work with that suggestion tomorrow.

Oh yeah, if it helps, here is what I am trying to do:

I've created a simple system where I am using Cappucino to record my pen strokes in real-time to spray-paint on 3D geometry. I am trying to get a certain random percentage of the spray-painted particles to emit other particles to create drips. Clumping would produce unnnatural results here.

You can see a test here (http://www.adamswaab.com/mograph/spray_paint_02.mov)

ChrisCousins
05-18-2006, 08:41 AM
The clumping is a sub frame issue ( or lack of sf sampling )

The thing is, even with sub-frame sampling this would still be a problem as the problem occurs because we're using one random number to affect a bunch of particles. No amount of depth will change this. Sub-frames would help where, say, fast moving particles fly straight through a wall rather than deflect like they should, because the distance travelled between frames is too great.

Thinking about this after a sleeping the answer is suddenly laughably simple - use two emitters with linked rates. Doh. Not the most elegant solution, but whatever works is fine... See attached ;)

Cheers - C

Edit - just seen Srek's response, plugging the birth number into the random seed also works...

Srek
05-18-2006, 09:21 AM
The problem in the setup is that the seed is not changed. Just use a PGetData node, read the random seed from the particle and feed it in the random node.
Currently several different particles get the same random value instead of different.
Cheers
Björn

ChrisCousins
05-18-2006, 11:56 AM
Thanks Björn - just to add to this, to make the setup work make sure you set the 'mode' of the random node to 'Free', not time. Foxed me for a minute...

C

The problem in the setup is that the seed is not changed. Just use a PGetData node, read the random seed from the particle and feed it in the random node.
Currently several different particles get the same random value instead of different.
Cheers
Björn

bandini
05-19-2006, 08:36 AM
Hey guys, Those are both really great solutions, and thank you very much for helping out here. For my purposes, I think the answer lies between the two (or three) solutions described in this thread.

I do have one question about Bjorn's solution. Setting random value to free does make this work correctly, but the results are not repeatable that way. In other words, the sequence of particles will never play back the same way twice.

I don't expect you to do all my heavy lifting for me, but pointing me in the right direction was very helpful, and I should be able to manage a solution now.

Thanks!

Srek
05-19-2006, 08:47 AM
I haven't tried that, but maybe using a noise instead of random node will fix your problem.

Cheers
Björn

CGTalk Moderation
05-19-2006, 08:47 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.