Reputation: 4273
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();
Upvotes: 1
Views: 1080
Reputation: 498
Basically, you have 2 options:
I won't explain this in detail because both ways are explained extensively at this question of the gamedev stackexchange.
Upvotes: 1