SimpleBrushShader.shader 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // /******************************************************************************
  2. // * File: SimpleBrushShader.shader
  3. // * Copyright (c) 2021 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
  4. // *
  5. // *
  6. // ******************************************************************************/
  7. Shader "Qualcomm/Drawing/SimpleBrushShader"
  8. {
  9. Properties
  10. {
  11. _MainTex ("Texture", 2D) = "white" {}
  12. }
  13. Category
  14. {
  15. Tags
  16. {
  17. "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane"
  18. }
  19. Blend SrcAlpha OneMinusSrcAlpha
  20. Cull Off
  21. Lighting Off
  22. ZWrite On
  23. SubShader
  24. {
  25. Pass
  26. {
  27. CGPROGRAM
  28. #include "UnityCG.cginc"
  29. #pragma vertex vert
  30. #pragma fragment frag
  31. struct vIn
  32. {
  33. float4 vertex : POSITION;
  34. float2 uv: TEXCOORD0;
  35. float4 color : COLOR;
  36. };
  37. struct v2f
  38. {
  39. float4 pos :SV_POSITION;
  40. float2 uv: TEXCOORD0;
  41. float4 color :COLOR;
  42. };
  43. sampler2D _MainTex;
  44. float4 _MainTex_ST;
  45. v2f vert(vIn v)
  46. {
  47. v2f o;
  48. o.pos = UnityObjectToClipPos(v.vertex);
  49. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  50. o.color = pow(v.color, 2.2); // fix linear to gamma
  51. return o;
  52. }
  53. float4 frag(v2f i) : COLOR
  54. {
  55. fixed4 tex = tex2D(_MainTex, i.uv);
  56. fixed4 color = tex * i.color;
  57. return color;
  58. }
  59. ENDCG
  60. }
  61. }
  62. }
  63. }