UnlitTrans.shader 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //Very simple shader that displays a single color but with transparency and no depth testing.
  2. //Used on the colored cubes in the Simple Marker Placement sample.
  3. Shader "Unlit/UnlitTrans"
  4. {
  5. Properties
  6. {
  7. _Color("Color", Color) = (1,1,1,1)
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Transparent" "RenderQueue"="Transparent" }
  12. Blend SrcAlpha OneMinusSrcAlpha
  13. ZTest Always
  14. ZWrite Off
  15. Pass
  16. {
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. // make fog work
  21. #pragma multi_compile_fog
  22. #include "UnityCG.cginc"
  23. struct appdata
  24. {
  25. float4 vertex : POSITION;
  26. };
  27. struct v2f
  28. {
  29. UNITY_FOG_COORDS(1)
  30. float4 vertex : SV_POSITION;
  31. };
  32. ;
  33. v2f vert (appdata v)
  34. {
  35. v2f o;
  36. o.vertex = UnityObjectToClipPos(v.vertex);
  37. UNITY_TRANSFER_FOG(o,o.vertex);
  38. return o;
  39. }
  40. fixed4 _Color;
  41. fixed4 frag (v2f i) : SV_Target
  42. {
  43. fixed4 col = _Color;
  44. // apply fog
  45. UNITY_APPLY_FOG(i.fogCoord, col);
  46. return _Color;
  47. }
  48. ENDCG
  49. }
  50. }
  51. }