diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 1b33cce..6e1c985 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -44,7 +44,9 @@ var VERT_SRC = [ ].join('\n'); // Volumetric raymarch through a horizontal cloud layer. -// Cheap 3D value noise + 4-octave fbm. 28 raymarch steps. +// Cheap 3D value noise + 3-octave fbm. 18 raymarch steps. +// Tuned for low-end hardware: fewer steps + fewer noise samples +// per step keep the frame within budget on integrated GPUs. // Camera path is sinusoidal so the view occasionally dips // into the cloud deck for the "fly through the edges" feel. var FRAG_SRC = [ @@ -79,7 +81,7 @@ var FRAG_SRC = [ 'float fbm3(vec3 p) {', 'float v = 0.0;', 'float a = 0.5;', - 'for (int i = 0; i < 4; i++) {', + 'for (int i = 0; i < 3; i++) {', 'v += a * noise3(p);', 'p = p * 2.03 + vec3(13.7, 7.1, 19.3);', 'a *= 0.5;', @@ -119,10 +121,10 @@ var FRAG_SRC = [ 'float baseThresh = mix(0.72, 0.40, uDensity);', // March the cloud layer (bounded in Y). 'float t = 0.0;', - 'float stepSize = 0.55;', + 'float stepSize = 0.85;', 'float trans = 1.0;', // Pre-compute ray entry/exit on cloud layer for early out - 'for (int i = 0; i < 28; i++) {', + 'for (int i = 0; i < 18; i++) {', 'vec3 p = ro + rd * t;', 'if (p.y > 2.0 || p.y < -0.4) break;', 'float d = cloudDensity(p, baseThresh);',