I am writing a shader to my Unity game and I want to have effect this type of effect:

  • Base texture, for example, skin of character is a texture that will use shadows, lighting.
  • Second texture, unlit, it will not be using shadows, it will be moving and changing alpha intensity.
  • Second texture will be drawn after base texture.

Only unlit or surface shader looks bad, I think I must connect those two shaders, to make nice looking effect.

I wrote something this and I am stuck:

Shader "My/SurfaceUnlitBlend"
        _MainTex("Base", 2D) = "white" {}
        _MainColor("Main Texture Color", Color) = (1,1,1,1)
        _SecTex("Second Texture", 2D) = "white" {}
        _SecColor("Second Texture Color", Color) = (1,1,1,1)
        _SecTexAnimHSpeed("Second Texture Animation Horizontal Speed", Float) = 0
        _SecTexAnimVSpeed("Second Texture Animation Vertical Speed", Float) = 0
        _BlendValueModifier("Blend Value Modifier", Range(0.5, 2.0)) = 1
        _Glossiness("Smoothness", Range(0,1)) = 0.5
        _Metallic("Metallic", Range(0,1)) = 0.0

        Tags{ "RenderType" = "Opaque" }
        LOD 200

        #pragma surface surf Standard fullforwardshadows
        #pragma target 3.0

        struct Input
            float2 uv_MainTex;
            float2 uv_SecTex;

        sampler2D _MainTex;
        sampler2D _SecTex;

        fixed4 _MainColor;
        fixed4 _SecColor;

        fixed _SecTexAnimHSpeed;
        fixed _SecTexAnimVSpeed;

        fixed _BlendValueModifier;
        half _Glossiness;
        half _Metallic;


        void surf(Input IN, inout SurfaceOutputStandard o)
            // Albedo comes from a texture tinted by color
            fixed2 moveVector = fixed2(_SecTexAnimHSpeed, _SecTexAnimVSpeed);
            moveVector *= _Time[1];

            //set blend modifier according to time
            float blendLevel = (cos(_Time[1]) + 1.5) * _BlendValueModifier;

            //set colors
            fixed4 col1 = tex2D(_MainTex, IN.uv_MainTex) * _MainColor / 2;
            fixed4 col2 = tex2D(_SecTex, (IN.uv_SecTex + moveVector) / 15) * _SecColor * blendLevel;

            //blend colors
            fixed4 result = col1 + col2;
            o.Albedo = result;
    FallBack "Diffuse"

Because I don't know what to do, to have unlit effect in second texture.


1 Answer 1


I used two materials, one with fire shader second with normal shader for skin. The effect is exactly what I wanted, I read that another possible way could be subshaders, but I don't check it.

  • \$\begingroup\$ this isn't good way because it's not optimal way you can use multi pass \$\endgroup\$ Commented Jul 28, 2017 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .