perf: reduce cloud shadow samples

This commit is contained in:
Richard Zink committed 2026-10-13 20:36:12 +02:00
1 parent 99ca1b069c
commit 96161b1f9e
1 file changed
+3 -2
+3 -2
View File
@@ -1053,10 +1053,11 @@ var TERRAIN_FRAG_SRC = [
'if (tBot > 1e8) { tBot = 0.0; tTop = 14.0; }', 'if (tBot > 1e8) { tBot = 0.0; tTop = 14.0; }',
'if (tTop > 0.0 && tTop > tBot && tTop < 90.0) {', 'if (tTop > 0.0 && tTop > tBot && tTop < 90.0) {',
'float dens = 0.0;', 'float dens = 0.0;',
'for (int ci = 0; ci < 5; ci++) {', 'for (int ci = 0; ci < 3; ci++) {',
'float tt = mix(tBot, tTop, (float(ci) + 0.5) / 5.0);', 'float tt = mix(tBot, tTop, (float(ci) + 0.5) / 3.0);',
'dens += cloudDensity(vWorld + uSunDir * tt, baseTh, smoothstep(4.0, 18.0, tt));', 'dens += cloudDensity(vWorld + uSunDir * tt, baseTh, smoothstep(4.0, 18.0, tt));',
'}', '}',
'dens *= 5.0 / 3.0;',
'cShadow = mix(uCloudShadowFloor, 1.0,', 'cShadow = mix(uCloudShadowFloor, 1.0,',
' exp(-dens * uCloudShadowDensity));', ' exp(-dens * uCloudShadowDensity));',
'}', '}',