Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

Shader Fade 2 Textures - Need Help

Discussion in 'Shaders' started by dashmasterful, Aug 28, 2011.

  1. dashmasterful

    dashmasterful

    Joined:
    Feb 3, 2010
    Posts:
    166
    I have this shader I found in the Wiki. It works but

    I need to have the ability to fade it out with iTween.FadeTo(gameObject,.2,0);
    obviously this doesn't work because _Color property isn't being applied in the "Pass" section. Can someone please help me out


    Code (csharp):
    1. Shader "Blend 2 Textures" {
    2.  
    3. Properties {
    4.     _Color ("Main Color", Color) = (1,1,1,1)
    5.     _Blend ("Blend", Range (0, 1) ) = 0
    6.     _MainTex ("Texture 1", 2D) = ""
    7.     _Texture2 ("Texture 2", 2D) = ""
    8.    
    9. }
    10.  
    11. SubShader {
    12.     Pass {
    13.         SetTexture[_MainTex]
    14.         SetTexture[_Texture2] {
    15.             ConstantColor (1,1,1, [_Blend])
    16.             Combine texture Lerp(constant) previous
    17.         }      
    18.     }
    19. }
    20.  
    21. }
     
  2. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Last edited: Aug 28, 2011
  3. dashmasterful

    dashmasterful

    Joined:
    Feb 3, 2010
    Posts:
    166
    no blend gives me the ability to cross between two textures, i need that, what i want is the ability to fade out the entire texture( for example when hiding the button), i want to fade it out
     
  4. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
unityunity