diff --git a/harness/scene/drive.cjs b/harness/scene/drive.cjs index 3b41c567..74c4a8b0 100644 --- a/harness/scene/drive.cjs +++ b/harness/scene/drive.cjs @@ -90,9 +90,11 @@ const [, , dir, mode, outdir = '.'] = process.argv; 'float terrainFbm(vec2 xz) { float a = 1.0, fr = 1.0, v = 0.0; for (int i = 0; i < W_OCTAVES; i++) { v += a * cultmath_snoise(vec3(xz * W_FREQ * fr, 0.0)); fr *= W_LACUNARITY; a *= W_GAIN; } return v; }', ], noErosion: ['#define W_ERODE_ENABLED 1', '#define W_ERODE_ENABLED 0'], + // Upper bound on what skipping sky rays would save: every upward ray misses at once. + noSkyMarch: [' bool hit = false;\n bool onTree = false;', ' if (rd.y > 0.0) { o_color = vec4(0.0); o_depth = W_FAR; return; }\n bool hit = false;\n bool onTree = false;'], noTree: ['float dr = treeDistance(p, leafness);', 'float dr = 1e9; leafness = 0.0;'], }; - const wanted = mode === 'variants' ? Object.keys(VARIANTS) : ['baseline']; + const wanted = mode === "variants" ? (process.env.ONLY ? process.env.ONLY.split(",") : Object.keys(VARIANTS)) : ['baseline']; const sizes = [ [960, 540], [540, 1200], diff --git a/src/app/features/scene/shaders/common.glsl b/src/app/features/scene/shaders/common.glsl index ac3bb784..6378a2e6 100644 --- a/src/app/features/scene/shaders/common.glsl +++ b/src/app/features/scene/shaders/common.glsl @@ -26,6 +26,6 @@ vec3 skyColor(vec3 rd) float h = clamp(rd.y, 0.0, 1.0); vec3 c = mix(u_skyHorizon, u_skyTop, pow(h, 0.45)); float s = max(dot(rd, u_sunDir), 0.0); - c += u_sunColor * (0.25 * pow(s, 8.0) + 1.5 * pow(s, 256.0)); + c += u_sunColor * (1.5 * pow(s, 256.0)); return c; } diff --git a/src/app/features/scene/shaders/terrain.frag.glsl b/src/app/features/scene/shaders/terrain.frag.glsl index 770325b0..b8f2f718 100644 --- a/src/app/features/scene/shaders/terrain.frag.glsl +++ b/src/app/features/scene/shaders/terrain.frag.glsl @@ -30,6 +30,10 @@ CultPhasor terrainPhacelle(vec2 xz) float terrainDistance(vec3 p) { float m = terrainMask(p.xz); + // Flat plateau: the height is exactly 0, so neither noise is evaluated. Sky rays spend most + // of their steps here. + if (m <= 0.0) + return p.y * W_SLOPE_ENV_INV; float hb = m * W_AMP * terrainFbm(p.xz); float above = p.y - (hb + m * W_ERODE_AMP); if (above > 0.0)