Transforming Your Shader into a Lit PBS Shader
In Chapter 3, we discovered the basics of programming a shader for the new Universal Render Pipeline (URP) using HLSL code. We saw how it differs from legacy shader scripting, focused on a few commonly used built-in variables and functions that must be changed when switching over to this new ecosystem, and eventually applied all of this theory to a hands-on example. As a result, by the end of that chapter, we had a simple unlit URP shader with a base color and a main texture property.
This was a nice introduction to the topic, but of course, modern video games only rarely ship with this rough a shading level – while having all of your objects unlit could be a conscious artistic choice, it would be interesting to also be able to create lit shaders, right?
This is why, in this chapter, we will build upon the unlit URP shader we wrote previously and implement all that is required to take into account the main and additional lights...