Performance of pixel shaders vs. SpriteBatch: XNA
- by ashes999
Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite.
I need to do something like that. I also have a 2D lighting PoC which I need to write. The way it will work will basically be something like:
Draw all the sprites
Draw lighting gradients to create a lighting texture
Multiply/add the lighting texture to achieve different effects
(I use multiple passes of add/multiply the lighting texture to achieve different effects.)
My question is really about a generalization: can I say with certainty that pixel shaders are always faster than adding/multiplying textures to the SpriteBatch? Or that adding/multiplying is always faster? Or if it's not generalizable, how do I decide which approach to take, given that I can probably code either of them?
(If it matters, I'm using MonoGame 3.0 beta for Windows games)