《Unity着色器圣经》4.0.1 | 着色器和材质的关系,好有一比啊~

目录索引

英文题目:4.0.1. | Analogy between a shader and a material.

如果直接翻译成着色器和材质类比, 就感觉很奇怪, 这俩东西没什么可以类比的… 这一节内容译者看完之后, 感觉是他俩的关系可以用另外两个东西的关系类比一下, 便于我们理解这俩货之间的关系, 最后译者就把小节名字翻译成现在这样了. “好有一比啊~”这个句型经常见于早期的相声.

译文

根据其术语,“材质”定义了表面该如何被渲染,包括对纹理的引用、平铺、偏移、颜色等等。材质的选项(输入参数)取决于正在使用的着色器。

我们把上面的定义用更便于理解的话描述一遍:让我们把材质想象成“着色器的容器”,这意味着我们有用来执行表面计算的程序(着色器)和能够读取这些运算程序的容器(材质)。

因此,材质和着色器,可以比作“图形化的预览(材质)”和“数学计算(shader)”二者的关系。


原文对照

According to its terminology,

“Materials are definitions of how a surface should be rendered, including references to textures, tiling, offset, color and more. The options of a material depend on which shader is being used.“

How can we translate the above definition to a practical level? Let’s think of a material as“the container of a shader”, this means that we have the program that is performing the surface calculations (shader) and the container (material) that is capable of reading these calculations.

A material alone cannot perform any operations. If it doesn’t have a shader it will not know how it should be rendered, likewise, a shader cannot be applied to an object if it is not through a material, therefore, the analogy between a material and a shader is a “graphical preview of mathematical calculations”.

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容