简体   繁体   English

MonoGame中的简单2D照明

[英]Simple 2D lighting in MonoGame

So I have been looking for a way to implement SIMPLE 2D lighting into a top-down game I'm creating in MonoGame. 所以我一直在寻找一种方法来实现SIMPLE 2D照明到我在MonoGame中创建的自上而下的游戏。 I have searched far and wide, and have found few tutorials that help me little, if any. 我已经进行了广泛的搜索,并且发现很少有教程可以帮助我很少,如果有的话。 I simply wish to add a black overlay to my level, and then cut out the areas from the texture in which a light source would be. 我只想在我的关卡中添加一个黑色叠加层,然后从光源所在的纹理中剪切出区域。 I am foreign to the concept of .FX files and converting them to be compatible with MonoGame. 我对.FX文件的概念很陌生,并将它们转换为与MonoGame兼容。 If there is some sort of way to have a "subtraction" blend mode, that would be perfect, if I only knew how to create/use it. 如果有某种方式可以采用“减法”混合模式,那么如果我只知道如何创建/使用它,那将是完美的。

I've had this same problem forever now. 我现在永远都有同样的问题。 I've searched the stars and back, found a couple of vague tutorials, and even tried to reverse engineer other 2D games to finally find something that is useful. 我搜索了星星和背部,找到了几个模糊的教程,甚至尝试对其他2D游戏进行逆向工程,最终找到了有用的东西。

I wrote up a big 2D lighting tutorial that explains briefly what you need to know about HLSL (.FX) files and creating something simple. 我写了一篇很棒的2D照明教程 ,简要介绍了你需要了解的关于HLSL(.FX)文件的内容以及创建简单的东西。

Let me know if you have any questions 如果您有任何疑问,请告诉我

[ [ 照明示例图片]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM