Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "3Blend" {
- Properties {
- _tex1 ("Texture 1", 2D) = "white" {}
- _tex2 ("Texture 2", 2D) = "white" {}
- _tex3 ("Texture 3", 2D) = "white" {}
- }
- SubShader
- {
- Tags { "RenderType"="Opaque"}
- pass
- {
- CGPROGRAM
- #pragma vertex VertexOutput
- #pragma fragment FragmentOutput
- #include "UnityCG.cginc"
- sampler2D _tex1;
- sampler2D _tex2;
- sampler2D _tex3;
- struct VertOut
- {
- float4 position : POSITION;
- float4 color : COLOR;
- float4 uv : TEXCOORD0;
- };
- struct VertIn
- {
- float4 vertex : POSITION;
- float4 color : COLOR;
- float4 texcoord : TEXCOORD0;
- };
- VertOut VertexOutput(VertIn input, float3 normal : NORMAL)
- {
- VertOut output;
- output.position = mul(UNITY_MATRIX_MVP,input.vertex);
- output.color = input.color;
- output.uv = float4(input.texcoord.xy,0,0);
- return output;
- }
- struct FragOut
- {
- float4 color : COLOR;
- };
- FragOut FragmentOutput(float4 color : COLOR, float4 uv : TEXCOORD0)
- {
- FragOut output;
- float4 vColor = color;
- float4 t1 = tex2D(_tex1,uv.xy);
- float4 t2 = tex2D(_tex2,uv.xy);
- float4 t3 = tex2D(_tex3,uv.xy);
- float4 final = t1*vColor.x + t2*vColor.y;
- final = t3*vColor.z + final*(1-vColor.z);
- output.color = final;
- return output;
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment