SkyboxPortal.shader 1.3 KB

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