您的位置:首页 > 其它

Rendering with Replaced Shaders

2014-07-27 15:46 447 查看
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:

  


参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/SL-ShaderReplacement.html

    
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: