我在Monogame中做了类似的事情:


我的问题是,我要做什么才能把照明效果仅仅画在柱上,而不是背景上?在使用BlendState.Additive时,是否有类似于忽略某些精灵的东西?那该怎么做?我现在就是这样画的。
//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(); 发布于 2015-02-09 19:15:39
基本上,你有两个选择:
我不会详细解释这一点,因为这两种方法在gamedev stackexchange的this question上都有详细的解释。
https://stackoverflow.com/questions/28415387
复制相似问题