• Advertisement
Sign in to follow this  

Particle engine - efficiency

This topic is 2901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i have little question. I am currently building particle engine, that can handle multiple particle emitors. I have question about effiency. Should I create for each particle system one effect, or should I rather use one global effect for all systems and set-up system settings in runtime (eg. send to shader in every frame gravity, wind, texture etc.) I mean it this:
struct ParticleSystem 
{
 public Particles[] particles;
 public VertexBuffer vb;
 public Matrix worldMatrix;
 public Settings systemSettings;
 public Effect fx;  //<-------------- use it this way ? or without it and have it global for all effects
}
And second question is about VertexBuffer. So far, I have 1 vertex buffer for each system. I personally think, that its better, then have one huge VertexBuffer for all systems together, beceause some of the systems can be updated only on GPU (no need of Dynamic VB), some need to be updated on CPU (because of collisions). And second of all, systems are added and removed in realtime. Is it good solution, or should i build it another way ? Engine Pseudo-Code
List of systems

AddSystem()
{
 init particles
 init VB and fill it with particles
 add system to List
}

RemoveSystem()
{
dispose VB, Texture
}

RenderAllSystem()
{
foreach iterate through all systems and render them // here are multiple VB not quite good solution
}

RenderSystem() //render one particular system - multiple VB are quite good for this
{
 set-up shader params like gravity, wind, view, projection etc. // need to set it up in every frame. Is better use one shader for each system, or one global and set things over and over again

render system

}

Thanks for your advice

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement