You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
652 B

  1. Shader "Hidden/TFHCPixelateUV"
  2. {
  3. Properties
  4. {
  5. _A ("_UV", 2D) = "white" {}
  6. _B ("_PixelX", 2D) = "white" {}
  7. _C ("_PixelY", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Pass
  12. {
  13. CGPROGRAM
  14. #include "UnityCG.cginc"
  15. #pragma vertex vert_img
  16. #pragma fragment frag
  17. sampler2D _A;
  18. sampler2D _B;
  19. sampler2D _C;
  20. float4 frag(v2f_img i) : SV_Target
  21. {
  22. float2 uv = tex2D( _A, i.uv ).rg;
  23. float pix = tex2D( _B, i.uv ).r;
  24. float piy = tex2D( _C, i.uv ).r;
  25. float2 steppedPixel = float2( pix, piy );
  26. float2 pixelatedUV = floor( uv * steppedPixel ) / steppedPixel;
  27. return float4(pixelatedUV, 0 , 0);
  28. }
  29. ENDCG
  30. }
  31. }
  32. }