Advertisement
Guest User

Untitled

a guest
May 5th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. Shader "Unlit/StripeShader"
  2. {
  3. Properties
  4. {
  5. // Color property for material inspector, default to white
  6. // _Color is the color of the grid lines, actually (need to flip these
  7. // at some point)
  8. _Color ("Main Color", Color) = (1,1,1,0.5)
  9. // _Color2 is actually the main body color
  10. _Color2 ("Other Color", Color) = (1,1,1,0.5)
  11. // Offset the grid pattern
  12. _OffsetX ("X Offset", Float) = 0
  13. _OffsetY ("Y Offset", Float) = 0
  14. }
  15. SubShader
  16. {
  17. // TODO: Figure out why transparency doesn't actually work right now
  18. Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" }
  19. Pass
  20. {
  21. ZWrite Off
  22. Blend DstAlpha OneMinusDstAlpha
  23.  
  24. CGPROGRAM
  25. #pragma vertex vert
  26. #pragma fragment frag
  27.  
  28. float4 vert (float4 vertex : POSITION) : SV_POSITION
  29. {
  30. // Basically just pass through the vertex coordinates in scale
  31. return mul(UNITY_MATRIX_MVP, vertex);
  32. }
  33.  
  34. // color from the material
  35. fixed4 _Color;
  36. fixed4 _Color2;
  37. float _OffsetX;
  38. float _OffsetY;
  39.  
  40. // pixel shader, no inputs needed
  41. fixed4 frag (float4 i : POSITION) : COLOR
  42. {
  43. // First two out of 10 pixel along either access, return hash color
  44. if((i.x + _OffsetX) % 10.0f < 2.0f || (i.y + _OffsetY) % 10.0f < 2.0f) {
  45. return _Color;
  46. } else {
  47. // Return main body color
  48. return _Color2;
  49. }
  50. }
  51. ENDCG
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement