render particles (points) as polygons

livio's picture

Hi! I'm trying to play around with m.oostrick's particles engine. I attach a reduced patch with his engine.

The object outputs a structure of points. I'd need to visualise these points (particles) as polygons, triangles which head toward the direction their moving toward.

I also attach another composition (slightly modified from a cybero's composition) as an example of the kind of visualisation I'm looking for. Particularly, I'd like to maintain the direction the triangles "look toward".

What could I do? A OpenCL Kernel (or?) that would calculate 3 points around the particle? And then how to "fill" it?

Another issue is that I'm experiencing a strange behavior: when I move the mouse over the viewer window the particles move faster and fps get much higher.. weird.

As an alternative I'd keep working with Kineme particles engine (which can be visualized as I need) but I can't make the scene work as I would. I can't find any documentation about how to connect objects together and what all parameters are about. Does this documentation exists or should I just deduce what does what by blindly playing around?

Thank you for your help.

Cordially, Giorgio

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: render particles (points) as polygons

An imperfect answer might be to apply a point image outline as a texture to a Point Sprite Mesh Creator.

Then comes the matter of creating either a script & / or kernel to recreate the type of motion, pointing direction motion / appearance you're seeking as exemplified in your Kineme Particle based comp.

livio's picture
Re: render particles (points) as polygons

Hi Cybero, sorry but I can't understand :) what you mean by "apply a point image outline as a texture to a Point Sprite Mesh Creator"

About the kernel, why to recreate the type of motion? The motion is given by oostrik opencl engine and the look would be that from your composition.

Or the other way around, both ways are interesting. I'd like to go on with kineme particles engine as well but as I wrote it's hard without any documentation, how to make a flock of particles attracted to a point (mouse) for instance? can't figure that out..

So the kernel could be to calculate the direction of motion to be applied to polygons to be drawn by a renderer? If I use the mesh renderer what type of points structure should I pass it to make those polygons?

Thanks, sorry for my dumbness about particles engines and polygons renderers :)

cybero's picture
Re: render particles (points) as polygons

OK , I meant and was working along the lines of create a triangular shape.

__kernel void triangle(float Width, float Height, __global float4 *Vertices, __global float4 *Normals, __global float2 *UVs)
   float w2 = Width/2;
   float h2 = Height/2;
   Vertices[0] = (float4)(-w2,  h2, 0., 1.);
   Vertices[1] = (float4)(-w2, -h2, 0., 1.);
   Vertices[2] = (float4)( w2,  h2, 0., 1.);
   Normals[0] = Normals[1] = Normals[2] = (float4)(0., 0., 1., 0.);
   UVs[0] = (float2)(0., 1.);
   UVs[1] = (float2)(0., 0.);
   UVs[2] = (float2)(1., 1.);

which, reading your adherence to m.oostrik's brilliant boids OpenCL engine for motion is pointing into a direction that interests me and doesn't serve you.

This kernel would be RII'd and fed into the Mesh Creator patch or re-assembled via a set mesh [texture] route to the particles vertices & colours structure fed Mesh Creator patch.