Reference
Quality levels
Four tiers, from integrated laptop GPUs to 4K desktops. A tier sets the particle counts, the fog and reflection step counts, the shelter taps and the shadow map size.
const weather = await WeatherSystem.create({ renderer, scene, camera, quality: 'medium' });
weather.setQualityLevel('ultra'); // at runtime
weather.quality; // 'ultra'
QUALITY_LEVELS.high; // the settings object#At a glance
| Level | Rain streaks | Flakes | Splashes | Fog steps / scale | SSR steps | Shadow map | Shelter taps | Pixel ratio* |
|---|---|---|---|---|---|---|---|---|
low | 18k | 9k | 500 | 20 / 0.35 | 12 | 1024 | 4 | 1.0 |
medium | 32k | 16k | 900 | 28 / 0.45 | 16 | 2048 | 6 | 1.25 |
high | 55k | 26k | 1500 | 36 / 0.5 | 20 | 2048 | 8 | 1.5 |
ultra | 90k | 42k | 2400 | 56 / 0.75 | 28 | 4096 | 12 | 2.0 |
* The pixel ratio is only applied with managePixelRatio: true. The demo applies it itself.
Particle counts are drawn at intensity 1. A drizzle at rain: 0.22 draws 22 % of them.
#Every field
| Field | Used by | |
|---|---|---|
rain | RainSystem | Streaks at full rain (capped by maxDrops, 90000) |
snow | SnowSystem | Flakes at full snow (capped by maxFlakes, 42000) |
splash | RainSystem | Splashes at full rain (capped by maxSplashes, 2400) |
fogSteps | WeatherPipeline | Volumetric fog raymarch steps |
fogScale | WeatherPipeline | Fog buffer resolution relative to the drawing buffer |
ssrSteps | WeatherPipeline | Puddle reflection ray steps |
shadowMapSize | your shadowLight | Applied to the light passed to setLighting({ shadowLight }) |
shelterTaps | SurfaceWeather | Occlusion taps per pixel for dry-under-roof surfaces. 0 turns shelter off |
pixelRatio | renderer | Recommended maximum pixel ratio |
fogSteps, fogScale and ssrSteps only matter with weather.render(). Changing shelterTaps recompiles every patched material, so avoid switching tiers every frame.
#What it costs
Measured on an Apple M5 in headless Chromium at 1280 × 720, high, pixel ratio 1.5: 5.5–10 ms of GPU and CPU time per frame, depending on the preset. That's 100 fps or more; the demo itself runs at the 120 Hz cap. To measure your own machine, the dev helper node scripts/perf.mjs --quality high reports the frame cost per preset.
#Choosing a tier
- Start at
high. It's the default, and what the numbers above were measured on. - Test with full rain.
downpoursetsrain: 1, which draws every streak and splash the tier allows. Check your frame rate on it, not onclear. - Watch the pixel ratio. The scene pass, SSR and bloom run at the drawing-buffer size, and the fog at a fraction of it. On high-DPI screens, cap
renderer.setPixelRatio()at the tier'spixelRatio, or passmanagePixelRatio: true. - Adapt once, early. The demo measures its 2nd to 6th second and drops a tier below 30 fps. It's a simple pattern worth copying: see
demo/main.js.
// the demo's tier switch
function setQuality(level) {
weather.setQualityLevel(level);
renderer.setPixelRatio(Math.min(devicePixelRatio, QUALITY_LEVELS[level].pixelRatio));
renderer.setSize(innerWidth, innerHeight);
}