About the Author |
|
xiii | |
About the Technical Reviewer |
|
xv | |
Acknowledgments |
|
xvii | |
Introduction |
|
xix | |
|
Chapter 1 Introduction to Shaders in Unity |
|
|
1 | (8) |
|
|
1 | (5) |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
5 | (1) |
|
|
6 | (2) |
|
|
7 | (1) |
|
|
8 | (1) |
|
Chapter 2 Math for Shader Development |
|
|
9 | (38) |
|
|
9 | (10) |
|
Position and Direction Vectors |
|
|
10 | (1) |
|
Vector Addition and Subtraction |
|
|
11 | (1) |
|
|
12 | (2) |
|
|
14 | (1) |
|
|
15 | (1) |
|
Basis Vectors and Linear Combinations |
|
|
16 | (1) |
|
|
16 | (2) |
|
|
18 | (1) |
|
|
19 | (8) |
|
Matrix Addition and Subtraction |
|
|
20 | (1) |
|
|
21 | (1) |
|
Square, Diagonal, and Identity Matrices |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
23 | (2) |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
27 | (8) |
|
|
28 | (1) |
|
|
29 | (3) |
|
|
32 | (1) |
|
|
33 | (2) |
|
|
35 | (10) |
|
Object-to-World Space Transformation |
|
|
36 | (2) |
|
World-to-View Space Transformation |
|
|
38 | (1) |
|
View-to-Clip Space Transformation |
|
|
38 | (6) |
|
|
44 | (1) |
|
|
45 | (2) |
|
Chapter 3 Your Very First Shader |
|
|
47 | (34) |
|
|
47 | (6) |
|
|
49 | (1) |
|
|
50 | (3) |
|
Writing a Shader in Unity |
|
|
53 | (17) |
|
|
54 | (3) |
|
|
57 | (3) |
|
|
60 | (10) |
|
The SRP Batcher and Constant Buffers |
|
|
70 | (1) |
|
|
71 | (9) |
|
|
71 | (1) |
|
|
72 | (3) |
|
|
75 | (2) |
|
|
77 | (3) |
|
|
80 | (1) |
|
|
81 | (28) |
|
|
82 | (1) |
|
Creating a Basic Shader in Shader Graph |
|
|
83 | (12) |
|
|
83 | (2) |
|
The Shader Graph Interface |
|
|
85 | (3) |
|
|
88 | (4) |
|
|
92 | (3) |
|
|
95 | (11) |
|
Adding Blocks to the Master Stack |
|
|
95 | (1) |
|
|
96 | (1) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
101 | (2) |
|
|
103 | (3) |
|
|
106 | (3) |
|
Chapter 5 Textures and UV Coordinates |
|
|
109 | (32) |
|
|
110 | (19) |
|
|
110 | (12) |
|
Texture Support in Shader Graph |
|
|
122 | (7) |
|
Mipmaps and Level of Detail |
|
|
129 | (3) |
|
|
130 | (2) |
|
|
132 | (3) |
|
|
133 | (1) |
|
|
134 | (1) |
|
|
135 | (4) |
|
|
136 | (1) |
|
Sampler States in Shader Graph |
|
|
137 | (2) |
|
|
139 | (2) |
|
Chapter 6 Advanced Texturing |
|
|
141 | (52) |
|
|
141 | (4) |
|
Modifying Texture Coordinates |
|
|
145 | (28) |
|
|
145 | (4) |
|
|
149 | (6) |
|
|
155 | (5) |
|
|
160 | (8) |
|
|
168 | (5) |
|
|
173 | (6) |
|
Importing 3D Textures from 2D Textures |
|
|
174 | (5) |
|
|
179 | (12) |
|
Importing Cubemaps from 2D Textures |
|
|
180 | (2) |
|
|
182 | (7) |
|
Using Cubemaps in Shader Graph |
|
|
189 | (2) |
|
|
191 | (2) |
|
Chapter 7 The Depth Buffer |
|
|
193 | (80) |
|
How Rendering Opaque Objects Works |
|
|
193 | (5) |
|
How the Depth Buffer Works |
|
|
195 | (1) |
|
|
196 | (2) |
|
Depth Testing and Writing |
|
|
198 | (8) |
|
|
198 | (2) |
|
|
200 | (1) |
|
Depth Settings with Shader Graph |
|
|
201 | (2) |
|
|
203 | (1) |
|
|
204 | (2) |
|
Shader Effects Using Depth |
|
|
206 | (27) |
|
|
206 | (13) |
|
Writing to the Depth Texture Using a Depth-Only Pass |
|
|
219 | (5) |
|
|
224 | (9) |
|
|
233 | (11) |
|
|
234 | (10) |
|
|
244 | (4) |
|
|
246 | (2) |
|
|
248 | (16) |
|
|
248 | (10) |
|
X-Ray Effect with URP Render Objects (No Code) |
|
|
258 | (6) |
|
Impossible Room Effect Using Stencils |
|
|
264 | (7) |
|
Impossible Room Effect with HLSL |
|
|
265 | (3) |
|
Impossible Room Effect with Render Objects |
|
|
268 | (3) |
|
|
271 | (2) |
|
Chapter 8 Transparency and Alpha |
|
|
273 | (48) |
|
How Rendering Transparent Objects Works |
|
|
273 | (16) |
|
|
274 | (15) |
|
|
289 | (30) |
|
|
291 | (4) |
|
Alpha Cutout in Shader Graph |
|
|
295 | (4) |
|
Dithered Transparency with Alpha Clip |
|
|
299 | (8) |
|
Dissolve Effect with Alpha Clip |
|
|
307 | (12) |
|
|
319 | (2) |
|
Chapter 9 More Shader Fundamentals |
|
|
321 | (36) |
|
|
321 | (11) |
|
Cycling Colors with the HelloWorld Shader |
|
|
321 | (4) |
|
|
325 | (7) |
|
Controlling Shaders with Animations |
|
|
332 | (1) |
|
|
333 | (9) |
|
|
334 | (4) |
|
Shader Keywords in Shader Graph |
|
|
338 | (3) |
|
Modifying Keywords Using C# Scripting |
|
|
341 | (1) |
|
|
342 | (2) |
|
|
344 | (11) |
|
Sepia Tone Effect Using GrabPass in the Built-in Pipeline |
|
|
345 | (4) |
|
Sepia Tone Effect Using Camera Opaque Texture in URP |
|
|
349 | (4) |
|
Sepia Tone Effect Using the Scene Color Node in Shader Graph |
|
|
353 | (2) |
|
|
355 | (2) |
|
Chapter 10 Lighting and Shadows |
|
|
357 | (94) |
|
|
357 | (53) |
|
|
357 | (2) |
|
|
359 | (1) |
|
|
360 | (3) |
|
|
363 | (2) |
|
Blinn-Phong Reflection Model |
|
|
365 | (45) |
|
Physically Based Rendering |
|
|
410 | (33) |
|
|
411 | (2) |
|
|
413 | (1) |
|
|
413 | (1) |
|
|
414 | (1) |
|
|
415 | (1) |
|
|
416 | (1) |
|
PBR in the Built-in Pipeline |
|
|
417 | (9) |
|
|
426 | (12) |
|
|
438 | (5) |
|
|
443 | (6) |
|
Shadow Casting in the Built-in Pipeline |
|
|
444 | (2) |
|
|
446 | (2) |
|
Shadow Casting in Shader Graph |
|
|
448 | (1) |
|
|
449 | (2) |
|
Chapter 11 Image Effects and Post-Processing |
|
|
451 | (66) |
|
|
451 | (3) |
|
|
454 | (2) |
|
|
456 | (32) |
|
Post-Processing in the Built-in Pipeline |
|
|
457 | (6) |
|
|
463 | (14) |
|
|
477 | (11) |
|
Gaussian Blur Image Effect |
|
|
488 | (27) |
|
Gaussian Blur in the Built-in Pipeline |
|
|
491 | (6) |
|
|
497 | (9) |
|
|
506 | (9) |
|
|
515 | (2) |
|
Chapter 12 Advanced Shaders |
|
|
517 | (66) |
|
|
517 | (30) |
|
Water Wave Effect with Tessellation |
|
|
520 | (17) |
|
Level of Detail Using Tessellation |
|
|
537 | (10) |
|
|
547 | (10) |
|
Visualizing Normals with Geometry Shaders |
|
|
547 | (10) |
|
|
557 | (24) |
|
|
558 | (23) |
|
|
581 | (2) |
|
Chapter 13 Profiling and Optimization |
|
|
583 | (26) |
|
|
583 | (4) |
|
|
586 | (1) |
|
|
587 | (5) |
|
Identifying Problems with the Frame Debugger |
|
|
589 | (3) |
|
Common Pitfalls and How to Fix Them |
|
|
592 | (14) |
|
|
592 | (2) |
|
Expensive Fragment Shaders |
|
|
594 | (12) |
|
|
606 | (3) |
|
Chapter 14 Shader Recipes for Your Games |
|
|
609 | (110) |
|
World-Space Scan Post-Process |
|
|
609 | (38) |
|
World-Space Scan in the Built-in Pipeline |
|
|
611 | (10) |
|
|
621 | (13) |
|
|
634 | (13) |
|
|
647 | (15) |
|
Cel-Shaded Lighting in HLSL |
|
|
648 | (8) |
|
Cel-Shaded Lighting in Shader Graph |
|
|
656 | (6) |
|
|
662 | (27) |
|
Interactive Snow C# Scripting |
|
|
664 | (12) |
|
Interactive Snow Compute Shader |
|
|
676 | (3) |
|
Interactive Snow Mesh Shader |
|
|
679 | (10) |
|
|
689 | (10) |
|
|
690 | (7) |
|
Holograms in Shader Graph |
|
|
697 | (2) |
|
|
699 | (17) |
|
|
700 | (8) |
|
|
708 | (8) |
|
|
716 | (3) |
Index |
|
719 | |