Advertisement
Guest User

UI Pixel Snap.shader

a guest
Sep 13th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Shader "Super Text Mesh/UI/Pixel Snap" {
  2. Properties {
  3. _MainTex ("Font Texture", 2D) = "white" {}
  4. _MaskTex ("Mask Texture", 2D) = "white" {}
  5. }
  6.  
  7. SubShader {
  8. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  9. Lighting Off Cull Off ZWrite Off Fog { Mode Off }
  10. Blend SrcAlpha OneMinusSrcAlpha
  11. CGPROGRAM
  12. #pragma surface surf Lambert alpha vertex:vert
  13.  
  14. sampler2D _MainTex;
  15. sampler2D _MaskTex;
  16.  
  17. struct Input {
  18. float2 uv_MainTex : TEXCOORD0;
  19. float2 uv2_MaskTex : TEXCOORD1;
  20. float4 color : COLOR;
  21. };
  22.  
  23. void vert(inout appdata_full v){
  24. v.vertex = UnityPixelSnap (v.vertex);
  25. }
  26.  
  27. void surf (Input IN, inout SurfaceOutput surface) {
  28. half4 text = tex2D (_MainTex, IN.uv_MainTex.xy);
  29. half4 mask = tex2D (_MaskTex, IN.uv2_MaskTex.xy);
  30. surface.Emission = mask.rgb * IN.color.rgb;
  31. surface.Alpha = text.a * mask.a * IN.color.a;
  32. }
  33. ENDCG
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement