Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


camera

This is an old revision of the document!


Camera

Camera.SetReplacementShader

SetReplacementShader will not render objects if their original materials don't contain any properties required by the replacement shader. For example, if your replacement shader uses _MainTex, and there is an object in the scene that doesn't have _MainTex, it won't be rendered at all.

The 'tag' argument accepts the name of a tag in the 'Tags' property block of the shader. When provided, Unity will pick a sub-shader from the replacement shader that matches the value of the Tag. So if the tag argument is 'RenderType', you can provide two sub-shaders 'Opaque' and 'Transparent' in the replacement shader, and Unity will pick the sub-shader that matches the original object.

Shaders can be replaced in the SceneView using SceneView.SetSceneViewShaderReplace.

camera.1623554841.txt.gz · Last modified: 2021/06/13 03:27 by uninomiconadmin