This my main draw call:
Matrix Camera_transformation = player_camera_.GetTransformation();
// Background - AlphaBlend
spritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera_transformation);
background_.Draw(spritebatch);
spritebatch.End();
// Particles (of a player power, I want them behind him!) - Additive
spritebatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, Camera_transformation);
player_.DrawParticles(spritebatch);
spritebatch.End();
// Player - Alpha Blend
spritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera_transformation);
player_.Draw(spritebatch);
spritebatch.End();
// Hub/Ui - Not to be influenced by the camera, but always on top
spriteBatch.Begin();
UI.Draw(spritebatch)
spriteBatch.End();
Is there a way to reduce the number of calls here? If my particle system didn't need an additive drawing, I would have merged the first three calls, but I can't. Is there something I am missing about spritebatch ordering?
SpriteBatch
internals go. – Andrew Russell May 22 '14 at 02:56SpriteBatch
(providing every particle you draw uses a single texture - see here). To improve performance, you have to go beyondSpriteBatch
. If the CPU is slowing you down (and it probably is), perhaps you need to offload onto the GPU (rough example here). – Andrew Russell May 22 '14 at 06:48