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

Masking reflections in Unity3D

Having a reflection is nice, but we aren't going to want to make reflective spheres all the time. Just about everything reflects a certain amount of its environment, and hence, we need some sort of per pixel control over the reflection effect.

In this recipe, we are going to look at a technique that lets us drive the reflection amount, by using a texture as a mask. Basically, we can use the gray scale values of a texture to say how reflective the surface is, meaning that a black value in the texture is going to produce a non-reflective surface and a white value is going to produce a fully reflective surface. This allows for a level of artistic control that is seen in just about every game production pipeline these ...

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