Optimise Shadows In Unity

本文介绍如何在Unity中优化阴影效果,包括使用烘焙光映射、减少动态光源数量、调整阴影纹理分辨率等方法,并探讨了使用延迟渲染路径的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

There are a few things you should do to optimise the shadows inyour game:

Use lightmapping heavily to compute the shadows for static meshes.Unity has a builtin lightmapper. See http://docs.unity3d.com/Documentation/Manual/Lightmapping.html andhttp://docs.unity3d.com/Documentation/Manual/OptimizeForIntegratedCards.html.

The computation of dynamic lights have 3 main aspects and each onemust be tweaked for performance: the light itself, the casters andthe receivers.

To make a dynamic light, set Hard Shadows or Soft Shadows in it.However, the number of dynamic lights should be minimal since eachone issue additional rendering for shadow projection. Also, SoftShadows require a blur filter to ensure smoothness, which canimpact the performance. Finally, the resolution of the shadowtexture also affects performance. Seehttp://docs.unity3d.com/Documentation/Manual/Shadows.html andhttp://docs.unity3d.com/Documentation/Manual/DirectionalShadowDetails.html.

To make a mesh receive or cast shadows, set Receive Shadows or CastShadows in the respective Renderer (BEWARE:by default these settings are on). However, the number ofcasters and receivers should also be minimal, since each caster orreceiver in the "light frustum" must be rendered additional times.See http://docs.unity3d.com/Documentation/Manual/ShadowTroubleshooting.html.

Another related performance tweek is to use the Deferred RenderingPath instead of the Forward Rendering Path.

In summary:

  1. Bake light maps;
  2. Keep the number of dynamic lights to a minimum;
  3. Tweak the resolution of the shadow texture;
  4. Tweak the filter for Soft Shadows;
  5. Use Receive Shadows and Cast Shadows judiciously;
  6. Use the Deferred Rendering Path.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值