Assignment for RMIT Mixed Reality in 2020
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.

79 lines
1.3 KiB

  1. // Unlit alpha-blended shader.
  2. // - no lighting
  3. // - no lightmap support
  4. // - supports tint color
  5. Shader "Unlit/Crosshair" {
  6. Properties
  7. {
  8. _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {}
  9. _Color ("Main Color", Color) = (0.5,0.5,0.5,0.5)
  10. }
  11. SubShader
  12. {
  13. LOD 100
  14. Tags
  15. {
  16. "Queue" = "Transparent"
  17. "IgnoreProjector" = "True"
  18. "RenderType" = "Transparent"
  19. }
  20. Cull Off
  21. Lighting Off
  22. ZTest Always
  23. ZWrite Off
  24. Fog { Mode Off }
  25. Offset -1, -1
  26. Blend SrcAlpha OneMinusSrcAlpha
  27. Pass
  28. {
  29. CGPROGRAM
  30. #pragma vertex vert
  31. #pragma fragment frag
  32. #include "UnityCG.cginc"
  33. struct appdata_t
  34. {
  35. float4 vertex : POSITION;
  36. float2 texcoord : TEXCOORD0;
  37. fixed4 color : COLOR;
  38. };
  39. struct v2f
  40. {
  41. float4 vertex : SV_POSITION;
  42. half2 texcoord : TEXCOORD0;
  43. fixed4 color : COLOR;
  44. };
  45. sampler2D _MainTex;
  46. float4 _MainTex_ST;
  47. fixed4 _Color;
  48. v2f vert (appdata_t v)
  49. {
  50. v2f o;
  51. o.vertex = UnityObjectToClipPos(v.vertex);
  52. o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  53. o.color = v.color;
  54. return o;
  55. }
  56. fixed4 frag (v2f i) : COLOR
  57. {
  58. fixed4 col = tex2D(_MainTex, i.texcoord) * i.color * _Color * 2.0;
  59. return col;
  60. }
  61. ENDCG
  62. }
  63. }
  64. }