Checkerboard.shader 945 B

123456789101112131415161718192021222324252627282930313233
  1. Shader "Hidden/Checkerboard"
  2. {
  3. SubShader
  4. {
  5. // No culling or depth
  6. Cull Off ZWrite Off ZTest Always
  7. Pass
  8. {
  9. CGPROGRAM
  10. #pragma vertex vert_img
  11. #pragma fragment frag
  12. #include "UnityCG.cginc"
  13. static const float rows = 24;
  14. static const float columns = 24;
  15. float4 frag(v2f_img i) : COLOR
  16. {
  17. float3 col1 = float3(32.0/255.0, 32.0/255.0, 32.0/255.0);
  18. float3 col2 = float3(42.0/255.0, 42.0/255.0, 42.0/255.0);
  19. if (!IsGammaSpace()) {
  20. col1 = GammaToLinearSpace(col1);
  21. col2 = GammaToLinearSpace(col2);
  22. }
  23. float total = floor(i.uv.x * rows) + floor(i.uv.y * columns);
  24. return float4(lerp(col1, col2, step(fmod(total, 2.0), 0.5)), 1.0);
  25. }
  26. ENDCG
  27. }
  28. }
  29. }