@@ -147,6 +147,7 @@ VERTEX_OUTPUT VSMoon(VERTEX_INPUT In)
147
147
148
148
// This function adjusts brightness, saturation and contrast
149
149
// By Romain Dura aka Romz
150
+ // Colors edit by DR_Aeronautics
150
151
float3 ContrastSaturationBrightness (float3 color, float brt, float sat, float con)
151
152
{
152
153
// Increase or decrease theese values to adjust r, g and b color channels separately
@@ -173,10 +174,18 @@ float4 PSSky(VERTEX_OUTPUT In) : COLOR
173
174
float4 starColor = tex2D (StarMapSampler, TexCoord);
174
175
175
176
// Adjust sky color brightness for time of day
176
- skyColor *= SkyColor.x ;
177
+ skyColor *= SkyColor.y ;
177
178
178
- // Stars
179
- skyColor = lerp (starColor, skyColor, SkyColor.y);
179
+ // Stars (power function keeps stars hidden until after sunset)
180
+ // if-statement handles astronomical/final stage of twilight
181
+ if (LightVector.y < -0.2 )
182
+ {
183
+ skyColor = lerp (starColor, skyColor, LightVector.y*6.6 +2.22 );
184
+ }
185
+ else
186
+ {
187
+ skyColor = lerp (starColor, skyColor, pow (abs (SkyColor.y),0.125 ));
188
+ }
180
189
181
190
// Fogging
182
191
skyColor.rgb = lerp (skyColor.rgb, FogColor.rgb, saturate ((1 - In.Normal.y) * Fog.x));
@@ -189,11 +198,35 @@ float4 PSSky(VERTEX_OUTPUT In) : COLOR
189
198
// Coefficients selected by the author to achieve the desired appearance - fot limits the effect
190
199
skyColor += angleRcp * Fog.y;
191
200
192
- // increase orange at sunset - fog limits the effect
201
+ // increase orange at sunset and yellow at sunrise - fog limits the effect
193
202
if (LightVector.x < 0 )
194
203
{
195
- skyColor.r += SkyColor.z * angleRcp * Fog.z;
196
- skyColor.g += skyColor.r * Fog.w;
204
+ // These if-statements prevent the yellow-flash effect
205
+ if (LightVector.y > 0.13 )
206
+ {
207
+ skyColor.rg += SkyColor.z*2 * angleRcp * Fog.z;
208
+ skyColor.r += SkyColor.z*2 * angleRcp * Fog.z;
209
+ }
210
+
211
+ else
212
+ {
213
+ skyColor.rg += angleRcp * 0.075 * SkyColor.y;
214
+ skyColor.r += angleRcp * 0.075 * SkyColor.y;
215
+ }
216
+ }
217
+ else
218
+ {
219
+ if (LightVector.y > 0.15 )
220
+ {
221
+ skyColor.rg += SkyColor.z*3 * angleRcp * Fog.z;
222
+ skyColor.r += SkyColor.z * angleRcp * Fog.z;
223
+ }
224
+
225
+ else
226
+ {
227
+ skyColor.rg += angleRcp * 0.075 * SkyColor.y;
228
+ skyColor.r += pow (angleRcp * 0.075 * SkyColor.y,2 );
229
+ }
197
230
}
198
231
199
232
// Keep alpha opague
0 commit comments