Performance of pixel shaders vs. SpriteBatch: XNA
Posted
by
ashes999
on Game Development
See other posts from Game Development
or by ashes999
Published on 2012-12-09T19:14:03Z
Indexed on
2012/12/10
5:20 UTC
Read the original article
Hit count: 488
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)
© Game Development or respective owner