I have done something similar to this in monogame:
My question is, what would I have to do to draw that lighting effect only on the pillar and not the background ? Is there something like ignoring certain sprites when using BlendState.Additive ? How would that work ? Here is how i'm drawing it now.
//draw background spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque); spriteBatch.Draw(Background, Vector2.Zero, Color.White); spriteBatch.End(); //draw pillar spriteBatch.Begin(SpriteSortMode.Deferred); spriteBatch.Draw(Texture, new Rectangle(PillarX, PillarY, Width, Height), Color.White); spriteBatch.End(); //draw lighting sprite in additive mode spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive); spriteBatch.Draw(LightTexture, pos, null, Color.OrangeRed, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); spriteBatch.End();
Edit: Also, apart from the pillar I have as an example, I need to do that for 3D models as well, so would the Stencil Buffer work here ?