In this chapter, you learned a lot about writing shaders and their optimization. We started with a simple shader code and examined the fundamental elements in Unity surface shaders. Next, we wrote our custom diffuse lighting model. Also, we examined global illumination. We explored the various optimization techniques by changing the shader variable types, as well as by writing specific directives. Towards the end of this chapter, we covered the best case practice while developing shaders using
CgIncludes files, and learned how to use its code.
The next chapter will cover legacy and Mecanim animation systems in Unity 5. You will also develop a simple custom sprite animation system and explore how to import, set up, and play audio files inside your scripts in Unity 5. At the end of the next chapter, you will explore the physics and particle systems in Unity 5.