Creating a custom diffuse lighting model

If you are familiar with Unity 4, you may know that the default shader it provided was based on a lighting model called Lambertian reflectance. This recipe will show you how it is possible to create a shader with a custom lighting model and explains the mathematics involved and implementation. The following diagram shows the same geometry rendered with a Standard Shader (right) and a diffuse Lambert one (left):

Shaders based on Lambertian reflectance are classified as non-photorealistic; no object in the real world really looks like this. However, Lambert Shaders are still often used in low-poly games ...

Get Unity 2018 Shaders and Effects Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.