sources for particle systems glsl shader

e_fe's picture

Hello guys! I have been trying to design a particle system using glsl. I am basically lost, so i was wondering if any of the gurus can point me sources that i can get online to study. appreciated! Emmanuel

toneburst's picture
Re: sources for particle systems glsl shader

Hiya,

not sure you can do a particle system purely in GLSL. You need to store the properties of each particle somehow, and GLSL on it's own doesn't let you do that, as far as I know. There are ways of using GLSL shaders as part of particle systems, but there is other backend stuff involved that I'm not sure you can do in Quartz Composer, at least not efficiently. I may be wrong though, as it's not something I've ever tried. You could try having a look in the GLSL Orange Book. There's a particle system outlined in there which is also implemented in Apple's 'GLSL Showpiece' example project.

Hope this helps.

a|x http://machinesdontcare.wordpress.com

cwright's picture
Re: sources for particle systems glsl shader

GLSL by itself can't really do particle systems. You can kinda do them if you have access to transform feedback and vertex attributes, but those aren't available in QC.

OpenCL can help you out here. Or, if you're in Leopard, use Javascript (and cry at the terrible performance :()

toneburst's picture
Re: sources for particle systems glsl shader

cwright wrote:
OpenCL can help you out here.

And cry at the crashes... ;)

a|x

e_fe's picture
Re: sources for particle systems glsl shader

Thank you guys. Yeah I was suspicious that particle systems cannot be attained completely by pure shading. Yeah, i think that i will go openCL, even though is really unstable. Emmanuel

toneburst's picture
Re: sources for particle systems glsl shader

Let us know how you get on with this. I'd be really interested, as I'm thinking along similar lines myself.

a|x http://machinesdontcare.wordpress.com

gtoledo3's picture
Re: sources for particle systems glsl shader

One can use an iterator and queue with a GLSL Grid and appropriate Shader while manipulating the texture parameters on the GLSL, to wind up with something akin to the N-body example. I don't have an example that I can share handy. This probably sounds lame and not like a real particle system, but it can yield some great looks.

gtoledo3's picture
Re: sources for particle systems glsl shader

dbl post

e_fe's picture
Re: sources for particle systems glsl shader

Yeah, that can be an option. The main problem I experience when i work with node-type of programs is how they tend to handle big masses of objects. When you work with OOP like processing you can write a class and then invoke a huge stockpile of instances, then control their behaving from a main function. I am not an expert in quartz(quite the opposite) but i haven't seen an efficient way to generate several copies of an object(the iterator seems to be cpu expensive). Is there an efficient way to 'script' several instances inside qtz?

I think that would be the best starting point and then add a shader for certain properties within the 'mass'.

Thank you

Emmanuel

toneburst's picture
Re: sources for particle systems glsl shader

The Iterator is the best way of achieving that. It's conceptually similar to Processing's OOP method, but somewhat counterintuitive until you get used to it. I think some improvements have been made in the performance of the Iterator in QC 4.x.

It's also worth noting that you can massively cut down the number of nodes (or 'Patches', in QC terminology) by using the programming patches (JavaScript, Core Image Filter, GLSL, and now OpenCL) to create complex logic or chains of filters etc. without ending up with noodle overload.

a|x