Shader Compilation, Branching, and Variants
In the first half of this book, we discussed various shading techniques that can help you create interesting visual effects in your game projects. We saw how to use Unity’s new URP pipeline and, in particular, its node-based shader editor – the Shader Graph.
Coding or branching up a shader to render a specific visual on screen is, of course, an essential skill for any technical artist, but there is something else that you should take into consideration if you want to master shaders: the art of optimization!
Indeed, knowing the inner workings of the tools you use is crucial to getting the most out of them, and this is especially the case with shaders, because of how compute-intensive they are. Moreover, nowadays, with the growing trend of mobile games, ensuring the best performance for your visuals is becoming paramount to your product actually being cross-platform.
So, in this chapter, we will highlight some of the...