-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebased, fixed and fine tuned values and fully implemented d/n cycle
also increased total day + night duration to 16min
- Loading branch information
leonidomgz
committed
Mar 5, 2020
1 parent
0c71255
commit 35ecfb1
Showing
3 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
#version 120 | ||
|
||
varying vec2 v_lightValue; | ||
|
||
uniform int u_time; | ||
|
||
vec4 fog(vec4 color, float fogCoord, float fogStart, float fogEnd) { | ||
float fog = clamp((fogEnd - fogCoord) / (fogEnd - fogStart), 0.0, 1.0); | ||
|
||
return mix(vec4(0.196078, 0.6, 0.8, 1.0), color, fog); | ||
const float pi = 3.1415927; | ||
const float frequency = 480000; | ||
// 960000 | ||
float time = mod(u_time, 960000); | ||
float sunlight = clamp((1 + cos(2 * pi / frequency * time) * 4.0), 0.0, 1.0); | ||
float red = clamp(sunlight - 0.55, 0.0, 0.45); | ||
float green = clamp(sunlight - 0.35, 0.0, 0.65); | ||
float blue = clamp(sunlight - 0.09, 0.0, 0.91); | ||
return mix(vec4(red, green, blue, 1.0), color, fog); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters