root / Assets / Time of Day / Assets / Shaders / Skybox.shader @ 175:f9f5640c2a3a
History | View | Annotate | Download (1.2 kB)
1 | // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' |
---|---|
2 | |
3 | Shader "Time of Day/Skybox" |
4 | { |
5 | Properties |
6 | { |
7 | } |
8 | |
9 | CGINCLUDE |
10 | #include "UnityCG.cginc" |
11 | #include "TOD_Base.cginc" |
12 | #define TOD_SCATTERING_MIE 0 |
13 | #include "TOD_Scattering.cginc" |
14 | |
15 | struct v2f { |
16 | float4 position : SV_POSITION; |
17 | float4 color : TEXCOORD0; |
18 | }; |
19 | |
20 | v2f vert(appdata_base v) { |
21 | v2f o; |
22 | |
23 | o.position = mul(UNITY_MATRIX_MVP, v.vertex); |
24 | |
25 | float3 vertex = normalize(mul((float3x3)TOD_World2Sky, mul((float3x3)unity_ObjectToWorld, v.vertex.xyz))); |
26 | |
27 | o.color = (vertex.y < 0) ? half4(pow(TOD_GroundColor, TOD_Contrast), 1) : ScatteringColor(vertex.xyz, 1); |
28 | |
29 | #if !TOD_OUTPUT_HDR |
30 | o.color = TOD_HDR2LDR(o.color); |
31 | #endif |
32 | |
33 | #if !TOD_OUTPUT_LINEAR |
34 | o.color = TOD_LINEAR2GAMMA(o.color); |
35 | #endif |
36 | |
37 | return o; |
38 | } |
39 | |
40 | float4 frag(v2f i) : COLOR { |
41 | return i.color; |
42 | } |
43 | ENDCG |
44 | |
45 | SubShader |
46 | { |
47 | Tags |
48 | { |
49 | "Queue"="Background" |
50 | "RenderType"="Background" |
51 | "PreviewType"="Skybox" |
52 | } |
53 | |
54 | Pass |
55 | { |
56 | Cull Off |
57 | ZWrite Off |
58 | ZTest LEqual |
59 | |
60 | CGPROGRAM |
61 | #pragma vertex vert |
62 | #pragma fragment frag |
63 | #pragma multi_compile _ TOD_OUTPUT_HDR |
64 | #pragma multi_compile _ TOD_OUTPUT_LINEAR |
65 | ENDCG |
66 | } |
67 | } |
68 | |
69 | Fallback Off |
70 | } |