Building Quality Shaders for Unity®
Building Quality Shaders for Unity®, Apress
Using Shader Graphs and HLSL Shaders
Von Daniel Ilett, im heise Shop in digitaler Fassung erhältlich
Using Shader Graphs and HLSL Shaders
Von Daniel Ilett, im heise Shop in digitaler Fassung erhältlich
Produktinformationen "Building Quality Shaders for Unity®"
Understand what shaders are and what they’re used for: Shaders are often seen as mystical and difficult to develop, even by skilled programmers, artists, and developers from other game design disciplines. This book dispels that idea by building up your shader knowledge in stages, starting with fundamental shader mathematics and how shader development mindset differs from other types of art and programming, and slowly delves into topics such as vertex and fragment shaders, lighting, depth-based effects, texture mapping, and Shader Graph.
This book presents each of these topics with a comprehensive breakdown, the required theory, and some practical applications for the techniques learned during each chapter. The HLSL (High Level Shading Language) code and Shader Graphs will be provided for each relevant section, as well as plenty of screenshots.
By the end of this book, you will have a good understanding of the shader development pipeline and you will be fully equipped to start making your own aesthetic and performant shader effects for your own games!
YOU WILL LEARN TO
• Use shaders across Unity’s rendering pipelines
• Write shaders and modify their behavior with C# scripting
• Use Shader Graph for codeless development
• Understand the important math behind shaders, particularly space transformations
• Profile the performance of shaders to identify optimization targets
WHO IS THIS BOOK FOR
This book is intended for beginners to shader development, or readers who may want to make the jump from shader code to Shader Graph. It will also include a section on shader examples for those who already know the fundamentals of shaders and are looking for specific use cases. Daniel Ilett is an ambitious and motivated PhD student at the University of Warwick. He is a passionate game developer, specialising in shaders and technical art. He publishes a range of educational and tutorial content, including videos and written work, aimed at beginners and intermediate developers. He also does freelance work on shaders and visual effects for games. Chapter 1: Introduction to Shaders in Unity
Sub-topics:
• Brief overview of shader fundamentals
• Unity’s built-in pipeline
• URP (Universal Render Pipeline)
• HDRP (High Definition Render Pipeline)
Chapter 2: Maths for Shader Development
Sub-topics:
• Vectors in 2D and 3D
• Dot product, cross product, and other vector operations
• Matrices
• Multiplication, transpose, inverse, and common matrix operations
• Important spaces in computer graphics
• Homogeneous coordinate systems
• Transformation between spaces
Chapter 3: Your Very First Shader
Sub-topics:
• The shader pipeline, and data flow
• ShaderLab, SubShaders and Fallbacks• Shader Tags
• The appdata struct: Input to the vertex shader
• The vertex shader
• The v2f struct: Data passed between the vertex and fragment shader
• The fragment shader
Chapter 4: Shader Graph
Sub-topics:
• The argument for node-based editors
• The vertex and fragment stages
• Shader nodes & properties
• Your first Shader Graph
Chapter 5: Textures, UV Coordinates & Normal Mapping
Sub-topics:
• What is texture mapping?
• What are UV coordinates?
• Scaling, rotating and offsetting UVs
• Sampler states
• Normal mapping & tangent space
Chapter 6: Transparency
Sub-topics:
• Transparency vs opacity
• Alpha-blended transparency
• Sorting
• Screen-door (“dithered”) transparency
Chapter 7: The Depth Buffer
• What is the depth buffer?• Depth-testing and culling
• Depth-based shader effects
Chapter 8: More Shader Fundamentals
Sub-topics:
• Shader keywords and variants
• Single- and multi-pass shaders
• GrabPass and UsePass
• Unity’s standard shader libraries
Chapter 9: Lighting & Shadows
Sub-topics:
• Lighting theory: Diffuse, specular, ambient, and Fresnel light
• Phong shading
• Physically based rendering• Shadow casting
Chapter 10: Image Effects & Post Processing
Sub-topics:
• Post Processing in the Built-in pipeline, URP and HDRP
• Convolution kernels, Gaussian blur and multi-pass effects.
• Edge detection with a Sobel kernel• Better edge detection using the depth texture and normal texture
Chapter 11: Advanced Shaders
Sub-topics:
• Geometry shaders: adding or modifying vertices
• Tessellation shaders: subdividing a mesh
• Building an LOD system with tessellation shaders• Compute shaders: arbitrary computation on the GPU
Chapter 12: Profiling & Optimization
Sub-topics:
• The Unity Profiler and Frame Debugger
• Branching in shaders
• Avoiding overdraw
• Multi-material objects
• Batching
Chapter 13: Shader Recipes For Your Games
Sub-topics:
• World-space reconstruction in post processing shaders
• Custom lighting: cel-shading (toon shading)
• Vertex displacement – realistic water (Gerstner waves)
• Refraction by modifying the framebuffer
• Interactive snow layers (modifying the height of a mesh based on gameplay actions)
• Holograms using emissive colour
• Using Voronoi noise to make marble
This book presents each of these topics with a comprehensive breakdown, the required theory, and some practical applications for the techniques learned during each chapter. The HLSL (High Level Shading Language) code and Shader Graphs will be provided for each relevant section, as well as plenty of screenshots.
By the end of this book, you will have a good understanding of the shader development pipeline and you will be fully equipped to start making your own aesthetic and performant shader effects for your own games!
YOU WILL LEARN TO
• Use shaders across Unity’s rendering pipelines
• Write shaders and modify their behavior with C# scripting
• Use Shader Graph for codeless development
• Understand the important math behind shaders, particularly space transformations
• Profile the performance of shaders to identify optimization targets
WHO IS THIS BOOK FOR
This book is intended for beginners to shader development, or readers who may want to make the jump from shader code to Shader Graph. It will also include a section on shader examples for those who already know the fundamentals of shaders and are looking for specific use cases. Daniel Ilett is an ambitious and motivated PhD student at the University of Warwick. He is a passionate game developer, specialising in shaders and technical art. He publishes a range of educational and tutorial content, including videos and written work, aimed at beginners and intermediate developers. He also does freelance work on shaders and visual effects for games. Chapter 1: Introduction to Shaders in Unity
Sub-topics:
• Brief overview of shader fundamentals
• Unity’s built-in pipeline
• URP (Universal Render Pipeline)
• HDRP (High Definition Render Pipeline)
Chapter 2: Maths for Shader Development
Sub-topics:
• Vectors in 2D and 3D
• Dot product, cross product, and other vector operations
• Matrices
• Multiplication, transpose, inverse, and common matrix operations
• Important spaces in computer graphics
• Homogeneous coordinate systems
• Transformation between spaces
Chapter 3: Your Very First Shader
Sub-topics:
• The shader pipeline, and data flow
• ShaderLab, SubShaders and Fallbacks• Shader Tags
• The appdata struct: Input to the vertex shader
• The vertex shader
• The v2f struct: Data passed between the vertex and fragment shader
• The fragment shader
Chapter 4: Shader Graph
Sub-topics:
• The argument for node-based editors
• The vertex and fragment stages
• Shader nodes & properties
• Your first Shader Graph
Chapter 5: Textures, UV Coordinates & Normal Mapping
Sub-topics:
• What is texture mapping?
• What are UV coordinates?
• Scaling, rotating and offsetting UVs
• Sampler states
• Normal mapping & tangent space
Chapter 6: Transparency
Sub-topics:
• Transparency vs opacity
• Alpha-blended transparency
• Sorting
• Screen-door (“dithered”) transparency
Chapter 7: The Depth Buffer
• What is the depth buffer?• Depth-testing and culling
• Depth-based shader effects
Chapter 8: More Shader Fundamentals
Sub-topics:
• Shader keywords and variants
• Single- and multi-pass shaders
• GrabPass and UsePass
• Unity’s standard shader libraries
Chapter 9: Lighting & Shadows
Sub-topics:
• Lighting theory: Diffuse, specular, ambient, and Fresnel light
• Phong shading
• Physically based rendering• Shadow casting
Chapter 10: Image Effects & Post Processing
Sub-topics:
• Post Processing in the Built-in pipeline, URP and HDRP
• Convolution kernels, Gaussian blur and multi-pass effects.
• Edge detection with a Sobel kernel• Better edge detection using the depth texture and normal texture
Chapter 11: Advanced Shaders
Sub-topics:
• Geometry shaders: adding or modifying vertices
• Tessellation shaders: subdividing a mesh
• Building an LOD system with tessellation shaders• Compute shaders: arbitrary computation on the GPU
Chapter 12: Profiling & Optimization
Sub-topics:
• The Unity Profiler and Frame Debugger
• Branching in shaders
• Avoiding overdraw
• Multi-material objects
• Batching
Chapter 13: Shader Recipes For Your Games
Sub-topics:
• World-space reconstruction in post processing shaders
• Custom lighting: cel-shading (toon shading)
• Vertex displacement – realistic water (Gerstner waves)
• Refraction by modifying the framebuffer
• Interactive snow layers (modifying the height of a mesh based on gameplay actions)
• Holograms using emissive colour
• Using Voronoi noise to make marble
Artikel-Details
- Anbieter:
- Apress
- Autor:
- Daniel Ilett
- Artikelnummer:
- 9781484286524
- Veröffentlicht:
- 17.10.22