Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Become a Unity Shaders Guru

You're reading from  Become a Unity Shaders Guru

Product type Book
Published in Jul 2023
Publisher Packt
ISBN-13 9781837636747
Pages 492 pages
Edition 1st Edition
Languages
Author (1):
Mina Pêcheux Mina Pêcheux
Profile icon Mina Pêcheux

Table of Contents (23) Chapters

Preface 1. Part 1: Creating Shaders in Unity
2. Chapter 1: Re-Coding a Basic Blinn-Phong Shader with Unity/CG 3. Part 2: Stepping Up to URP and the Shader Graph
4. Chapter 2: The Three Unity Render Pipelines 5. Chapter 3: Writing Your First URP Shader 6. Chapter 4: Transforming Your Shader into a Lit PBS Shader 7. Chapter 5: Discovering the Shader Graph with a Toon Shader 8. Part 3: Advanced Game Shaders
9. Chapter 6: Simulating Geometry Efficiently 10. Chapter 7: Exploring the Unity Compute Shaders and Procedural Drawing 11. Chapter 8: The Power of Ray Marching 12. Part 4: Optimizing Your Unity Shaders
13. Chapter 9: Shader Compilation, Branching, and Variants 14. Chapter 10: Optimizing Your Code, or Making Your Own Pipeline? 15. Part 5: The Toolbox
16. Chapter 11: A Little Suite of 2D Shaders 17. Chapter 12: Vertex Displacement Shaders 18. Chapter 13: Wireframes and Geometry Shaders 19. Chapter 14: Screen Effect Shaders 20. Index 21. Other Books You May Enjoy Appendix: Some Quick Refreshers on Shaders in Unity

Conventions used

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: “At that point, our URP shader is set up to use the scriptable render feature, which will automatically call the compute shader we prepared in our FillWithRed.compute asset and return a full red opaque color for each pixel on the screen.”

A block of code is set as follows:

using UnityEngine;
using UnityEngine.Rendering;
[CreateAssetMenu(menuName = "Compute Assets/CH07/FillWithRed")]
public class ComputeFillWithRed : URPComputeAsset {
    public override void Render(CommandBuffer commandBuffer,
        int kernelHandle) {}
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

private void _GenerateGrid() {
    _cubes = new List<GameObject>();
    _cubeRenderers = new List<MeshRenderer>();
    _data = new Cube[gridSize * gridSize];
    ...
    for (int x = 0; x < gridSize; x++) {
        for (int y = 0; y < gridSize; y++) {
            ...
            _cubes.Add(g);
            _cubeRenderers.Add(r);
            _data[x * gridSize + y] = new Cube() {
                position = g.transform.position,
                color = color
            };
        }
    }
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “To get this incoming vector, we use the View Direction node – and the offset is then computed by multiplying it with a given float value.”

Tips or important notes

Appear like this.

lock icon The rest of the chapter is locked
Next Chapter arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}