To start this out:I know all the math and stuff needed to create a particle system. It isn't very complicated and it isn't part of the question, so I'm just verifying that.

I plan to add a simple particle system to my (3D) engine that supports texturing, transformation, and additive blending, however I am not quite sure on how exactly to implement it graphics wise.I have a mesh class that simply holds a vbo and an ibo which get drawn to the screen. The mesh class also holds an array of Vertex (one of my classes. Contains the position, texCoord, normal, and tangent) and integers.

So should I use this class with a shader in order to draw everything somehow, or should I render them some other way, completely different from my mesh class?

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?

Sort array of vertices by distance from the camera (for correct blending), generate bill-board quads from your array of vertices, buffer the data into a dynamic VBO, render each sprite as a quad or two triangles. Your mesh would consist of VBOs for texture coordinates (and colours if required) as well as the quad vertices (or one inter-leaved VBO).

pros:- re-uses your existing mesh code.

cons:- over-head of having to orientate the quads to the camera.- need to provide texture coordinates but these are usually the same for every sprite hence redundant data.

The ibo is used so there aren't as many vertices needed overall but it would be trivial to make it optional.Thanks for the reply, I'll do a bit more research on it now.Also, when you say I can improve it using glsl you mean just rendering it with glsl correct? Because everything is rendered with shaders by default.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?

I've researched them before and they seem intriguing. What I got from it was that they give the ability to change the primitive rendering type OpenGL uses as well as edit certain other attributes of.. and yeah that's where my knowledge ends.

Google, here I come. If you have any good resources feel free to post them here too.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?

The information is out there, but what you can do with them is a bit harder to find. Basically you can draw your particles as "points" which have the attributes that you need: for example position, size, rotation and color. Then you can use a geometry shader to output 4 new vertices to form a quad, allowing you to do proper billboarding without transforming on the CPU (transform by view matrix first, expand to screen aligned quad, transform by projection matrix). You can also apply stuff like rotation and generate texture coordinates for each corner. Without geometry shaders you'd be forced to render the particles as quads with 4 vertices each, but a lot of this information is just data that's shared by all 4 vertices. For example there's no need to supply 4 positions when one position and a size is enough.

That's mind blowing. Wow that really is cool, thanks for elaborating!When you say transform by view matrix, then expand to screen aligned quad, the screen aligned part refers to bill boarding part right?

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org