Unity 支持不同的渲染路径。您应该根据自己的游戏内容和目标平台/硬件而选择使用哪一个渲染路径。不同的渲染路径具有不同的性能特征,主要影响光照和阴影。请参阅渲染管线以了解技术细节。
项目所用的渲染路径是在 Graphics 窗口中选择的。此外,可针对每个摄像机重写渲染路径。
如果显卡无法处理选定的渲染路径,Unity 会自动使用较低保真度的渲染路径。例如,在无法处理延迟着色 (Deferred Shading) 的 GPU 上将使用前向渲染 (Forward Rendering)。
延迟着色是具有最大光照和阴影保真度的渲染路径,最适合有许多实时光源的情况。此渲染路径需要一定程度的硬件支持。
有关更多详细信息,请参阅延迟着色页面。
前向渲染是传统的渲染路径。它支持所有典型的 Unity 图形功能(法线贴图、每像素光照、阴影等)。但是,在默认设置下,仅少量最亮的光线才在每像素光照模式下渲染。其余光线是在对象顶点上或每个对象上计算的。
有关更多详细信息,请参阅前向渲染页面。
旧版延迟(Light Prepass,即光照 prepass)类似于延迟着色,只是采用不同的技术并进行不同的折中。它不支持 Unity 5 基于物理的标准着色器。
有关更多详细信息,请参阅延迟光照页面。
旧版顶点光照是具有最低光照保真度且不支持实时阴影的渲染路径。它是前向渲染路径的一个子集。
有关更多详细信息,请参阅顶点光照页面。
注意:使用正交投影 (Orthographic projection) 时不支持延迟渲染。如果摄像机的投影模式设置为正交模式,则会覆盖这些值,并且摄像机将始终使用前向渲染。
延迟 | 前向 | 旧版延迟 | 顶点光照 | |
---|---|---|---|---|
功能 | ||||
每像素光照(法线贴图、光照剪影) | 是 | 是 | 是 | - |
实时阴影 | 是 | 带有警告 | 是 | - |
反射探针 | 是 | 是 | - | - |
深度和法线缓冲区 | 是 | 其他渲染pass | 是 | - |
软粒子 | 是 | - | 是 | - |
半透明对象 | - | 是 | - | 是 |
抗锯齿 | - | 是 | - | 是 |
光照剔除遮罩 | 受限 | 是 | 受限 | 是 |
光照保真度 | 全部每像素 | 部分每像素 | 全部每像素 | 全部每顶点 |
性能 | ||||
每像素光照的成本 | 照射像素数量 | 像素数量 * 照射对象数量 | 照射像素数量 | - |
正常渲染对象的次数 | 1 | 每像素光照的数量 | 2 | 1 |
简单场景的开销 | 高 | 无 | 中 | 无 |
平台支持 | ||||
PC (Windows/Mac) | Shader Model 3.0+ 和 MRT | 所有 | Shader Model 3.0+ | 所有 |
移动端 (iOS/Android) | OpenGL ES 3.0 和 MRT、Metal(在搭载 A8 或更高版本 SoC 的设备上) | 所有 | OpenGL ES 2.0 | 所有 |
游戏主机 | XB1、PS4 | 所有 | XB1、PS4、360 | - |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.