O'Reilly logo

Unity Shaders and Effects Cookbook by Kenny Lammers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a custom diffuse lighting model

Using Unity's built-in lighting functions is all well and good, but you will quickly outgrow these and want to create a lot more custom lighting models. Speaking from experience, we have never worked on a project that has used just the built-in Unity lighting functions and called it good. We would create custom lighting models for just about everything. This would allow us to do things such as produce rim lighting effects, more Cubemap-based types of lightings, or even control over how your Shaders react to gameplay, as seen in Shaders that control force fields.

This recipe will focus on creating our own custom diffuse lighting model that we can use to modify and create a number of different effects.

How ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required