Materials and Shaders

Render State in Unity is essentially exposed to us via Materials. Materials are a container around Shaders, short programs that define how the GPU should render incoming vertex and texture data. A Shader on its own does not have the necessary knowledge of state to accomplish anything of value. A Shader requires inputs such as diffuse textures, Normal maps, and lighting information and effectively dictates what Render State variables need to be set in order to render the incoming data.

Shaders are named this way because their original implementation many years ago was to only handle lighting and shading of an object (applying shadows, where originally there were none). Their purpose has grown enormously since then, and ...

Get Unity 2017 Game Optimization - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.