Guest User

Untitled

a guest
Jun 24th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Shader "Custom/ColorWithMask" {
  2. Properties {
  3. _Color ("Color", Color) = (1,1,1,1)
  4. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5. _MaskTex("Mask For Color", 2D) = "white" {}
  6. }
  7. SubShader {
  8. Tags { "RenderType"="Opaque" }
  9. LOD 200
  10.  
  11. CGPROGRAM
  12. #pragma surface surf Lambert
  13.  
  14.  
  15. sampler2D _MainTex;
  16. sampler2D _MaskTex;
  17. struct Input {
  18. float2 uv_MainTex;
  19. };
  20. fixed4 _Color;
  21.  
  22. void surf (Input IN, inout SurfaceOutput o) {
  23. // Albedo comes from a texture tinted by color
  24. fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
  25. fixed4 m = tex2D(_MaskTex, IN.uv_MainTex);
  26. c *= lerp(1, _Color, m.r);
  27. o.Albedo = c.rgb;
  28. o.Alpha = c.a;
  29. }
  30. ENDCG
  31. }
  32. FallBack "Diffuse"
  33. }
Add Comment
Please, Sign In to add comment