【Rendering with Replaced Shaders】
It works like this: the camera renders the scene as it normally would. the objects still use their materials, but the actual shader that ends up being used is changed:
如果replacementTag非空,则:
1)如果对象的shader没有replacementTag,则对象不被渲染。
2)在replacement shader中寻找相应replacement tag的subshader,如果没有,则不渲染。
3)用2)中的subshader渲染1)中replacement tag value相同的对象。
So if all shaders would have, for example, a "RenderType" tag with values like "Opaque", "Transparent", "Background", "Overlay", you could write a replacement shader that only renders solid objects by using one subshader with RenderType=Solid tag. The other tag types would not be found in the replacement shader, so the objects would be not rendered. Or you could write several subshaders for different "RenderType" tag values. Incidentally, all built-in Unity shaders have a "RenderType" tag set.
[Shader replacement tags in built-in Unity shaders]
All built-in Unity shaders have a “RenderType” tag set that can be used when rendering with replaced shaders. Tag values are the following: