Troubleshooting Shadows 阴影疑难解答

优质
小牛编辑
134浏览
2023-12-01

This page lists solutions to common shadow problems.

此页面列出了常见阴影问题解决方案。

Desktop

I see no shadows at all! 所有物体都没有看到阴影!

  • Shadows are a Unity Pro only feature, so without Unity Pro you won't get shadows. Simpler shadow methods, like using a Projector, are still possible of course.
    阴影仅是Unity专业版的功能,因此,不是Unity专业版不能获得阴影。简单阴影的方法,像使用投影器
  • Shadows also require certain graphics hardware support. See Shadows page for details.
    阴影还需要一定的图形硬件支持。详情参见阴影页。
  • Check if shadows are not completely disabled in Quality Settings.
    检查是否阴影在质量设置中没有被完全禁用。
  • Shadows are currently not supported for iOS and Android mobile platforms.
    iOS和Android移动平台目前不支持阴影。

Some of my objects do not cast or receive shadows
一些对象不投射或接收阴影

First, the Renderer has to have Receive Shadows on to have shadows on itself; and Cast Shadows on to cast shadows on other objects (both are on by default).

首先,渲染自身具有阴影属性来接收阴影,并投射阴影到其他物体(这两者是默认的)。

Next, only opaque objects cast and receive shadows; that means if you use built-in Transparent or Particle shaders then you'll get no shadows. In most cases it's possible to Transparent Cutout shaders (for objects like fences, vegetation etc.). If you use custom written Shaders, they have to be pixel-lit and use Geometry render queue. Objects using VertexLit shaders do not receive shadows either (but can cast shadows just fine).

其次,只有不透明的物体投射和接受阴影;这意味着如果使用内置的Transparent或粒子着色器将没有阴影。在大多数情况下可能是透明抠图着色器(像围栏,植被等物体),这可以有阴影。如果使用自定义的着色器,它们必须是pixel-lit并使用几何渲染队列。物体使用VertexLit着色器不接受阴影,但能投射阴影。

Finally, in Forward rendering path, only the brightest directional light can cast shadows. If you want to have many shadow casting lights, you need to use Deferred Lighting rendering path.

最后,在正向渲染路径,只有最亮的平行光可以投射阴影。如果你想有多个的阴影投射灯,你需要使用延迟光照渲染路径

iOS

This feature is currently not supported on iOS devices.

此功能目前不支持iOS的目标。

Android

This feature is currently not supported on Android devices.

此功能目前不支持Android的目标。

页面最后更新: 2010-09-24