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.

58 lines
1.3 KiB

  1. Shader "SkyboxPlus/Hemisphere"
  2. {
  3. Properties
  4. {
  5. [HDR] _TopColor("North Pole", Color) = (0.35, 0.37, 0.42)
  6. [HDR] _MiddleColor("Equator", Color) = (0.15, 0.15, 0.15)
  7. [HDR] _BottomColor("South Pole", Color) = (0.12, 0.13, 0.15)
  8. [Gamma] _Exposure("Exposure", Range(0, 8)) = 1
  9. }
  10. CGINCLUDE
  11. #include "UnityCG.cginc"
  12. half3 _TopColor;
  13. half3 _MiddleColor;
  14. half3 _BottomColor;
  15. half _Exposure;
  16. struct appdata_t {
  17. float4 vertex : POSITION;
  18. };
  19. struct v2f {
  20. float4 vertex : SV_POSITION;
  21. float3 texcoord : TEXCOORD0;
  22. };
  23. v2f vert(appdata_t v)
  24. {
  25. v2f o;
  26. o.vertex = UnityObjectToClipPos(v.vertex);
  27. o.texcoord = v.vertex.xyz;
  28. return o;
  29. }
  30. half4 frag(v2f i) : SV_Target
  31. {
  32. half t1 = max(+i.texcoord.y, 0);
  33. half t2 = max(-i.texcoord.y, 0);
  34. half3 c = lerp(lerp(_MiddleColor, _TopColor, t1), _BottomColor, t2);
  35. return half4(c * _Exposure, 1);
  36. }
  37. ENDCG
  38. SubShader
  39. {
  40. Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
  41. Cull Off ZWrite Off
  42. Pass
  43. {
  44. CGPROGRAM
  45. #pragma vertex vert
  46. #pragma fragment frag
  47. ENDCG
  48. }
  49. }
  50. Fallback Off
  51. }