TiledMasked.shader 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Shader "Imagine/TiledMasked"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  6. _MaskTex ("Mask (RGB)", 2D) = "white" {}
  7. }
  8. SubShader
  9. {
  10. Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  11. LOD 200
  12. CGPROGRAM
  13. // Physically based Standard lighting model, and enable shadows on all light types
  14. //#pragma surface surf Standard fullforwardshadows
  15. #pragma surface surf Standard alpha:fade
  16. // Use shader model 3.0 target, to get nicer looking lighting
  17. #pragma target 3.0
  18. sampler2D _MainTex;
  19. sampler2D _MaskTex;
  20. float4 _MainTex_ST;
  21. struct Input
  22. {
  23. float2 uv_MainTex;
  24. float2 uv_MaskTex;
  25. float3 worldPos;
  26. };
  27. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  28. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  29. // #pragma instancing_options assumeuniformscaling
  30. UNITY_INSTANCING_BUFFER_START(Props)
  31. // put more per-instance properties here
  32. UNITY_INSTANCING_BUFFER_END(Props)
  33. void surf (Input IN, inout SurfaceOutputStandard o)
  34. {
  35. // Albedo comes from a texture tinted by color
  36. fixed4 c = tex2D (_MainTex, IN.worldPos.xz * _MainTex_ST.xy);
  37. o.Albedo = c.rgb;
  38. o.Alpha = tex2D (_MaskTex, IN.uv_MaskTex) * c.a;
  39. }
  40. ENDCG
  41. }
  42. FallBack "Diffuse"
  43. }