[.net] Particle Systems in C#. (Optimizations)

Started by
12 comments, last by tIVO 14 years, 8 months ago
they mention only in passing a particle system used to render clothing.
the work they just poo poo in refrence is actually insanely cool. real time particles (bound with 'spring' models to each neighbor) is calculated in real time versus the structure the cloth is wrapped around and then the particles are used as the geometry of the clothing. all in real time AS the character that the clothing is on moves. sweet.
Smile, it won't let you live longer, but it is funny when they die with a smile.
Advertisement
I know this topic is pretty old, but if you're looking for a particle system framework to use instead of creating your own, check out DPSF (Dynamic Particle System Framework) at http://dpsf.danskingdom.com. It's for creating particle systems in C# and XNA.
-Dan- Can't never could do anything | DansKingdom.com | Dynamic Particle System Framework for XNA
Another one is Flint Sharp
Well i have some experience of optimicing particle system. tho under c++

But some of my optimisations should work under c#

to start, allocate as large buffers you will need(and hold them in memmory as long you can so you dont need to realocate em). (one big for each system is fine enough) when a particle dies i make a mem copy of the last particle that is alive in the array to the place were the particle died. this is done bacause scatred memmory reads is expensiv.

You can also look at how the data is stored and used in your system and move data around so you get fewer cach misses.

and when you got all the particles updated. allocate a particle buffer you can send to the GPU and make it as big so it can hold all living particles.(do this when you have all the systems up and not frame by frame) and then make a copy of all living particles and stack them together in one big particle buffer. and send all systems to GPU in one draw call.

and if you have shaders to play with. then it is possible to make pointsprits with a texture atlas. thou you cant send x.y coords throu the color register for example and re calc UV coords in the pixel shader. but be aware you cant use texture coord register. pointsprites override the UV coords. then if you have different textures you can minize the draw calls.

Dont know if all this works in C# but the last part shall work just fine.

Best regards Jesper

Ps. sorry fot the spelling was at work and took my break to awnser you Ds.
.-`´- Jesper Lirbank -`´-.

This topic is closed to new replies.

Advertisement