Materials and shaders

Render State in Unity is essentially exposed to us via materials. Materials are containers 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 the state to accomplish anything of value. A shader requires input 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, many years ago, their original implementation was to only handle the lighting and shading of an object (applying shadows where originally there were none). Their purpose has grown enormously since ...

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

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