Book Image

Unity 2018 Shaders and Effects Cookbook - Third Edition

By : John P. Doran, Alan Zucconi
Book Image

Unity 2018 Shaders and Effects Cookbook - Third Edition

By: John P. Doran, Alan Zucconi

Overview of this book

Since their introduction to Unity, shaders have been seen as notoriously difficult to understand and implement in games. Complex mathematics has always stood in the way of creating your own shaders and attaining the level of realism you crave. Unity 2018 Shaders and Effects Cookbook changes that by giving you a recipe-based guide to creating shaders using Unity. It will show you everything you need to know about vectors, how lighting is constructed with them, and how textures are used to create complex effects without the heavy math. This book starts by teaching you how to use shaders without writing code with the post-processing stack. Then, you’ll learn how to write shaders from scratch, build up essential lighting, and finish by creating stunning screen effects just like those in high-quality 3D and mobile games. You'll discover techniques, such as normal mapping, image-based lighting, and animating your models inside a shader. We'll explore how to use physically based rendering to treat light the way it behaves in the real world. At the end, we’ll even look at Unity 2018’s new Shader Graph system. With this book, what seems like a dark art today will be second nature by tomorrow.
Table of Contents (14 chapters)

What this book covers

Chapter 1, Post Processing Stack, introduces readers to the Post Processing Stack, which will allow users to tweak their game's appearance without having to write any additional scripts.

Chapter 2, Creating Your First Shader, introduces you to the world of shader coding in Unity. You will build some basic shaders and learn how to introduce tweakable properties in your shaders to make them more interactive.

Chapter 3, Surface Shaders and Texture Mapping, covers the most common and useful techniques that you can implement with Surface Shaders, including how to use textures and normal maps for your models.

Chapter 4, Understanding Lighting Models, gives you an in-depth explanation of how shaders model the behavior of light. This chapter teaches you how to create custom lighting models used to simulate special effects, such as toon shading.

Chapter 5, Physically-Based Rendering in Unity 5, shows you that physically-based rendering is the standard technology used by Unity 5 to bring realism to your games. This chapter explains how to make the most out of it by mastering transparencies, reflective surfaces, and global illumination.

Chapter 6, Vertex Functions, teaches you how shaders can be used to alter the geometry of an object. This chapter introduces vertex modifiers and uses them to bring volumetric explosions, snow shaders, and other effects to life.

Chapter 7, Fragment Shaders and Grab Passes, explains how to use grab passes to make materials that emulate the deformations generated by semi-transparent materials.

Chapter 8, Mobile Shader Adjustment, helps you optimize your shaders to get the most out of any device.

Chapter 9, Screen Effects with Unity Render Textures, shows you how to create special effects and visuals that would otherwise be impossible to achieve.

Chapter 10, Gameplay and Screen Effects, tells you how post-processing effects can be used to complement your gameplay, simulating, for instance, a night-vision effect.

Chapter 11, Advanced Shading Techniques, introduces the most advanced techniques in this book, such as fur shading and heatmap rendering.

Chapter 12, Shader Graph, explains how to set up a project to use Unity's newly added Shader Graph editor. We cover how to create a simple shader graph, how to expose properties, and how to interact with the shader graph through code using a glow highlight system.