Particles or what ?

Hi there,
finally, I need my particles system (like many of us)

I read and see some addons around that but because I want to keep this very dedicated to my purpose, I’d like to code my own system.

I’d like to be able to make something I could reuse in many cases, but I know this won’t be probably possible.

I’m using max6 a lot for almost everything, but I feel the OF way as being more convenient for this particular purpose.
I also watched some performances made with particules systems done with Processing and I was also very amazed by the result!

Anyway, OF seems my way here.

I’d like to be able to use my system:

  • to use attractors especially (deflectors too probably)
  • to visualize points but maybe other stuff (billboard / quads from a texture?)
  • to be able to use some glowing, some trails maybe but very few (I’m a minimalistic dude)
  • to be able to control position of my particles . I guess via attractors only it can be nice. But with some randomized proper behavior parameters for each particles (or at least for some 3 or 4 global types of particles in my system…)

The question is about the way.
I used to make things with “big arrays” of objects. Storing particles positions, velocities, damping for each etc BUT I know that wouldn’t be the best way. I guess this one is the famous vertex arrays of the eternal “vertex arrays VS Vbo stuff”

My quickstart purpose is:
make a basic architecture and understand each part of it.

Would someone give me the different elements I need for this ?
Is there an addon or some addons to handle each part of my stuff ? I mean the shader parts (vert & frag)? the particles handling (attractors, deflectors or whatever) ?

I can code things by myself but mods an already system would be faster.

memo has a nice example of the various ways you can implement particles http://www.memo.tv/archive/vertex-arrays-vbos-and-point-sprites-with-openframeworks-006

He also has an example using opencl, but I dont know where the source is for that (its somewhere, maybe in his opencl addon i just havent really looked). The advantage of opencl is you get a bit more freedom about what you can look at/update vs opengl shaders, in which you can only really work on the vertex/point at hand. If you are just getting started with shaders etc its probably overkill.

Collision detection on a gpu is tricky to implement. But if you just want a lots of particles floating around looking cool they are a great way to do it. Take a look in the examples that are in the examples folder, they have gpu particles, fbo trails, billboarding, lots of gems in there.

For attractors/deflectors you can always define them implicitly, so you have some function that takes the current particles coordinates, the coords of the attractor perhaps passed in as a uniform and returns some resulting force value which is the amount of attraction/deflection.

Generating noise on the gpu is quite slow in my experience. You are better off generating noise on the cpu and passing accessing in the shader via a texture.

thanks a lot for your answer pants.

I’d explore openCL a bit later. I don’t know which parameters we can control with openCL that we cannot in openGL shaders.

For now, I’d like to go more into things like Antoine’s stuff : https://vimeo.com/49065256
especially, I like the beginning, hen 1:07 & 1:34 seems like attractors are lines or I don’t know.

nice way in trail in fbo trails . it is exactly the way i smooth things in “Uncommon Circles” my latest project.
It is a very minimal-project. no particle. only basic drawing and reactive stuff fitting my bleeps

http://vimeo.com/66952253

especially here:
http://vimeo.com/67296590

I need to know more about controlling attractors :slight_smile:
Do you suggest to go directly to openCL anyway ? or basic shaders could be “enough to start” ?

I used kyle’s quadtree implementation as a base
http://forum.openframeworks.cc/t/quadtree-particle-system/2860/0

starting from it, I used these particles systems for:

  • particles handling itself,
  • attractor + repulsor handling too (using other very light particles systems for this)
    etc

works fine.
2D.

probably digging octree and 3D asap.
not sure about the benefits compared to ofxMSAPhysics addon

ofxMSAPhysics is the way to go too for 3D.

without inter particles collision detection with 1 attractor, 60fps for around 12k particles.
then, fps decrease a bit.

strange how the system handles attraction.
you have to explicit the influence of your attractor over all the other particles (or a subset)
indeed, that is powerful and can work fine with a couple of attractors controlled with external stuff too.

I have been slowly developing a general purpose particle addon, it has support for attractors and vector fields.

https://github.com/timscaffidi/ofxParticles

feel free to contribute code too if you have specific needs

hi tim,
I studied stuff a lot yesterday.
I guess I’d really need flocking more than anything (but I’m talking about an aesthetic point of view.

I summarized my research of previous days here:
http://cycling74.com/forums/topic/particles-ofprocessing-vs-max6/#post-252473

just tested it.
it is really nice

10k at 60fps
can we use it with more than one rotational stuff? multiple attractors ?
in my stuff, I don’t want emitter + murderer but only the same number of particles on the screen (in the system I mean, particles can be out of the screen and then re-attract by changing force intensity of an attractor for instance)
is that possible easily ?

no flocking, but VERY aesthetic.

My system was designed with particle life/emitters in mind. I haven’t gotten around to putting real support in for immortal particles yet, but it would be trivial. To disable particle aging just comment out the part where the particle life increases, or where old particles are destroyed, then just add one batch of particles in setup and you’re good to go.

Multiple attractors and rotators are definitely supported.

okay just tested.
that could be a nice system for me.
I’d need to add walls and other stuff.

I did that to make particles immortal:

I liked (and forked to fix an include problem here) ofxSteer:
https://github.com/gluon/ofxOpenSteer

flocking, obstacle avoidance and more stuff.

I don’t know if, finally, flows I’m talking about aren’t “just” consequences of obstacle avoidance.
I mean, aesthetically speaking, both would be the same visual effect

Very cool to see this happening. Always end up with a sloppy particle implementation due to time crunch but this seems like a much better way to go ! Thanks.

you mean OpenSteer ?