Skip to content

Commit 704731a

Browse files
Updated Skyshader to address the error found by Csantucci
Bracketed the pow() functions with abs() to prevent the non-negative advisory error. Also added better control in astronomical twilight to return the stars to their pre-update brightness at the onset of full night.
1 parent 688d0cd commit 704731a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Source/RunActivity/Content/SkyShader.fx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@ float4 PSSky(VERTEX_OUTPUT In) : COLOR
177177
skyColor *= SkyColor.y;
178178

179179
// Stars (power function keeps stars hidden until after sunset)
180-
skyColor = lerp(starColor, skyColor, pow(SkyColor.y,0.125));
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+
}
181189

182190
// Fogging
183191
skyColor.rgb = lerp(skyColor.rgb, FogColor.rgb, saturate((1 - In.Normal.y) * Fog.x));

0 commit comments

Comments
 (0)