有没有一种简单的方法可以在OpenGL中获得阴影?
我最近创建了一些景观代码,并向场景添加了一些漫射照明,但是,令我失望的是,没有阴影。我在网上浏览了几个小时,寻找在 OpenGL 中获得阴影的方法,但它们看起来都非常复杂;他们自己的演示程序非常独特。
有没有简单的方法来制作阴影?
I recently created some landscape code and added some diffuse lighting to the scene, however, to my disappointment, there are no shadows. I looked around the web for hours looking for ways to get shadows in OpenGL, however they all seemed terribly complicated; and very unique to their own demo programs.
Are there any simple ways to make shadows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不。光栅化在这方面非常糟糕(即使是最近的 AAA 游戏也有明显的阴影伪影),但每个人都忍受着它。
解决方案包括(大约从最简单/最差到最好/最难):
因此,通常的技巧是将漂亮但仅静态的方法与动态但不太好的方法混合在一起。例如,请参阅我的关于 光照贴图 和 阴影贴图。
No. Rasterization is very bad at this (even recent AAA games have noticeable shadow artefacts), but everybody lives with it.
Solutions include (approx. from easiest/poorest to best/hardest) :
So the usual trick is to mix beautiful-but-static-only approaches with dynamic-but-not-that-good approaches. For instance, see my tutorials on lightmapping and shadowmapping.
不。
我所知道的最简单的方法是使用预先生成的阴影纹理,该纹理通过多重纹理叠加到地形上。复杂的部分是生成这种纹理,但如果不使用定向照明,一个简单的“大模糊点”通常比没有好。
No.
The easiest way I know of involves using a pregenerated shadow texture that is overlaid onto the terrain using multitexturing. The complicated part is generating this texture, but if you don't use directional lighting, a simple "big blurry dot" is usually better than nothing.