1. Shader "WSP/FrameWork7"
    2. {
    3. Properties
    4. {
    5. [Header(Base Color Group)]
    6. [Space(10)]
    7. _Color("Color",Color) = (0,0,0,0)
    8. _Tex("MainTex",2D) = "White" {}
    9. [Space(15)]
    10. [Header(Dissolve Group)]
    11. [Space(10)]
    12. [Toggle]_DissolveEnabled("DissolveEnabled",int) = 0
    13. _Dissolve("DissolveTex",2D) = "White" {}
    14. [NoScaleOffset]_RampTex("Ramp(RGB)",2D) = "White" {}
    15. _Clip("Clip",Range(0,1)) = 0
    16. }
    17. SubShader
    18. {
    19. pass
    20. {
    21. CGPROGRAM
    22. #pragma vertex vert
    23. #pragma fragment frag
    24. #pragma multi_compile _ _DISSOLVEENABLED_ON
    25. #include "UnityCG.cginc"
    26. sampler2D _Tex;
    27. fixed4 _Color;
    28. sampler2D _Dissolve;float4 _Dissolve_ST;
    29. fixed _Clip;
    30. sampler _RampTex;
    31. struct appdata
    32. {
    33. float4 vertex :POSITION;
    34. float4 uv :TEXCOORD;
    35. };
    36. struct v2f
    37. {
    38. float4 pos :POSITION;
    39. float4 uv :TEXCOORD;
    40. };
    41. v2f vert(appdata v)
    42. {
    43. v2f o;
    44. o.pos = UnityObjectToClipPos(v.vertex);
    45. o.uv.xy = v.uv.xy;
    46. //o.uv.zw = v.uv *_Dissolve_ST.xy+_Dissolve_ST.zw;
    47. o.uv.zw = TRANSFORM_TEX(v.uv,_Dissolve);
    48. return o;
    49. }
    50. fixed4 frag(v2f i):SV_TARGET
    51. {
    52. fixed4 c;
    53. fixed4 tex = tex2D(_Tex,i.uv.xy);
    54. c = tex;
    55. c += _Color;
    56. #if _DISSOLVEENABLED_ON
    57. fixed4 dissolveUV = tex2D(_Dissolve,i.uv.zw);
    58. clip(dissolveUV-_Clip);
    59. fixed dissolveValue = saturate((dissolveUV-_Clip)/(_Clip+0.1-_Clip));
    60. fixed4 rampTex = tex1D(_RampTex,dissolveValue);
    61. c += rampTex;
    62. #endif
    63. return c;
    64. }
    65. ENDCG
    66. }
    67. }
    68. }