2014-08-24 14:05:17|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

Unity Manual > Advanced > Shadows in Unity > Directional Shadow Details


This page explains shadows from Directional lights in detail.  本从定向光源细节解释阴影。

Directional lights are mostly used as a key light - sunlight or moonlight - in an outdoor game. Viewing distances can be huge, especially in first and third person games, and shadows often require some tuning to get the best quality vs. performance balance for your situation.


Let's start out with a good looking shadow setup for a 3rd person game:  让我们开始一个漂亮的阴影设置的第三人称游戏:

Shadows here look pretty good! 阴影这里看来相当不错!

Here, visible distance is about 50 game units, so Shadow Distance was set to 50 in Quality Settings. Also, Shadow Cascades was set to 4, Shadow Resolution to High, and the light uses Soft Shadows.  在这里,可视距离约50游戏单位,因此在质量设置里设置影子距离为50。此外,阴影级联被设置为4,阴影的分辨率设置为高,而灯光使用软阴影。

Chapters below dissect each aspect of directional light shadows:  以下各章解剖定向光阴影每个方面:

Hard versus Soft shadows硬阴影与软阴影

Using the same light setup, if we switch Shadow Type to Hard Shadows, then the transition from lit to shadowed regions is "hard" - either something is 100% in shadow, or 100% lit. Hard shadows are faster to render but often they look less realistic.  使用相同的光源设置,如果我们改用阴影类型的硬阴影,然后从照亮阴影区的过渡转换到“硬” -无论事情是100%的阴影,或100%照亮。硬阴影被快速渲染但往往它们看起来不太现实。

Hard shadows with distance of 50 and four cascades. 50个硬阴影和4个级联距离。

Shadow Cascade count 阴影级联数量

For Directional lights Unity can use so called Cascaded Shadow Maps (alternatively called "Parallel Split Shadow Maps") which give very good shadow quality, especially for long viewing distances. Cascaded shadows work by dividing viewing area into progressively larger portions and using the same size shadow map on each. The result is that objects close to the viewer get more shadow map pixels than objects far away.

发表评论0条 】