From db680130c7f06a4b9f2a594785044a43c8a0f4f6 Mon Sep 17 00:00:00 2001 From: PHO Date: Sun, 27 Jan 2019 21:21:52 +0900 Subject: [PATCH] Tweak some parameters of water and clouds to look better --- src/shaders/glsl/natural-mystic-cloud.h | 4 +--- src/shaders/glsl/natural-mystic-water.h | 2 +- src/shaders/glsl/sky.fragment | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/shaders/glsl/natural-mystic-cloud.h b/src/shaders/glsl/natural-mystic-cloud.h index 59ac714..c0d72d7 100644 --- a/src/shaders/glsl/natural-mystic-cloud.h +++ b/src/shaders/glsl/natural-mystic-cloud.h @@ -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. */ @@ -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); } diff --git a/src/shaders/glsl/natural-mystic-water.h b/src/shaders/glsl/natural-mystic-water.h index 99815b2..6de59bd 100644 --- a/src/shaders/glsl/natural-mystic-water.h +++ b/src/shaders/glsl/natural-mystic-water.h @@ -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 diff --git a/src/shaders/glsl/sky.fragment b/src/shaders/glsl/sky.fragment index 8cf08a3..605dc5f 100644 --- a/src/shaders/glsl/sky.fragment +++ b/src/shaders/glsl/sky.fragment @@ -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) @@ -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