clouds: intensify coverage, scale and detail
This commit is contained in:
1 parent
8000c7be0e
commit
cb847df3f5
2 files changed
+14
-14
No files matched your search
@@ -151,7 +151,7 @@ window.CONFIG = {
|
|||||||
// only ever reports sunny/cloudy/stormy, so the deck keeps that
|
// only ever reports sunny/cloudy/stormy, so the deck keeps that
|
||||||
// coverage through the night as well - 'night' is used by the weather
|
// coverage through the night as well - 'night' is used by the weather
|
||||||
// simulation (weatherSim: true) alone.
|
// simulation (weatherSim: true) alone.
|
||||||
density: { sunny: 0.30, cloudy: 0.80, stormy: 0.92 }
|
density: { sunny: 0.45, cloudy: 0.90, stormy: 1.00 }
|
||||||
// density: { sunny: 0.05, cloudy: 0.9, stormy: 1.0, night: 0.2 }
|
// density: { sunny: 0.05, cloudy: 0.9, stormy: 1.0, night: 0.2 }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Vendored
+13
-13
@@ -182,20 +182,20 @@ var FRAG_SRC = [
|
|||||||
'float cloudDensity(vec3 p, float baseThresh, float soft) {',
|
'float cloudDensity(vec3 p, float baseThresh, float soft) {',
|
||||||
'float py = p.y + earthDrop(p.xz);',
|
'float py = p.y + earthDrop(p.xz);',
|
||||||
'vec3 cp = vec3(p.x, py, p.z);',
|
'vec3 cp = vec3(p.x, py, p.z);',
|
||||||
'float n = fbm3(cp * 0.35 + vec3(0.0, 0.0, uTime * 0.06));',
|
'float n = fbm3(cp * 0.22 + vec3(0.0, 0.0, uTime * 0.05));',
|
||||||
// The detail octave weighs at most 0.20 and fades to zero with
|
// The detail octave weighs at most 0.20 and fades to zero with
|
||||||
// distance; past soft = 0.95 it contributes under 1 %, so the whole
|
// distance; past soft = 0.95 it contributes under 1 %, so the whole
|
||||||
// 4-octave lookup is skipped for the (numerous) far samples.
|
// 4-octave lookup is skipped for the (numerous) far samples.
|
||||||
'if (soft < 0.45) {',
|
'if (soft < 0.75) {',
|
||||||
'float d = fbm3(cp * 1.15 + vec3(uTime * 0.04, 7.3, uTime * 0.03));',
|
'float d = fbm3(cp * 1.80 + vec3(uTime * 0.045, 7.3, uTime * 0.035));',
|
||||||
'n = n + d * mix(0.12, 0.0, soft / 0.45);',
|
'n = n + d * mix(0.22, 0.0, soft / 0.75);',
|
||||||
'}',
|
'}',
|
||||||
// Cloud layer between uCloudBot and uCloudTop, densest in the
|
// Cloud layer between uCloudBot and uCloudTop, densest in the
|
||||||
// middle (bell curve). The layer follows the Earth curvature.
|
// middle (bell curve). The layer follows the Earth curvature.
|
||||||
'float h = clamp((py - uCloudBot) / (uCloudTop - uCloudBot), 0.0, 1.0);',
|
'float h = clamp((py - uCloudBot) / (uCloudTop - uCloudBot), 0.0, 1.0);',
|
||||||
'float profile = 4.0 * h * (1.0 - h); // bell curve',
|
'float profile = 4.0 * h * (1.0 - h); // bell curve',
|
||||||
'profile = max(profile, 0.0);',
|
'profile = max(profile, 0.0);',
|
||||||
'return smoothstep(baseThresh, baseThresh + 0.45 + soft * 0.35, n) * profile;',
|
'return smoothstep(baseThresh, baseThresh + 0.34 + soft * 0.28, n) * profile;',
|
||||||
'}',
|
'}',
|
||||||
// Star field: project ray onto a far sphere, hash-grid for
|
// Star field: project ray onto a far sphere, hash-grid for
|
||||||
// positions. Visible above the horizon at night with a small
|
// positions. Visible above the horizon at night with a small
|
||||||
@@ -502,7 +502,7 @@ var FRAG_SRC = [
|
|||||||
'float py = p.y + earthDrop(p.xz);',
|
'float py = p.y + earthDrop(p.xz);',
|
||||||
'if (py > uCloudTop || py < uCloudBot - 0.1) break;',
|
'if (py > uCloudTop || py < uCloudBot - 0.1) break;',
|
||||||
'if (tTerrain > 0.0 && t >= tTerrain) break;',
|
'if (tTerrain > 0.0 && t >= tTerrain) break;',
|
||||||
'float cSoft = smoothstep(3.0, 14.0, t);',
|
'float cSoft = smoothstep(4.0, 18.0, t);',
|
||||||
'float d = cloudDensity(p, baseThresh, cSoft);',
|
'float d = cloudDensity(p, baseThresh, cSoft);',
|
||||||
'if (d > 0.02) {',
|
'if (d > 0.02) {',
|
||||||
'float lit = clamp((py - uCloudBot) / ((uCloudTop - uCloudBot) * 1.167), 0.0, 1.0);',
|
'float lit = clamp((py - uCloudBot) / ((uCloudTop - uCloudBot) * 1.167), 0.0, 1.0);',
|
||||||
@@ -537,7 +537,7 @@ var FRAG_SRC = [
|
|||||||
'cloudCol = mix(uCloudShadow, uCloud, lit);',
|
'cloudCol = mix(uCloudShadow, uCloud, lit);',
|
||||||
'cloudCol = mix(cloudCol, uLight, max(0.15, uDayProgress) * 0.35 * lit);',
|
'cloudCol = mix(cloudCol, uLight, max(0.15, uDayProgress) * 0.35 * lit);',
|
||||||
'}',
|
'}',
|
||||||
'float alpha = clamp(d * stepSize * 1.15, 0.0, 1.0);',
|
'float alpha = clamp(d * stepSize * 1.30, 0.0, 1.0);',
|
||||||
'cloudSum += cloudCol * alpha * trans;',
|
'cloudSum += cloudCol * alpha * trans;',
|
||||||
'trans *= (1.0 - alpha);',
|
'trans *= (1.0 - alpha);',
|
||||||
'if (trans < 0.04) break;',
|
'if (trans < 0.04) break;',
|
||||||
@@ -698,18 +698,18 @@ var CLOUD_SAMPLER_GLSL = [
|
|||||||
'float cloudDensity(vec3 p, float baseThresh, float soft) {',
|
'float cloudDensity(vec3 p, float baseThresh, float soft) {',
|
||||||
'float py = p.y + earthDrop(p.xz);',
|
'float py = p.y + earthDrop(p.xz);',
|
||||||
'vec3 cp = vec3(p.x, py, p.z);',
|
'vec3 cp = vec3(p.x, py, p.z);',
|
||||||
'float n = fbm3(cp * 0.35 + vec3(0.0, 0.0, uTime * 0.06));',
|
'float n = fbm3(cp * 0.22 + vec3(0.0, 0.0, uTime * 0.05));',
|
||||||
// The detail octave weighs at most 0.20 and fades to zero with
|
// The detail octave weighs at most 0.20 and fades to zero with
|
||||||
// distance; past soft = 0.95 it contributes under 1 %, so the whole
|
// distance; past soft = 0.95 it contributes under 1 %, so the whole
|
||||||
// 4-octave lookup is skipped for the (numerous) far samples.
|
// 4-octave lookup is skipped for the (numerous) far samples.
|
||||||
'if (soft < 0.45) {',
|
'if (soft < 0.75) {',
|
||||||
'float d = fbm3(cp * 1.15 + vec3(uTime * 0.04, 7.3, uTime * 0.03));',
|
'float d = fbm3(cp * 1.80 + vec3(uTime * 0.045, 7.3, uTime * 0.035));',
|
||||||
'n = n + d * mix(0.12, 0.0, soft / 0.45);',
|
'n = n + d * mix(0.22, 0.0, soft / 0.75);',
|
||||||
'}',
|
'}',
|
||||||
'float h = clamp((py - uCloudBot) / (uCloudTop - uCloudBot), 0.0, 1.0);',
|
'float h = clamp((py - uCloudBot) / (uCloudTop - uCloudBot), 0.0, 1.0);',
|
||||||
'float profile = 4.0 * h * (1.0 - h);',
|
'float profile = 4.0 * h * (1.0 - h);',
|
||||||
'profile = max(profile, 0.0);',
|
'profile = max(profile, 0.0);',
|
||||||
'return smoothstep(baseThresh, baseThresh + 0.45 + soft * 0.35, n) * profile;',
|
'return smoothstep(baseThresh, baseThresh + 0.34 + soft * 0.28, n) * profile;',
|
||||||
'}',
|
'}',
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
@@ -808,7 +808,7 @@ var TERRAIN_FRAG_SRC = [
|
|||||||
'float dens = 0.0;',
|
'float dens = 0.0;',
|
||||||
'for (int ci = 0; ci < 5; ci++) {',
|
'for (int ci = 0; ci < 5; ci++) {',
|
||||||
'float tt = mix(tBot, tTop, (float(ci) + 0.5) / 5.0);',
|
'float tt = mix(tBot, tTop, (float(ci) + 0.5) / 5.0);',
|
||||||
'dens += cloudDensity(vWorld + uSunDir * tt, baseTh, smoothstep(3.0, 14.0, tt));',
|
'dens += cloudDensity(vWorld + uSunDir * tt, baseTh, smoothstep(4.0, 18.0, tt));',
|
||||||
'}',
|
'}',
|
||||||
'cShadow = mix(uCloudShadowFloor, 1.0,',
|
'cShadow = mix(uCloudShadowFloor, 1.0,',
|
||||||
' exp(-dens * uCloudShadowDensity));',
|
' exp(-dens * uCloudShadowDensity));',
|
||||||
|
|||||||
Reference in new issue
Block a user