Skip to content

Quality Levels

typescript
import {
  QUALITY_LEVELS,
  type QualityLevel,
  type QualityLevelConfig,
  type NoiseDim3,
} from "threejs-sky-pro";

Types

typescript
type QualityLevel = "low" | "medium" | "high" | "ultra";
interface QualityLevelConfig {
  // reconstruction divisor; cloud rendering mode applies another 2× or 4× reduction
  cloudHistoryDiv: 1 | 2 | 4 | 8;
  // accumulated cloud opacity where screen lighting switches to its cheaper approximation ([0, 1])
  cloudFullLightingAlpha: number;
  // cloud shadow-map resolution (square), px
  cloudShadowResolution: number;
  // mip the shadow bake samples the cloud field at (0 = finest)
  cloudShadowMipLevel: number;
  godRaysEnabled: boolean;
  // god-ray view-ray march step count
  godRaySteps: number;
  // bake the reflection env map per frame
  envMapEnabled: boolean;
  // bake clouds into the reflection
  envMapClouds: boolean;
  // equirect width, px
  envMapWidth: number;
  // equirect height, px (typically width / 2)
  envMapHeight: number;
  // env-map cloud raymarch steps
  envMapMarchSteps: number;
  // env-map base-shape noise mip floor
  envMapMipBase: number;
  // 2D weather-map resolution (square), px
  weatherMapResolution: number;
  // base-shape 3D noise resolution ({x,y,z}); non-tier sizes CPU-generate
  baseShapeDims: NoiseDim3;
}

"high" is the default tier.

Bundled Tiers

Fieldlowmediumhighultra
cloudHistoryDiv4222
cloudFullLightingAlpha0.30.30.50.7
cloudShadowResolution1282565121024
cloudShadowMipLevel3221
godRaysEnabledfalsetruetruetrue
godRaySteps16162424
envMapEnabledtruetruetruetrue
envMapCloudsfalsetruetruetrue
envMapWidth2563845121024
envMapHeight128192256512
envMapMarchSteps24324864
envMapMipBase3211
weatherMapResolution25651210241024
baseShapeDims16³32³64³64³

cloudHistoryDiv controls temporal-reconstruction resolution. Cloud rendering mode then reduces how many cloud rays render each frame:

text
Static or Dynamic raymarch divisor = cloudHistoryDiv × 4
Ultra Dynamic raymarch divisor = cloudHistoryDiv × 2

Static and Dynamic refresh every cloud sample over 16 frames. Ultra Dynamic refreshes every sample over 4 frames by rendering four times as many cloud rays per frame.

Screen-Cloud Resolutions

Stagelowmediumhighultra
Reconstruction1/4 × 1/4 screen1/2 × 1/2 screen1/2 × 1/2 screen1/2 × 1/2 screen
Raymarch with Static/Dynamic1/16 × 1/16 screen1/8 × 1/8 screen1/8 × 1/8 screen1/8 × 1/8 screen
Raymarch with Ultra Dynamic1/8 × 1/8 screen1/4 × 1/4 screen1/4 × 1/4 screen1/4 × 1/4 screen

The march renders every texel in its target each frame; reprojected history supplies the other positions until their next fresh sample.

Quality tiers configure screen-cloud resolution and lighting, cloud shadows, god rays, environment maps, weather-map resolution, and base-shape noise resolution. The bundled 16³, 32³, and 64³ noise volumes are precomputed; custom dimensions are generated at runtime.

The environment-map fields seed and update the map created by createSkyProvider({ envMap: true }). A standalone map from createEnvironmentMap() uses its own SkyEnvironmentOptions and is not retuned by setQualityLevel().

Switching At Runtime

typescript
await sky.setQualityLevel("ultra");

// With overrides
await sky.setQualityLevel("medium", {
  cloudFullLightingAlpha: 0.4,
  cloudShadowResolution: 512,
});

overrides is a Partial<QualityLevelConfig> applied on top of the selected tier.

See Also

Commercial License - All Rights Reserved.