From 1e582c1f7f141ef1c33a7dbd5575ecf719992a39 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Tue, 13 Oct 2026 14:28:39 +0200 Subject: [PATCH] config: allow clouds in front of terrain --- config.js | 5 +++++ vendor/clouds3d.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index 423a8ce..1b7440f 100644 --- a/config.js +++ b/config.js @@ -339,6 +339,11 @@ window.CONFIG = { // ready. This avoids clouds appearing over an unfinished ground model. waitForTerrain: true, // false = draw clouds immediately // waitForTerrain: false + // Terrain occlusion for clouds. false draws clouds in front of the + // terrain mesh even when terrain is closer; true clips cloud rays + // against the terrain distance buffer. + terrainOcclusion: false, // inverted occlusion: clouds stay in front + // terrainOcclusion: true // Coverage per weather level, 0 = clear, 1 = overcast. Only the // levels listed here override the built-in defaults // (sunny 0.20, cloudy 0.70, stormy 0.80, night 0.45). Live weather diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 8ed4cdd..1310008 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -1506,6 +1506,7 @@ var CLOUD_NEAR_FADE_START = (typeof CLOUD_NEAR_FADE_CFG.start === 'number') ? Ma var CLOUD_NEAR_FADE_END = Math.max(CLOUD_NEAR_FADE_START + 0.1, (typeof CLOUD_NEAR_FADE_CFG.end === 'number') ? CLOUD_NEAR_FADE_CFG.end : 2.5); var CLOUDS_ON = !(window.CONFIG && window.CONFIG.clouds && window.CONFIG.clouds.enabled === false); var CLOUDS_WAIT_FOR_TERRAIN = !(window.CONFIG && window.CONFIG.clouds && window.CONFIG.clouds.waitForTerrain === false); +var CLOUD_TERRAIN_OCCLUSION = !(window.CONFIG && window.CONFIG.clouds && window.CONFIG.clouds.terrainOcclusion === false); function cloudsActive() { return CLOUDS_ON && (!CLOUDS_WAIT_FOR_TERRAIN || (elevTexture && terrainVbo)); } @@ -8030,7 +8031,7 @@ window.clouds3dRender = function(target) { gl.activeTexture(gl.TEXTURE7); gl.bindTexture(gl.TEXTURE_2D, terrainDistTex || null); gl.uniform1i(s.uTerrainDistTex, 7); - gl.uniform1f(s.uTerrainDistOk, (terrainDistOk && terrainDistTex) ? 1.0 : 0.0); + gl.uniform1f(s.uTerrainDistOk, (terrainDistOk && terrainDistTex && CLOUD_TERRAIN_OCCLUSION) ? 1.0 : 0.0); gl.disable(gl.DEPTH_TEST); gl.depthMask(false); gl.enable(gl.BLEND);