Coding our lit PBS shader logic
Alright, we now have a nice structure for our PBS lit shader with the proper keywords and include statements. We also know what our data structures look like, so the next step is to discuss how to compute all these fields and fill in the logic to use all of this.
In the upcoming sections, we will prepare the various properties that our shader will offer to users to better control the shading result, then see how to initialize our SurfaceData
and InputData
structures, and finally, design the vertex and fragment shader functions.
Preparing our shader properties
We saw in the Discovering Unity PBR-related tooling section that we wanted our shader to support the most frequent PBS options – albedo, metallic or specular reflections, occlusion, normals, and so on.
Of course, we want our users to be able to tweak all of these parameters, so we want to expose various properties in the inspector panel for them. Let’s have a look at each...