6.1.1 About custom shaders

Unity 5 and higher includes a Physically Based Shading (PBS) model that simulates the interactions between material and light. This provides a high level of realism and makes it possible to achieve a consistent look under different lighting conditions.

You can easily use PBS with the standard shader. If you create your own material, it is automatically assigned the standard shader.
You can easily access the Standard Shader. If you create your own material the Standard Shader is assigned to it. There are a number of other built-in shaders that are very useful for beginners. You can see all the available built-in shaders divided into families by clicking on the shader drop down menu in the Inspector.
Figure 6-1 Unity built-in shaders

The source code of built-in shaders is available in the Unity download archive http://unity3d.com/ that contains more than 120 shaders. You can learn a lot from reading and trying to understand the code of these shaders.
In addition to these, there are many effects that cannot be achieved by using existing shaders. For example, shaders that implement reflections based on local cubemaps. For more information see 6.2 Implementing reflections with a local cubemap.
In Unity there are typically two ways of writing shaders:
Surface shaders
These are commonly used when shaders are affected by lights and shadows. Unity does the work related to the lighting model for you, enabling you to write more compact shaders.
Vertex and fragment shaders
These are the most flexible shaders but you must implement everything. The Unity ShaderLab does more than vertex and fragment shaders but these are in the main programmable part of the graphics pipeline where all the shading is done so it is important to know how to write custom vertex and fragment shaders.
Non-ConfidentialPDF file icon PDF versionARM 100140_0201_00_en
Copyright © 2014, 2015 ARM. All rights reserved.