NewUnlitShader.shader 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Shader "Unlit/NewUnlitShader"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 100
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. // make fog work
  17. #pragma multi_compile_fog
  18. #include "UnityCG.cginc"
  19. struct appdata
  20. {
  21. float4 vertex : POSITION;
  22. float2 uv : TEXCOORD0;
  23. };
  24. struct v2f
  25. {
  26. float2 uv : TEXCOORD0;
  27. UNITY_FOG_COORDS(1)
  28. float4 vertex : SV_POSITION;
  29. };
  30. sampler2D _MainTex;
  31. float4 _MainTex_ST;
  32. v2f vert (appdata v)
  33. {
  34. v2f o;
  35. o.vertex = UnityObjectToClipPos(v.vertex);
  36. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  37. UNITY_TRANSFER_FOG(o,o.vertex);
  38. return o;
  39. }
  40. fixed4 frag (v2f i) : SV_Target
  41. {
  42. // sample the texture
  43. fixed4 col = tex2D(_MainTex, i.uv);
  44. // apply fog
  45. UNITY_APPLY_FOG(i.fogCoord, col);
  46. return col;
  47. }
  48. ENDCG
  49. }
  50. }
  51. }