Adding properties to a shader
The properties of a shader are crucial for the shader pipeline as they allow the artist or user to assign textures and tweak shader values. Properties enable you to expose GUI elements in a material’s Inspector window, providing a visual means of adjusting shader parameters without the need for a separate editor.
Getting ready
Let’s see how this works in our current shader, StandardDiffuse, by creating some properties and learning more about the syntax involved. For this example, we will refit the shader we created previously. Instead of using a texture to create the visuals, the shader will only use a color and some other properties that we will be able to change directly from the Inspector window:
- Start by duplicating
StandardDiffuseShader. You can do this by selecting it from the Inspector tab and pressing Ctrl + D. This will create a copy calledStandardDiffuseShader 1. Go ahead and rename itStandardColor. - Next...