Thursday, June 23, 2011

Particles Update

Been a while. Quick outline of what I did since last time:
  • Added math to base processor so that particles can be drawn or expelled from a central gravity well.
  • Finished adding support for custom shaders (no more COMPILING after shader modifications!!)
  • Added more attributes and exposed them to shaders. Currently color is calculated based on particle's age and velocity. Size is likewise.
  • Figured out how to turn on aliased (circular) GL_POINTS
  • Turned on alpha blending
So not too much in all actuality...but it felt like a lot. Bunch'a pictures as well:



Thursday, June 16, 2011

Particle Madness!

Just a bunch of screens I grabbed today. Not much changed except for an optimization I made that doubled my frame rates. I was just sick of looking at 3 blocky particles.



500 Particles

VBOs and Vertex Array Objects

So I decided on using Vertex Buffer Objects (VBOS) to store the state information on each particle in my system. This should give me both a speed advantage as well as a simplicity advantage in the long run. I'd originally considered something akin to a complex Particle object to store information about each particle as well as siblings in a linked list of some sort. The downside to this is that the PC memory cache is not really optimized (read: at all) for things like linked lists where we're jumping all over the place between objects. A static (or in my case, semi-static) linear allocation of memory is far more efficient and ultimately makes certain things like multithreading a lot easier in the future.

Sunday, June 12, 2011

Starting a new project

Might as well keep using this to document my work on various things since it's already set up...


Currently working on a framework for particle systems. The basic idea I'm following is that particles can be done either all on the GPU or on the CPU with a bit of shader-based fanciness thrown into the mix to spice things up. After a lot of thought on the subject I've decided to, at least for the time being, go with door number 2. I'd like to design the system in such a way that individual packets of information representing each particle can be streamed through a "processor" of sorts which would churn through the data and write it back each frame with updates. Deferring these brains as I've been referring to them in my head so that they are singleton classes should aid in my ability to thread them and should also yield general speed boosts if all is done correctly.