Ertyui

Untitled

Feb 10th, 2013
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.91 KB | None | 0 0
  1. Shader "3Blend" {
  2.     Properties {
  3.         _tex1 ("Texture 1", 2D) = "white" {}
  4.         _tex2 ("Texture 2", 2D) = "white" {}
  5.         _tex3 ("Texture 3", 2D) = "white" {}
  6.        
  7.     }
  8.     SubShader
  9.     {
  10.         Tags { "RenderType"="Opaque"}      
  11.         pass
  12.         {
  13.             CGPROGRAM
  14.             #pragma vertex VertexOutput
  15.             #pragma fragment FragmentOutput
  16.             #include "UnityCG.cginc"
  17.             sampler2D _tex1;
  18.             sampler2D _tex2;
  19.             sampler2D _tex3;
  20.  
  21.             struct VertOut
  22.             {
  23.                 float4 position : POSITION;
  24.                 float4 color : COLOR;
  25.                 float4 uv : TEXCOORD0;
  26.             };
  27.  
  28.             struct VertIn
  29.             {
  30.                 float4 vertex : POSITION;
  31.                 float4 color : COLOR;
  32.                 float4 texcoord : TEXCOORD0;
  33.             };
  34.  
  35.             VertOut VertexOutput(VertIn input, float3 normal : NORMAL)
  36.             {
  37.                 VertOut output;
  38.                 output.position = mul(UNITY_MATRIX_MVP,input.vertex);
  39.                 output.color = input.color;
  40.                 output.uv = float4(input.texcoord.xy,0,0);
  41.                 return output;
  42.             }
  43.  
  44.             struct FragOut
  45.             {
  46.                 float4 color : COLOR;
  47.             };
  48.  
  49.             FragOut FragmentOutput(float4 color : COLOR, float4 uv : TEXCOORD0)
  50.             {
  51.                 FragOut output;
  52.                 float4 vColor = color;
  53.                 float4 t1 = tex2D(_tex1,uv.xy);
  54.                 float4 t2 = tex2D(_tex2,uv.xy);
  55.                 float4 t3 = tex2D(_tex3,uv.xy);
  56.                
  57.                 float4 final = t1*vColor.x + t2*vColor.y;
  58.                 final = t3*vColor.z + final*(1-vColor.z);
  59.                 output.color = final;
  60.                
  61.                 return output;
  62.             }
  63.             ENDCG
  64.  
  65.         }
  66.     }
  67.     FallBack "Diffuse"
  68. }
Advertisement
Add Comment
Please, Sign In to add comment