You are previewing Unity 5.x Shaders and Effects Cookbook.
O'Reilly logo
Unity 5.x Shaders and Effects Cookbook

Book Description

Master the art of Shader programming to bring life to your Unity projects

About This Book

  • Master the art of Shader programming to bring life to your Unity projects

  • From an eminent author, this book offers you the fine technicalities of professional post-processing effects for stunning results

  • This book will help you master Shader programming through easy-to-follow examples to create stunning visual effects that can be used in 3D games and high quality graphics.

  • Who This Book Is For

    Unity Effects and Shader Cookbook is written for developers who want to create their first Shaders in Unity 5 or wish to take their game to a whole new level by adding professional post-processing effects. A solid understanding of Unity is required.

    What You Will Learn

  • Understand physically based rendering to fit the aesthetic of your game

  • Enter the world of post-processing effects to make your game look visually stunning

  • Add life to your materials, complementing Shader programming with interactive scripts

  • Design efficient Shaders for mobile platforms without sacrificing their realism

  • Use state-of-the-art techniques such as volumetric explosions and fur shading

  • Build your knowledge by understanding how Shader models have evolved and how you can create your own

  • Discover what goes into the structure of Shaders and why lighting works the way it does

  • Master the math and algorithms behind the most used lighting models

  • In Detail

    Since their introduction to Unity, Shaders have been notoriously difficult to understand and implement in games: complex mathematics have always stood in the way of creating your own Shaders and attaining that level of realism you crave. With Shaders, you can transform your game into a highly polished, refined product with Unity’s post-processing effects.

    Unity Shaders and Effects Cookbook is the first of its kind to bring you the secrets of creating Shaders for Unity3D—guiding you through the process of understanding vectors, how lighting is constructed with them, and also how textures are used to create complex effects without the heavy math.

    We’ll start with essential lighting and finishing up by creating stunning screen Effects just like those in high quality 3D and mobile games. You’ll discover techniques including normal mapping, image-based lighting, and how to animate your models inside a Shader. We’ll explore the secrets behind some of the most powerful techniques, such as physically based rendering! With Unity Shaders and Effects Cookbook, what seems like a dark art today will be second nature by tomorrow.

    Style and approach

    We’ll start with essential lighting and finishing up by creating stunning screen Effects just like those in high quality 3D and mobile games. You’ll discover techniques including normal mapping, image-based lighting, and how to animate your models inside a Shader. We’ll explore the secrets behind some of the most powerful techniques, such as physically based rendering! With Unity Shaders and Effects Cookbook, what seems like a dark art today will be second nature by tomorrow.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Unity 5.x Shaders and Effects Cookbook
      1. Table of Contents
      2. Unity 5.x Shaders and Effects Cookbook
      3. Credits
      4. About the Authors
      5. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      7. 1. Creating Your First Shader
        1. Introduction
        2. Creating a basic Standard Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Migrating Legacy Shaders from Unity 4 to Unity 5
          1. Getting ready
          2. How to do it...
            1. Upgrading automatically
            2. Using Standard Shaders
            3. Migrating custom shaders
          3. How it works...
          4. See also
        4. Adding properties to a shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Using properties in a Surface Shader
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
      8. 2. Surface Shaders and Texture Mapping
        1. Introduction
        2. Diffuse shading
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Using packed arrays
          1. How to do it...
            1. Packed matrices
          2. See also
        4. Adding a texture to a shader
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
          5. See also
        5. Scrolling textures by modifying UV values
          1. Getting ready
          2. How to do it…
          3. How it works…
        6. Normal mapping
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        7. Creating a transparent material
          1. Getting ready
          2. How to do it…
          3. How it works…
        8. Creating a Holographic Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Packing and blending textures
          1. Getting ready
          2. How to do it…
          3. How it works…
        10. Creating a circle around your terrain
          1. Getting ready
          2. How to do it…
            1. Moving the circle
          3. How it works…
      9. 3. Understanding Lighting Models
        1. Introduction
        2. Creating a custom diffuse lighting model
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Creating a Toon Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Creating a Phong Specular type
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Creating a BlinnPhong Specular type
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        6. Creating an Anisotropic Specular type
          1. Getting ready
          2. How to do it…
          3. How it works…
      10. 4. Physically Based Rendering in Unity 5
        1. Introduction
        2. Understanding the metallic setup
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Adding transparency to PBR
          1. Getting ready
          2. How to do it…
            1. Semi-transparent materials
            2. Fading objects
            3. Solid geometries with holes
          3. See also
        4. Creating mirrors and reflective surfaces
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Baking lights in your scene
          1. Getting ready
          2. How to do it…
            1. Configuring the static geometry
            2. Configuring the light probes
            3. Baking the lights
          3. How it works…
          4. See also
      11. 5. Vertex Functions
        1. Introduction
        2. Accessing a vertex color in a Surface Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Animating vertices in a Surface Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Extruding your models
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Adding extrusion maps
        5. Implementing a snow shader
          1. Getting ready
          2. How to do it…
          3. How it works…
            1. Coloring the surface
            2. Altering the geometry
          4. See also
        6. Implementing a volumetric explosion
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      12. 6. Fragment Shaders and Grab Passes
        1. Introduction
        2. Understanding Vertex and Fragment Shaders
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Input semantics
            2. Output semantics
          5. See also
        3. Using grab pass
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Implementing a Glass Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Implementing a Water Shader for 2D games
          1. Getting ready
          2. How to do it…
          3. How it works…
      13. 7. Mobile Shader Adjustment
        1. Introduction
        2. What is a cheap shader?
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Profiling your shaders
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Modifying our shaders for mobile
          1. Getting ready
          2. How to do it…
          3. How it works…
      14. 8. Screen Effects with Unity Render Textures
        1. Introduction
        2. Setting up the screen effects script system
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        3. Using brightness, saturation, and contrast with screen effects
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Using basic Photoshop-like Blend modes with screen effects
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Using the Overlay Blend mode with screen effects
          1. Getting ready
          2. How to do it…
          3. How it works…
      15. 9. Gameplay and Screen Effects
        1. Introduction
        2. Creating an old movie screen effect
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Creating a night vision screen effect
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
      16. 10. Advanced Shading Techniques
        1. Introduction
        2. Using CgInclude files that are built into Unity
          1. Getting ready
          2. How to do it…
          3. How it works…
        3. Making your shader world modular with CgInclude
          1. Getting ready
          2. How to do it…
          3. How it works…
        4. Implementing a Fur Shader
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        5. Implementing heatmaps with arrays
          1. Getting ready
          2. How to do it…
          3. How it works…
      17. Index