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 faked BRDF using a 2D ramp texture

We can take the ramp diffuse recipe one step further by using the view direction, provided by the lighting functions, to create a more advanced visual look to our lighting. By utilizing the view direction, we will be able to generate some faked rim lighting.

If we look at the ramp diffuse technique, we are only using one value to place into the UV lookup of the ramp texture. This means that we will get a very linear type of lighting effect. In this recipe we will change our lighting function to take advantage of an additional argument, the view direction.

The view direction is the user's view of the object itself. It is a vector, pointing in a direction that we can use in conjunction with the normal ...

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