clouds: tune cloud coverage by weather density

This commit is contained in:
Richard Zink committed 2026-10-12 18:55:47 +02:00
1 parent 20af6dcdd5
commit b65936d44d
2 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -152,7 +152,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.45, cloudy: 0.90, stormy: 1.00 } density: { sunny: 0.12, cloudy: 0.60, stormy: 0.95, night: 0.35 }
// 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 }
}, },
+4 -2
View File
@@ -684,7 +684,9 @@ var FRAG_SRC = [
'if (tExit <= tEnter) { gl_FragColor = vec4(0.0); return; }', 'if (tExit <= tEnter) { gl_FragColor = vec4(0.0); return; }',
'float stepSize = (tExit - tEnter) / 24.0;', 'float stepSize = (tExit - tEnter) / 24.0;',
'float t = tEnter + stepSize * 0.5;', 'float t = tEnter + stepSize * 0.5;',
'float baseThresh = mix(0.55, 0.25, uDensity);', 'float coverage = clamp(uDensity, 0.0, 1.0);',
'float baseThresh = mix(0.72, 0.22, coverage);',
'float densityGain = mix(0.25, 1.0, coverage);',
'float sunUp = smoothstep(-0.20, 0.05, uSunAlt);', 'float sunUp = smoothstep(-0.20, 0.05, uSunAlt);',
'float cosT = dot(rd, uSunDir);', 'float cosT = dot(rd, uSunDir);',
'float phase = 0.30 + 0.70 * pow(max(0.0, cosT), 2.5);', 'float phase = 0.30 + 0.70 * pow(max(0.0, cosT), 2.5);',
@@ -705,7 +707,7 @@ var FRAG_SRC = [
'vec3 ambC = albC * max(vec3(uSkyAmb), uStarAmb * vec3(0.7, 0.85, 1.0)) * 1.7;', 'vec3 ambC = albC * max(vec3(uSkyAmb), uStarAmb * vec3(0.7, 0.85, 1.0)) * 1.7;',
'vec3 moonC = albC * uMoonColor * (0.35 + 0.65 * max(0.0, dot(rd, uMoonDir))) * uMoonInt * 3.0;', 'vec3 moonC = albC * uMoonColor * (0.35 + 0.65 * max(0.0, dot(rd, uMoonDir))) * uMoonInt * 3.0;',
'vec3 cloudCol = direct + ambC + moonC;', 'vec3 cloudCol = direct + ambC + moonC;',
'float alpha = clamp(d * stepSize * 3.50, 0.0, 1.0);', 'float alpha = clamp(d * stepSize * 3.50 * densityGain, 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;',