Search code examples
unity-game-engineshaderoculuscg

Add Texture to Unlit Transparent Color Shader


How can I add a Texture to following shader given by Oculus API for fading :

Shader "Oculus/Unlit Transparent Color" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Texture", 2D) = "white" {} //  I added this property to apply Texture. Where can I use it?
}

SubShader {
    Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    LOD 100
    Fog {Mode Off}
    Cull Off
    ZWrite Off
    Blend SrcAlpha OneMinusSrcAlpha
    Color [_Color]

    Pass {}
}
}

Solution

  • As xyLe_ suggested in his post, In Pass{}block I added following code and it worked:

      SetTexture [_MainTex] {
                constantColor [_Color]
                Combine texture * primary DOUBLE, texture * constant
            }