Book Image

Unity 2021 Shaders and Effects Cookbook - Fourth Edition

By : John P. Doran
Book Image

Unity 2021 Shaders and Effects Cookbook - Fourth Edition

By: John P. Doran

Overview of this book

Shaders enable you to create powerful visuals for your game projects. However, creating shaders for your games can be notoriously challenging with various factors such as complex mathematics standing in the way of attaining the level of realism you crave for your shaders. The Unity 2021 Shaders and Effects Cookbook helps you overcome that with a recipe-based approach to creating shaders using Unity. This fourth edition is updated and enhanced using Unity 2021 features and tools covering Unity's new way of creating particle effects with the VFX Graph. You'll learn how to use VFX Graph for advanced shader development. The book also features updated recipes for using Shader Graph to create 2D and 3D elements. You'll cover everything you need to know about vectors, how they can be used to construct lighting, and how to use textures to create complex effects without the heavy math. You'll also understand how to use the visual-based Shader Graph for creating shaders without any code. By the end of this Unity book, you'll have developed a set of shaders that you can use in your Unity 3D games and be able to accomplish new effects and address the performance needs of your Unity game development projects. So, let's get started!
Table of Contents (16 chapters)

What this book covers

Chapter 1, Post Processing Stack, introduces you 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, Working with Surface Shaders, 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, Working with Texture Mapping, will show how to use textures to animate, blend, and drive any other property that you like.

Chapter 5, 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 6, Physically Based Rendering, 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 7, 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 8, Fragment Shaders and Grab Passes, explains how to use grab passes to make materials that emulate the deformations generated by semi-transparent materials.

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

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

Chapter 11, 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 12, Advanced Shading Techniques, introduces the most advanced techniques in this book, such as fur shading and heatmap rendering.

Chapter 13, Shader Graph – 2D, 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 explore the ways that we can use Shader Graph for 2D games.

Chapter 14, Shader Graph – 3D, expands on the knowledge from the previous chapter and shows how to use Shader Graph for 3D games with examples such as how to interact with the Shader Graph through code using a glow highlight system, creating a portal shader, and using custom Shader Graph functions.