Do I have the process of creating a shader based off of Standard.shader correct?

I’m trying to create a shader that is based off of the Unity Standard shader with all of the options it has available, but it is starting to look overly complex. Am I going down the right path? Am I missing something obvious?

The steps that I have come up with to add a new material to the process of rendering my object:

  • Copy the Standard.shader and rename it to MyCustom.shader.
  • Add a new texture slot to it.
  • Copy the StandardShaderGUI.cs file and rename to MyCustomGUI.cs.
  • At the bottom of the file, point MyCustom.shader to MyCustomGUI.cs.
  • Add the texture slot to the .cs file so that it shows up in the inspector. (Requires entries in multiple places to get it to work the same as the existing entries)
  • Copy UnityStandardCore.cginc and rename it MyCustomCore.cginc.
  • Point to MyCustomCore.cginc in the shader multiple times, depending on the pass.
  • Adjust the vert and frag shaders in the .cginc to use the new texture that was added.

It is indeed quite complex. The order of the includes puts the actual BRDF formula fairly deep in the tree, so you have to make quite a few copies of the includes to make a change there. I got a nice tour through the standard shader include structure at Unite Europe. The conclusion was that it’s absolutely possible to change the standard shader, but it does mean you have to go deep into the include structure. And the extra warning with that is that this include structure will probably change in future versions.

Yeah, that’s what I’m most afraid of. Well, good to know I’m not insane :slight_smile:

I’ve had success doing this, with the same steps as yourself. It took awhile to sort out how to, I wish it was a bit easier to extend.