You can set the shader effect in the spritebatch itself, no need to apply the shaders yourself. Just set up all the parameters up front and you are good to go.
Maybe a bit visual helps.
I have multiple layers with different depth-
like 5 rendertargets foreach layer of the map,+ 1 normalRendertarget foreach of it(For lightning effect)
Character,Torches has its own depth.
My current solution, wich i come up with, was like 5 additional rendertargets,where save the result and draw it in a second step to the screen with its depth.
So each time you really draw the SpriteBatch by calling SpriteBatch.End() the whole batch gets drawn the way you specified when calling SpriteBatch.Begin(). If you specified an order and provided layer-depth for each sprite, then they get sorted in the SpriteBatcher. If you specified an effect there, then it gets used at that moment and for all of the batched sprites. So you could do more batches and apply the effect appropriately.
You cannot specify an effect for a sub-set of already batched sprites. If you want to do that you’ll have to split your batch.
MapObjects like torches work the same way.(Statues not seen on pic are made of four parts each higher depth value)
Player can be behind and in front, just like the pillars.
I draw it all between one spriteBatch.Begin(…); and one spriteBatch.End(); with rendertarget stuff before that
Hope you got an idea what happens in my “game”.
Its my very first project that got something bigger…
My newbie way works somehow…
Cant be that wrong.
I am not sure what your idea were. A batch for each layer? but everything has its normal(layers/mapobjects/player),too.
I am confused.
Its me ,not you.
Thanks read it all. Very interesting the part with the “depth buffer” approach, seems good.
I believe, i use what they called “painters alogrithm”, what is fine for my needs i guess.