Skip to content

Commit

Permalink
Tweak some parameters of water and clouds to look better
Browse files Browse the repository at this point in the history
  • Loading branch information
depressed-pho committed Jan 27, 2019
1 parent f27895d commit db68013
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/shaders/glsl/natural-mystic-cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "natural-mystic-noise.h"

/* Generate a pattern of clouds based on a world position. */
highp float cloudMap(int octaves, highp float time, highp vec3 pos) {
highp float cloudMap(int octaves, float lowerBound, float upperBound, highp float time, highp vec3 pos) {
/* Use of highp is essential here, as the uniform TIME in mediump
* starts to lose precision within 10 minutes.
*/
Expand All @@ -20,8 +20,6 @@ highp float cloudMap(int octaves, highp float time, highp vec3 pos) {
/* We intentionally throw away some
* of the precision so we get somewhat sparse noise.
*/
const float lowerBound = 0.5;
const float upperBound = 0.85;
return fBM(octaves, lowerBound, upperBound, st * 3.0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shaders/glsl/natural-mystic-water.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ vec4 waterSpecularLight(
highp float incident = max(0.0, dot(viewDir, halfDir)); // Cosine of the angle.
highp float reflAngle = max(0.0, dot(halfDir, normal));
highp float reflCoeff = fresnel + (1.0 - fresnel) * pow(1.0 - incident, 5.0);
highp vec3 specular = incomingLight * 160.0 * pow(reflAngle, shininess) * reflCoeff;
highp vec3 specular = incomingLight * 180.0 * pow(reflAngle, shininess) * reflCoeff;

/* Compute the opacity of water. In real life when a light ray
* hits a surface of water, some part of it will reflect away, and
Expand Down
4 changes: 2 additions & 2 deletions src/shaders/glsl/sky.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void main() {
* as we cannot precompute noises in a texture and instead we have
* to generate them on the fly. See also
* http://www.iquilezles.org/www/articles/dynclouds/dynclouds.htm */
highp float density = cloudMap(octaves, TIME, worldPos);
highp float density = cloudMap(octaves, 0.5, 0.85, TIME, worldPos);
vec4 shadedCloud = mix(vec4(cloudColor.rgb, 0.0), cloudColor, density);

# if defined(ENABLE_CLOUD_SHADE)
Expand All @@ -46,7 +46,7 @@ void main() {
float inside = 0.0;
for (int i = 0; i < numSteps; i++) {
rayPos += rayStep;
highp float height = cloudMap(octaves / 2, TIME, rayPos);
highp float height = cloudMap(octaves / 2, 0.4, 1.0, TIME, rayPos);
inside += max(0.0, height - (rayPos.y - worldPos.y));
}
/* Average of height differences. This isn't a distance of ray
Expand Down

0 comments on commit db68013

Please sign in to comment.