Unity 中的渲染采用网格、材质、着色器和纹理。它们有着密切的关系。
网格是 Unity 的主要图形基元。网格定义了对象的形状。
材质通过包含对所用纹理的引用、平铺信息、颜色色调等来定义表面应使用的渲染方式。材质的可用选项取决于材质使用的着色器。
着色器是一些包含数学计算和算法的小脚本,根据光照输入和材质配置来计算每个像素渲染的颜色。
纹理是位图图像。材质可包含对纹理的引用,因此材质的着色器可在计算游戏对象的表面颜色时使用纹理。除了游戏对象表面的基本颜色(反照率)之外,纹理还可表示材质表面的许多其他方面,例如其反射率或粗糙度。
材质指定了要使用的一种特定着色器,而使用的着色器确定材质中可用的选项。着色器指定期望使用的一个或多个纹理变量,而 Unity 中的材质检视面板 (Material Inspector) 允许您将自己的纹理资源分配给这些纹理变量。
对于大多数正常渲染(例如渲染角色、景物、环境、实体和透明游戏对象、硬表面和软表面),标准着色器通常是最佳选择。这是一种高度可定制的着色器,能够以高度逼真的方式渲染多种类型的表面。
在其他情况下,可能适合采用另外的内置着色器,甚至自己编写的着色器(例如液体、树叶、折射玻璃、粒子效果、卡通、演示性效果或其他艺术效果或者其他特殊效果,如夜视、热视或 X 射线透视)。
有关更多信息,请参阅以下页面:
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.