我正在尝试找到一种在游戏中为我的精灵实现倾斜阴影的方法。也就是说,我希望诸如播放器,树木等物体具有基于太阳在天空中的位置的阴影。
我曾尝试修改Catalin Zima的方法来满足我的需求,但收效甚微,最终我认为这种方法对我不起作用,而他所做的优化此刻在我头上有些困难。我在这里描述我的奋斗。
I've spent some time learning HLSL the past few weeks, doing some simple ambient light and color changing shaders, but am honestly at a loss as to how to approach this requirement.
Can anyone recommend an approach or supply some resources? Any help is much appreciated.
Actually I don't think these are actual shadows but rather the sprite rendered a bit distorted.
After you've rendered the background (floor), you render all sprites with black or dark gray color. But you skew the polygon a bit to the left:
Then you render the sprite as normal at the same location. Now you have a nice looking shadow effect which is also a super fast method.
您唯一要考虑的是角色跳跃时。您必须偏移阴影精灵渲染。最好通过使向量指向左上角并将其按跳跃高度缩放。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句