Schweitzer Fachinformationen
Wenn es um professionelles Wissen geht, ist Schweitzer Fachinformationen wegweisend. Kunden aus Recht und Beratung sowie Unternehmen, öffentliche Verwaltungen und Bibliotheken erhalten komplette Lösungen zum Beschaffen, Verwalten und Nutzen von digitalen und gedruckten Medien.
Unity 2021 Shaders and Effects Cookbook is your guide to becoming familiar with the creation of shaders and post-processing effects in Unity 2021. You will start your journey at the beginning, exploring the Post Processing Stack to see some of the possible ways you can use shaders to affect what you see without having to write scripts at all. Afterward, we will learn how to create shaders from scratch, starting by creating the most basic shaders and learning how the shader code is structured. This foundational knowledge will arm you with the means to progress further through each chapter, learning advanced techniques such as volumetric explosions and fur shading. We also explore the newly added Shader Graph editor to see how you can create shaders through a drag-and-drop interface as well! This edition of the book is written specifically for Unity 2021 and will help you to master physically based rendering and global illumination to get as close to photorealism as possible.
By the end of each chapter, you will have gained new skills that will increase the quality of your shaders and even make your shader writing process more efficient. These chapters have been tailored so that you can jump into each section and learn a specific skill, going from beginner to expert. For those who are new to shader writing in Unity, you can progress through each chapter, one at a time, to build on your knowledge. Either way, you will learn the techniques that make modern games look the way they do.
Once you have completed this book, you will have a set of shaders that you can use in your Unity 3D games as well as an understanding of how to add to them, accomplish new effects, and address performance needs. So, let's get started!
Unity 2021 Shaders and Effects Cookbook is written for Game developers who want to create their first shaders in Unity 2021 or wish to take their game to a whole new level by adding professional post-processing effects. A solid understanding of Unity is required.
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.
You are expected to have experience of working with Unity and some scripting experience (C# is fine). The book is written with Unity 2021.1.9f1 but should work with future versions of the engine with some minor tweaks.
If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Unity-2021-Shaders-and-Effects-Cookbook-Fourth-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781839218620_ColorImages.pdf.
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Use the vertex color data from our Input struct to be assigned to the o.Albedo parameters in the built-in SurfaceOutput struct."
A block of code is set as follows:
void surf (Input IN, inout SurfaceOutput o)
{
o.Albedo = IN.vertColor.rgb * _MainTint.rgb;
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
struct Input
float2 uv_MainTex;
float4 vertColor;
};
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "From its Inspector tab, make sure that Filter Mode is set to Bilinear."
Tips or important notes
Appear like this.
In this book, you will find several headings that appear frequently (Getting ready, How to do it..., How it works..., There's more..., and See also).
To give clear instructions on how to complete a recipe, use these sections as follows:
This section tells you what to expect in the recipe and describes how to set up any software or any preliminary settings required for the recipe.
This section contains the steps required to follow the recipe.
This section usually consists of a detailed explanation of what happened in the previous section.
This section consists of additional information about the recipe in order to make you more knowledgeable about the recipe.
This section provides helpful links to other useful information for the recipe.
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form...
Dateiformat: ePUBKopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet – also für „fließenden” Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.