Search Unity

Standard Shader with texture in highlights areas

Discussion in 'Shaders' started by bisewski, Mar 12, 2017.

  1. bisewski

    bisewski

    Joined:
    Jan 16, 2014
    Posts:
    304
    Hi all.

    How Can I apply an alpha in this shader ina custom color? I want apply my _colorTint only abs(v.normal); like in example in this page:

    https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html

    Shader "Example/Tint Final Color" {
    Properties {
    _MainTex ("Texture", 2D) = "white" {}
    _ColorTint ("Tint", Color) = (1.0, 0.6, 0.6, 1.0)
    }
    SubShader {
    Tags { "RenderType" = "Opaque" }
    CGPROGRAM
    #pragma surface surf Lambert finalcolor:mycolor
    struct Input {
    float2 uv_MainTex;
    };
    fixed4 _ColorTint;
    void mycolor (Input IN, SurfaceOutput o, inout fixed4 color)
    {
    color *= _ColorTint; //abs(v.normal);
    }
    sampler2D _MainTex;
    void surf (Input IN, inout SurfaceOutput o) {
    o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
    }
    ENDCG
    }
    Fallback "Diffuse"
    }
     
    Last edited: Mar 13, 2017