@geoblocks/cesium-post-process 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/analog-video.d.ts +71 -0
- package/dist/analog-video.d.ts.map +1 -0
- package/dist/analog-video.js +128 -0
- package/dist/analog-video.js.map +1 -0
- package/dist/blur.d.ts +13 -0
- package/dist/blur.d.ts.map +1 -0
- package/dist/blur.js +36 -0
- package/dist/blur.js.map +1 -0
- package/dist/cesium-post-process.d.ts +30 -0
- package/dist/cesium-post-process.d.ts.map +1 -0
- package/dist/cesium-post-process.js +31 -0
- package/dist/cesium-post-process.js.map +1 -0
- package/dist/cloud-cover.d.ts +28 -0
- package/dist/cloud-cover.d.ts.map +1 -0
- package/dist/cloud-cover.js +45 -0
- package/dist/cloud-cover.js.map +1 -0
- package/dist/cloud-map.d.ts +7 -0
- package/dist/cloud-map.d.ts.map +1 -0
- package/dist/cloud-map.js +118 -0
- package/dist/cloud-map.js.map +1 -0
- package/dist/cloud-noise.d.ts +13 -0
- package/dist/cloud-noise.d.ts.map +1 -0
- package/dist/cloud-noise.js +222 -0
- package/dist/cloud-noise.js.map +1 -0
- package/dist/clouds.d.ts +275 -0
- package/dist/clouds.d.ts.map +1 -0
- package/dist/clouds.js +642 -0
- package/dist/clouds.js.map +1 -0
- package/dist/color-isolation.d.ts +38 -0
- package/dist/color-isolation.d.ts.map +1 -0
- package/dist/color-isolation.js +61 -0
- package/dist/color-isolation.js.map +1 -0
- package/dist/depth-test.d.ts +9 -0
- package/dist/depth-test.d.ts.map +1 -0
- package/dist/depth-test.js +35 -0
- package/dist/depth-test.js.map +1 -0
- package/dist/digital-video.d.ts +47 -0
- package/dist/digital-video.d.ts.map +1 -0
- package/dist/digital-video.js +102 -0
- package/dist/digital-video.js.map +1 -0
- package/dist/drone-display.d.ts +70 -0
- package/dist/drone-display.d.ts.map +1 -0
- package/dist/drone-display.js +158 -0
- package/dist/drone-display.js.map +1 -0
- package/dist/dufour.d.ts +108 -0
- package/dist/dufour.d.ts.map +1 -0
- package/dist/dufour.js +201 -0
- package/dist/dufour.js.map +1 -0
- package/dist/effect.d.ts +33 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +60 -0
- package/dist/effect.js.map +1 -0
- package/dist/focus.d.ts +11 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +23 -0
- package/dist/focus.js.map +1 -0
- package/dist/frame-clock.d.ts +11 -0
- package/dist/frame-clock.d.ts.map +1 -0
- package/dist/frame-clock.js +57 -0
- package/dist/frame-clock.js.map +1 -0
- package/dist/height.d.ts +12 -0
- package/dist/height.d.ts.map +1 -0
- package/dist/height.js +22 -0
- package/dist/height.js.map +1 -0
- package/dist/infrared.d.ts +23 -0
- package/dist/infrared.d.ts.map +1 -0
- package/dist/infrared.js +36 -0
- package/dist/infrared.js.map +1 -0
- package/dist/jello.d.ts +52 -0
- package/dist/jello.d.ts.map +1 -0
- package/dist/jello.js +136 -0
- package/dist/jello.js.map +1 -0
- package/dist/lens-distortion.d.ts +33 -0
- package/dist/lens-distortion.d.ts.map +1 -0
- package/dist/lens-distortion.js +61 -0
- package/dist/lens-distortion.js.map +1 -0
- package/dist/lightning.d.ts +124 -0
- package/dist/lightning.d.ts.map +1 -0
- package/dist/lightning.js +301 -0
- package/dist/lightning.js.map +1 -0
- package/dist/local-frame.d.ts +38 -0
- package/dist/local-frame.d.ts.map +1 -0
- package/dist/local-frame.js +52 -0
- package/dist/local-frame.js.map +1 -0
- package/dist/motion-blur.d.ts +50 -0
- package/dist/motion-blur.d.ts.map +1 -0
- package/dist/motion-blur.js +108 -0
- package/dist/motion-blur.js.map +1 -0
- package/dist/precipitation.d.ts +146 -0
- package/dist/precipitation.d.ts.map +1 -0
- package/dist/precipitation.js +454 -0
- package/dist/precipitation.js.map +1 -0
- package/dist/rain-rings.d.ts +100 -0
- package/dist/rain-rings.d.ts.map +1 -0
- package/dist/rain-rings.js +181 -0
- package/dist/rain-rings.js.map +1 -0
- package/dist/shaders/Alpenglow.d.ts +3 -0
- package/dist/shaders/Alpenglow.d.ts.map +1 -0
- package/dist/shaders/Alpenglow.js +3 -0
- package/dist/shaders/Alpenglow.js.map +1 -0
- package/dist/shaders/AnalogVideo.d.ts +3 -0
- package/dist/shaders/AnalogVideo.d.ts.map +1 -0
- package/dist/shaders/AnalogVideo.js +3 -0
- package/dist/shaders/AnalogVideo.js.map +1 -0
- package/dist/shaders/Beam.d.ts +3 -0
- package/dist/shaders/Beam.d.ts.map +1 -0
- package/dist/shaders/Beam.js +3 -0
- package/dist/shaders/Beam.js.map +1 -0
- package/dist/shaders/CloudsBlur.d.ts +3 -0
- package/dist/shaders/CloudsBlur.d.ts.map +1 -0
- package/dist/shaders/CloudsBlur.js +3 -0
- package/dist/shaders/CloudsBlur.js.map +1 -0
- package/dist/shaders/CloudsComposite.d.ts +3 -0
- package/dist/shaders/CloudsComposite.d.ts.map +1 -0
- package/dist/shaders/CloudsComposite.js +3 -0
- package/dist/shaders/CloudsComposite.js.map +1 -0
- package/dist/shaders/CloudsDensity.d.ts +3 -0
- package/dist/shaders/CloudsDensity.d.ts.map +1 -0
- package/dist/shaders/CloudsDensity.js +3 -0
- package/dist/shaders/CloudsDensity.js.map +1 -0
- package/dist/shaders/CloudsDepth.d.ts +3 -0
- package/dist/shaders/CloudsDepth.d.ts.map +1 -0
- package/dist/shaders/CloudsDepth.js +3 -0
- package/dist/shaders/CloudsDepth.js.map +1 -0
- package/dist/shaders/CloudsMarch.d.ts +3 -0
- package/dist/shaders/CloudsMarch.d.ts.map +1 -0
- package/dist/shaders/CloudsMarch.js +3 -0
- package/dist/shaders/CloudsMarch.js.map +1 -0
- package/dist/shaders/CloudsResolve.d.ts +3 -0
- package/dist/shaders/CloudsResolve.d.ts.map +1 -0
- package/dist/shaders/CloudsResolve.js +3 -0
- package/dist/shaders/CloudsResolve.js.map +1 -0
- package/dist/shaders/CloudsShadow.d.ts +3 -0
- package/dist/shaders/CloudsShadow.d.ts.map +1 -0
- package/dist/shaders/CloudsShadow.js +3 -0
- package/dist/shaders/CloudsShadow.js.map +1 -0
- package/dist/shaders/CloudsShadowMap.d.ts +3 -0
- package/dist/shaders/CloudsShadowMap.d.ts.map +1 -0
- package/dist/shaders/CloudsShadowMap.js +3 -0
- package/dist/shaders/CloudsShadowMap.js.map +1 -0
- package/dist/shaders/CloudsSlab.d.ts +3 -0
- package/dist/shaders/CloudsSlab.d.ts.map +1 -0
- package/dist/shaders/CloudsSlab.js +3 -0
- package/dist/shaders/CloudsSlab.js.map +1 -0
- package/dist/shaders/ColorIsolation.d.ts +3 -0
- package/dist/shaders/ColorIsolation.d.ts.map +1 -0
- package/dist/shaders/ColorIsolation.js +3 -0
- package/dist/shaders/ColorIsolation.js.map +1 -0
- package/dist/shaders/DepthEdges.d.ts +3 -0
- package/dist/shaders/DepthEdges.d.ts.map +1 -0
- package/dist/shaders/DepthEdges.js +3 -0
- package/dist/shaders/DepthEdges.js.map +1 -0
- package/dist/shaders/DigitalVideo.d.ts +3 -0
- package/dist/shaders/DigitalVideo.d.ts.map +1 -0
- package/dist/shaders/DigitalVideo.js +3 -0
- package/dist/shaders/DigitalVideo.js.map +1 -0
- package/dist/shaders/DroneDisplay.d.ts +3 -0
- package/dist/shaders/DroneDisplay.d.ts.map +1 -0
- package/dist/shaders/DroneDisplay.js +3 -0
- package/dist/shaders/DroneDisplay.js.map +1 -0
- package/dist/shaders/Dufour.d.ts +3 -0
- package/dist/shaders/Dufour.d.ts.map +1 -0
- package/dist/shaders/Dufour.js +3 -0
- package/dist/shaders/Dufour.js.map +1 -0
- package/dist/shaders/EyeFromDepth.d.ts +3 -0
- package/dist/shaders/EyeFromDepth.d.ts.map +1 -0
- package/dist/shaders/EyeFromDepth.js +3 -0
- package/dist/shaders/EyeFromDepth.js.map +1 -0
- package/dist/shaders/Filmic.d.ts +3 -0
- package/dist/shaders/Filmic.d.ts.map +1 -0
- package/dist/shaders/Filmic.js +3 -0
- package/dist/shaders/Filmic.js.map +1 -0
- package/dist/shaders/Flashlight.d.ts +3 -0
- package/dist/shaders/Flashlight.d.ts.map +1 -0
- package/dist/shaders/Flashlight.js +3 -0
- package/dist/shaders/Flashlight.js.map +1 -0
- package/dist/shaders/Fog.d.ts +3 -0
- package/dist/shaders/Fog.d.ts.map +1 -0
- package/dist/shaders/Fog.js +3 -0
- package/dist/shaders/Fog.js.map +1 -0
- package/dist/shaders/Frame.d.ts +3 -0
- package/dist/shaders/Frame.d.ts.map +1 -0
- package/dist/shaders/Frame.js +3 -0
- package/dist/shaders/Frame.js.map +1 -0
- package/dist/shaders/Hash.d.ts +3 -0
- package/dist/shaders/Hash.d.ts.map +1 -0
- package/dist/shaders/Hash.js +3 -0
- package/dist/shaders/Hash.js.map +1 -0
- package/dist/shaders/Height.d.ts +3 -0
- package/dist/shaders/Height.d.ts.map +1 -0
- package/dist/shaders/Height.js +3 -0
- package/dist/shaders/Height.js.map +1 -0
- package/dist/shaders/Infrared.d.ts +3 -0
- package/dist/shaders/Infrared.d.ts.map +1 -0
- package/dist/shaders/Infrared.js +3 -0
- package/dist/shaders/Infrared.js.map +1 -0
- package/dist/shaders/Jello.d.ts +3 -0
- package/dist/shaders/Jello.d.ts.map +1 -0
- package/dist/shaders/Jello.js +3 -0
- package/dist/shaders/Jello.js.map +1 -0
- package/dist/shaders/LensDistortion.d.ts +3 -0
- package/dist/shaders/LensDistortion.d.ts.map +1 -0
- package/dist/shaders/LensDistortion.js +3 -0
- package/dist/shaders/LensDistortion.js.map +1 -0
- package/dist/shaders/Lightning.d.ts +3 -0
- package/dist/shaders/Lightning.d.ts.map +1 -0
- package/dist/shaders/Lightning.js +3 -0
- package/dist/shaders/Lightning.js.map +1 -0
- package/dist/shaders/MotionBlur.d.ts +3 -0
- package/dist/shaders/MotionBlur.d.ts.map +1 -0
- package/dist/shaders/MotionBlur.js +3 -0
- package/dist/shaders/MotionBlur.js.map +1 -0
- package/dist/shaders/MotionBlurVelocity.d.ts +3 -0
- package/dist/shaders/MotionBlurVelocity.d.ts.map +1 -0
- package/dist/shaders/MotionBlurVelocity.js +3 -0
- package/dist/shaders/MotionBlurVelocity.js.map +1 -0
- package/dist/shaders/Noise.d.ts +3 -0
- package/dist/shaders/Noise.d.ts.map +1 -0
- package/dist/shaders/Noise.js +3 -0
- package/dist/shaders/Noise.js.map +1 -0
- package/dist/shaders/Normal.d.ts +3 -0
- package/dist/shaders/Normal.d.ts.map +1 -0
- package/dist/shaders/Normal.js +3 -0
- package/dist/shaders/Normal.js.map +1 -0
- package/dist/shaders/Phase.d.ts +3 -0
- package/dist/shaders/Phase.d.ts.map +1 -0
- package/dist/shaders/Phase.js +3 -0
- package/dist/shaders/Phase.js.map +1 -0
- package/dist/shaders/Precipitation.d.ts +3 -0
- package/dist/shaders/Precipitation.d.ts.map +1 -0
- package/dist/shaders/Precipitation.js +3 -0
- package/dist/shaders/Precipitation.js.map +1 -0
- package/dist/shaders/PrecipitationShaftBlur.d.ts +3 -0
- package/dist/shaders/PrecipitationShaftBlur.d.ts.map +1 -0
- package/dist/shaders/PrecipitationShaftBlur.js +3 -0
- package/dist/shaders/PrecipitationShaftBlur.js.map +1 -0
- package/dist/shaders/PrecipitationShafts.d.ts +3 -0
- package/dist/shaders/PrecipitationShafts.d.ts.map +1 -0
- package/dist/shaders/PrecipitationShafts.js +3 -0
- package/dist/shaders/PrecipitationShafts.js.map +1 -0
- package/dist/shaders/PrecipitationWind.d.ts +3 -0
- package/dist/shaders/PrecipitationWind.d.ts.map +1 -0
- package/dist/shaders/PrecipitationWind.js +3 -0
- package/dist/shaders/PrecipitationWind.js.map +1 -0
- package/dist/shaders/RainHaze.d.ts +3 -0
- package/dist/shaders/RainHaze.d.ts.map +1 -0
- package/dist/shaders/RainHaze.js +3 -0
- package/dist/shaders/RainHaze.js.map +1 -0
- package/dist/shaders/RainRings.d.ts +3 -0
- package/dist/shaders/RainRings.d.ts.map +1 -0
- package/dist/shaders/RainRings.js +3 -0
- package/dist/shaders/RainRings.js.map +1 -0
- package/dist/shaders/Shockwave.d.ts +3 -0
- package/dist/shaders/Shockwave.d.ts.map +1 -0
- package/dist/shaders/Shockwave.js +3 -0
- package/dist/shaders/Shockwave.js.map +1 -0
- package/dist/shaders/SkyTable.d.ts +3 -0
- package/dist/shaders/SkyTable.d.ts.map +1 -0
- package/dist/shaders/SkyTable.js +3 -0
- package/dist/shaders/SkyTable.js.map +1 -0
- package/dist/shaders/SnowLine.d.ts +3 -0
- package/dist/shaders/SnowLine.d.ts.map +1 -0
- package/dist/shaders/SnowLine.js +3 -0
- package/dist/shaders/SnowLine.js.map +1 -0
- package/dist/shaders/SpeedLines.d.ts +3 -0
- package/dist/shaders/SpeedLines.d.ts.map +1 -0
- package/dist/shaders/SpeedLines.js +3 -0
- package/dist/shaders/SpeedLines.js.map +1 -0
- package/dist/shaders/Spotlight.d.ts +3 -0
- package/dist/shaders/Spotlight.d.ts.map +1 -0
- package/dist/shaders/Spotlight.js +3 -0
- package/dist/shaders/Spotlight.js.map +1 -0
- package/dist/shaders/SpotlightBeam.d.ts +3 -0
- package/dist/shaders/SpotlightBeam.d.ts.map +1 -0
- package/dist/shaders/SpotlightBeam.js +3 -0
- package/dist/shaders/SpotlightBeam.js.map +1 -0
- package/dist/shaders/SpotlightBeamBlur.d.ts +3 -0
- package/dist/shaders/SpotlightBeamBlur.d.ts.map +1 -0
- package/dist/shaders/SpotlightBeamBlur.js +3 -0
- package/dist/shaders/SpotlightBeamBlur.js.map +1 -0
- package/dist/shaders/SpotlightCone.d.ts +3 -0
- package/dist/shaders/SpotlightCone.d.ts.map +1 -0
- package/dist/shaders/SpotlightCone.js +3 -0
- package/dist/shaders/SpotlightCone.js.map +1 -0
- package/dist/shaders/Super8.d.ts +3 -0
- package/dist/shaders/Super8.d.ts.map +1 -0
- package/dist/shaders/Super8.js +3 -0
- package/dist/shaders/Super8.js.map +1 -0
- package/dist/shaders/Technicolor.d.ts +3 -0
- package/dist/shaders/Technicolor.d.ts.map +1 -0
- package/dist/shaders/Technicolor.js +3 -0
- package/dist/shaders/Technicolor.js.map +1 -0
- package/dist/shaders/TiltShift.d.ts +3 -0
- package/dist/shaders/TiltShift.d.ts.map +1 -0
- package/dist/shaders/TiltShift.js +3 -0
- package/dist/shaders/TiltShift.js.map +1 -0
- package/dist/shaders/Toy.d.ts +3 -0
- package/dist/shaders/Toy.d.ts.map +1 -0
- package/dist/shaders/Toy.js +3 -0
- package/dist/shaders/Toy.js.map +1 -0
- package/dist/shaders/Trails.d.ts +3 -0
- package/dist/shaders/Trails.d.ts.map +1 -0
- package/dist/shaders/Trails.js +3 -0
- package/dist/shaders/Trails.js.map +1 -0
- package/dist/shaders/ValleyFog.d.ts +3 -0
- package/dist/shaders/ValleyFog.d.ts.map +1 -0
- package/dist/shaders/ValleyFog.js +3 -0
- package/dist/shaders/ValleyFog.js.map +1 -0
- package/dist/shaders/WeatherMap.d.ts +3 -0
- package/dist/shaders/WeatherMap.d.ts.map +1 -0
- package/dist/shaders/WeatherMap.js +3 -0
- package/dist/shaders/WeatherMap.js.map +1 -0
- package/dist/shaders/WhiteModel.d.ts +3 -0
- package/dist/shaders/WhiteModel.d.ts.map +1 -0
- package/dist/shaders/WhiteModel.js +3 -0
- package/dist/shaders/WhiteModel.js.map +1 -0
- package/dist/snow-line.d.ts +117 -0
- package/dist/snow-line.d.ts.map +1 -0
- package/dist/snow-line.js +201 -0
- package/dist/snow-line.js.map +1 -0
- package/dist/speed-lines.d.ts +36 -0
- package/dist/speed-lines.d.ts.map +1 -0
- package/dist/speed-lines.js +65 -0
- package/dist/speed-lines.js.map +1 -0
- package/dist/spotlight.d.ts +84 -0
- package/dist/spotlight.d.ts.map +1 -0
- package/dist/spotlight.js +175 -0
- package/dist/spotlight.js.map +1 -0
- package/dist/strikes.d.ts +17 -0
- package/dist/strikes.d.ts.map +1 -0
- package/dist/strikes.js +30 -0
- package/dist/strikes.js.map +1 -0
- package/dist/super8.d.ts +78 -0
- package/dist/super8.d.ts.map +1 -0
- package/dist/super8.js +146 -0
- package/dist/super8.js.map +1 -0
- package/dist/technicolor.d.ts +32 -0
- package/dist/technicolor.d.ts.map +1 -0
- package/dist/technicolor.js +51 -0
- package/dist/technicolor.js.map +1 -0
- package/dist/tilt-shift.d.ts +60 -0
- package/dist/tilt-shift.d.ts.map +1 -0
- package/dist/tilt-shift.js +112 -0
- package/dist/tilt-shift.js.map +1 -0
- package/dist/toy.d.ts +110 -0
- package/dist/toy.d.ts.map +1 -0
- package/dist/toy.js +173 -0
- package/dist/toy.js.map +1 -0
- package/dist/valley-fog.d.ts +56 -0
- package/dist/valley-fog.d.ts.map +1 -0
- package/dist/valley-fog.js +94 -0
- package/dist/valley-fog.js.map +1 -0
- package/dist/weather-map.d.ts +132 -0
- package/dist/weather-map.d.ts.map +1 -0
- package/dist/weather-map.js +266 -0
- package/dist/weather-map.js.map +1 -0
- package/dist/white-model.d.ts +70 -0
- package/dist/white-model.d.ts.map +1 -0
- package/dist/white-model.js +94 -0
- package/dist/white-model.js.map +1 -0
- package/package.json +19 -40
- package/{cesium-post-process.js → src/cesium-post-process.js} +2 -0
- package/src/local-frame.js +57 -0
- package/{rain-rings.js → src/rain-rings.js} +14 -28
- package/src/shaders/AnalogVideo.glsl +132 -0
- package/src/shaders/Beam.glsl +108 -0
- package/src/shaders/CloudsBlur.glsl +30 -0
- package/src/shaders/CloudsComposite.glsl +59 -0
- package/src/shaders/CloudsDensity.glsl +129 -0
- package/src/shaders/CloudsDepth.glsl +26 -0
- package/src/shaders/CloudsMarch.glsl +174 -0
- package/src/shaders/CloudsResolve.glsl +46 -0
- package/src/shaders/CloudsShadow.glsl +50 -0
- package/src/shaders/CloudsShadowMap.glsl +68 -0
- package/src/shaders/CloudsSlab.glsl +58 -0
- package/src/shaders/ColorIsolation.glsl +26 -0
- package/src/shaders/DepthEdges.glsl +81 -0
- package/src/shaders/DigitalVideo.glsl +65 -0
- package/src/shaders/DroneDisplay.glsl +337 -0
- package/src/shaders/Dufour.glsl +109 -0
- package/src/shaders/EyeFromDepth.glsl +36 -0
- package/src/shaders/Filmic.glsl +5 -0
- package/src/shaders/Fog.glsl +18 -0
- package/src/shaders/Frame.glsl +10 -0
- package/src/shaders/Hash.glsl +12 -0
- package/src/shaders/Height.glsl +25 -0
- package/src/shaders/Infrared.glsl +44 -0
- package/src/shaders/Jello.glsl +41 -0
- package/src/shaders/LensDistortion.glsl +24 -0
- package/src/shaders/Lightning.glsl +257 -0
- package/src/shaders/MotionBlur.glsl +71 -0
- package/src/shaders/MotionBlurVelocity.glsl +31 -0
- package/src/shaders/Noise.glsl +43 -0
- package/src/shaders/Normal.glsl +21 -0
- package/src/shaders/Phase.glsl +6 -0
- package/src/shaders/Precipitation.glsl +199 -0
- package/src/shaders/PrecipitationShaftBlur.glsl +21 -0
- package/src/shaders/PrecipitationShafts.glsl +84 -0
- package/src/shaders/PrecipitationWind.glsl +33 -0
- package/src/shaders/RainHaze.glsl +145 -0
- package/src/shaders/RainRings.glsl +64 -0
- package/src/shaders/SkyTable.glsl +23 -0
- package/src/shaders/SnowLine.glsl +97 -0
- package/src/shaders/SnowLine.js +2 -0
- package/src/shaders/SpeedLines.glsl +61 -0
- package/src/shaders/Spotlight.glsl +89 -0
- package/src/shaders/SpotlightBeam.glsl +49 -0
- package/src/shaders/SpotlightBeamBlur.glsl +27 -0
- package/src/shaders/SpotlightCone.glsl +37 -0
- package/src/shaders/Super8.glsl +90 -0
- package/src/shaders/Technicolor.glsl +30 -0
- package/src/shaders/TiltShift.glsl +34 -0
- package/src/shaders/Toy.glsl +46 -0
- package/src/shaders/ValleyFog.glsl +40 -0
- package/src/shaders/WeatherMap.glsl +33 -0
- package/src/shaders/WhiteModel.glsl +108 -0
- package/{snow-line.js → src/snow-line.js} +71 -3
- package/local-frame.js +0 -15
- package/shaders/SnowLine.js +0 -2
- /package/{analog-video.js → src/analog-video.js} +0 -0
- /package/{blur.js → src/blur.js} +0 -0
- /package/{cloud-cover.js → src/cloud-cover.js} +0 -0
- /package/{cloud-map.js → src/cloud-map.js} +0 -0
- /package/{cloud-noise.js → src/cloud-noise.js} +0 -0
- /package/{clouds.js → src/clouds.js} +0 -0
- /package/{color-isolation.js → src/color-isolation.js} +0 -0
- /package/{depth-test.js → src/depth-test.js} +0 -0
- /package/{digital-video.js → src/digital-video.js} +0 -0
- /package/{drone-display.js → src/drone-display.js} +0 -0
- /package/{dufour.js → src/dufour.js} +0 -0
- /package/{effect.js → src/effect.js} +0 -0
- /package/{focus.js → src/focus.js} +0 -0
- /package/{frame-clock.js → src/frame-clock.js} +0 -0
- /package/{height.js → src/height.js} +0 -0
- /package/{infrared.js → src/infrared.js} +0 -0
- /package/{jello.js → src/jello.js} +0 -0
- /package/{lens-distortion.js → src/lens-distortion.js} +0 -0
- /package/{lightning.js → src/lightning.js} +0 -0
- /package/{motion-blur.js → src/motion-blur.js} +0 -0
- /package/{precipitation.js → src/precipitation.js} +0 -0
- /package/{shaders → src/shaders}/Alpenglow.js +0 -0
- /package/{shaders → src/shaders}/AnalogVideo.js +0 -0
- /package/{shaders → src/shaders}/Beam.js +0 -0
- /package/{shaders → src/shaders}/CloudsBlur.js +0 -0
- /package/{shaders → src/shaders}/CloudsComposite.js +0 -0
- /package/{shaders → src/shaders}/CloudsDensity.js +0 -0
- /package/{shaders → src/shaders}/CloudsDepth.js +0 -0
- /package/{shaders → src/shaders}/CloudsMarch.js +0 -0
- /package/{shaders → src/shaders}/CloudsResolve.js +0 -0
- /package/{shaders → src/shaders}/CloudsShadow.js +0 -0
- /package/{shaders → src/shaders}/CloudsShadowMap.js +0 -0
- /package/{shaders → src/shaders}/CloudsSlab.js +0 -0
- /package/{shaders → src/shaders}/ColorIsolation.js +0 -0
- /package/{shaders → src/shaders}/DepthEdges.js +0 -0
- /package/{shaders → src/shaders}/DigitalVideo.js +0 -0
- /package/{shaders → src/shaders}/DroneDisplay.js +0 -0
- /package/{shaders → src/shaders}/Dufour.js +0 -0
- /package/{shaders → src/shaders}/EyeFromDepth.js +0 -0
- /package/{shaders → src/shaders}/Filmic.js +0 -0
- /package/{shaders → src/shaders}/Flashlight.js +0 -0
- /package/{shaders → src/shaders}/Fog.js +0 -0
- /package/{shaders → src/shaders}/Frame.js +0 -0
- /package/{shaders → src/shaders}/Hash.js +0 -0
- /package/{shaders → src/shaders}/Height.js +0 -0
- /package/{shaders → src/shaders}/Infrared.js +0 -0
- /package/{shaders → src/shaders}/Jello.js +0 -0
- /package/{shaders → src/shaders}/LensDistortion.js +0 -0
- /package/{shaders → src/shaders}/Lightning.js +0 -0
- /package/{shaders → src/shaders}/MotionBlur.js +0 -0
- /package/{shaders → src/shaders}/MotionBlurVelocity.js +0 -0
- /package/{shaders → src/shaders}/Noise.js +0 -0
- /package/{shaders → src/shaders}/Normal.js +0 -0
- /package/{shaders → src/shaders}/Phase.js +0 -0
- /package/{shaders → src/shaders}/Precipitation.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationShaftBlur.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationShafts.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationWind.js +0 -0
- /package/{shaders → src/shaders}/RainHaze.js +0 -0
- /package/{shaders → src/shaders}/RainRings.js +0 -0
- /package/{shaders → src/shaders}/Shockwave.js +0 -0
- /package/{shaders → src/shaders}/SkyTable.js +0 -0
- /package/{shaders → src/shaders}/SpeedLines.js +0 -0
- /package/{shaders → src/shaders}/Spotlight.js +0 -0
- /package/{shaders → src/shaders}/SpotlightBeam.js +0 -0
- /package/{shaders → src/shaders}/SpotlightBeamBlur.js +0 -0
- /package/{shaders → src/shaders}/SpotlightCone.js +0 -0
- /package/{shaders → src/shaders}/Super8.js +0 -0
- /package/{shaders → src/shaders}/Technicolor.js +0 -0
- /package/{shaders → src/shaders}/TiltShift.js +0 -0
- /package/{shaders → src/shaders}/Toy.js +0 -0
- /package/{shaders → src/shaders}/Trails.js +0 -0
- /package/{shaders → src/shaders}/ValleyFog.js +0 -0
- /package/{shaders → src/shaders}/WeatherMap.js +0 -0
- /package/{shaders → src/shaders}/WhiteModel.js +0 -0
- /package/{speed-lines.js → src/speed-lines.js} +0 -0
- /package/{spotlight.js → src/spotlight.js} +0 -0
- /package/{strikes.js → src/strikes.js} +0 -0
- /package/{super8.js → src/super8.js} +0 -0
- /package/{technicolor.js → src/technicolor.js} +0 -0
- /package/{tilt-shift.js → src/tilt-shift.js} +0 -0
- /package/{toy.js → src/toy.js} +0 -0
- /package/{valley-fog.js → src/valley-fog.js} +0 -0
- /package/{weather-map.js → src/weather-map.js} +0 -0
- /package/{white-model.js → src/white-model.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Jello.glsl.
|
|
2
|
+
export default "// The jello of a vibrating camera with a rolling shutter: the sensor reads its rows one after\n// another, so each row sees the camera at a different moment of its shake, and straight edges\n// wobble. After Readout's readout pass (stoatworks-labs, MIT): row r of H is read\n// `readout * (1 - r / H)` before the frame, the camera's pose is taken at the middle of the row's\n// exposure, and the shake is a few sinusoids in x, y and rotation. The phases come from the CPU,\n// in double precision; the picture is magnified by zoom so that its edges do not show.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// the shake: frequencies in Hz, phases at the frame's time in radians, amplitudes in picture\n// heights (x, y) and radians (rotation)\nuniform vec4 shakeHz;\nuniform vec4 phaseX;\nuniform vec4 phaseY;\nuniform vec4 phaseRotation;\nuniform vec4 amplitudeX;\nuniform vec4 amplitudeY;\nuniform vec4 amplitudeRotation;\nuniform float zoom;\nin vec2 v_textureCoordinates;\n\n// seconds to read all the rows, top down, and to expose each\nconst float READOUT = 0.02;\nconst float EXPOSURE = 0.004;\n\nvoid main() {\n vec2 size = czm_viewport.zw;\n // the row, from the top, and how long before the frame it was read, at the middle of its exposure\n float row = floor((1.0 - v_textureCoordinates.y) * size.y);\n float tau = READOUT * (1.0 - row / size.y) + 0.5 * EXPOSURE;\n vec4 arg = czm_twoPi * shakeHz * tau;\n vec2 shift = vec2(dot(amplitudeX, sin(phaseX - arg)), dot(amplitudeY, sin(phaseY - arg)));\n float rotation = dot(amplitudeRotation, sin(phaseRotation - arg));\n\n // centred, in picture heights, so that a rotation is not a shear\n float aspect = size.x / size.y;\n vec2 p = vec2((v_textureCoordinates.x - 0.5) * aspect, v_textureCoordinates.y - 0.5);\n float c = cos(rotation);\n float s = sin(rotation);\n p = (vec2(p.x * c - p.y * s, p.x * s + p.y * c) + shift) / zoom;\n out_FragColor = texture(colorTexture, vec2(p.x / aspect + 0.5, p.y + 0.5));\n}\n";
|
|
3
|
+
//# sourceMappingURL=Jello.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Jello.js","sourceRoot":"","sources":["../../src/shaders/Jello.js"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAe,s9DAAs9D,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The barrel distortion and dark corners of a wide-angle lens, like those of FPV cameras: straight\n// lines bend outward away from the middle. The corners stay in place and the middle is\n// magnified, so the picture keeps filling the screen.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float distortion;\nuniform float vignette;\nin vec2 v_textureCoordinates;\n\n// strongest distortion: the middle magnified by 1 + this, relative to the corners\nconst float MAX_DISTORTION = 0.5;\n\nvoid main() {\n vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);\n // from the middle, 1 at the corners\n vec2 fromMiddle = (v_textureCoordinates - 0.5) * aspect / (0.5 * length(aspect));\n float r2 = dot(fromMiddle, fromMiddle);\n float k = distortion * MAX_DISTORTION;\n vec2 uv = 0.5 + (v_textureCoordinates - 0.5) * (1.0 + k * r2) / (1.0 + k);\n vec4 sceneColor = texture(colorTexture, uv);\n float dark = 1.0 - vignette * smoothstep(0.3, 1.0, r2);\n out_FragColor = vec4(sceneColor.rgb * dark, sceneColor.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=LensDistortion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LensDistortion.d.ts","sourceRoot":"","sources":["../../src/shaders/LensDistortion.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from LensDistortion.glsl.
|
|
2
|
+
export default "// The barrel distortion and dark corners of a wide-angle lens, like those of FPV cameras: straight\n// lines bend outward away from the middle. The corners stay in place and the middle is\n// magnified, so the picture keeps filling the screen.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// 0 to 1\nuniform float distortion;\nuniform float vignette;\nin vec2 v_textureCoordinates;\n\n// strongest distortion: the middle magnified by 1 + this, relative to the corners\nconst float MAX_DISTORTION = 0.5;\n\nvoid main() {\n vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);\n // from the middle, 1 at the corners\n vec2 fromMiddle = (v_textureCoordinates - 0.5) * aspect / (0.5 * length(aspect));\n float r2 = dot(fromMiddle, fromMiddle);\n float k = distortion * MAX_DISTORTION;\n vec2 uv = 0.5 + (v_textureCoordinates - 0.5) * (1.0 + k * r2) / (1.0 + k);\n vec4 sceneColor = texture(colorTexture, uv);\n float dark = 1.0 - vignette * smoothstep(0.3, 1.0, r2);\n out_FragColor = vec4(sceneColor.rgb * dark, sceneColor.a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=LensDistortion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LensDistortion.js","sourceRoot":"","sources":["../../src/shaders/LensDistortion.js"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,eAAe,siCAAsiC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Lightning, cloud-to-ground strikes: a branching channel from the cloud base to the ground, with 2 to 4\n// return strokes tens of milliseconds apart, down one channel, and a flash that follows their flicker, as\n// in the descriptions of the lightning flash (Rakov and Uman, \"Lightning: Physics and Effects\", 2003). The\n// channel is drawn over the picture in screen space as a hot core in a halo, at least a pixel and a half\n// wide: a channel is centimeters wide, and a thousand meters away it would not show at its true width. It\n// is a line from the cloud to the ground that wanders to either side, by value noise of the position along\n// it in four octaves, pinned at both ends, with branches that leave it downward at an angle and wander the\n// same way, fading toward their ends. The distance to it is the pixel's across the line, less the wander,\n// over the slope of the wander, so that the width stays the same where it zigzags: a function of the\n// position along the line, a handful of noise lookups for each channel, not a polyline for each pixel.\n// The channel is hidden behind nearer terrain. The flash lights each pixel in proportion to its own color,\n// less with its distance to the strike, and the sky toward the cloud above it. Seen from above the cloud\n// base, the channel is hidden in the cloud, and the flash lights the cloud over the strike from inside, as\n// a glow. Needs EyeFromDepth and Hash.\nprecision highp sampler2D;\nconst int STRIKES = 4;\nconst int BRANCHES = 5;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// the top of each strike's channel, at the cloud base, in eye coordinates, and its seed; and its foot\n// and its age in seconds, negative when there is no strike in the slot\nuniform vec4 strikeTop[STRIKES];\nuniform vec4 strikeBottom[STRIKES];\n// the branches of each strike's channel, from the CPU: where along the channel they leave it, the cosine\n// and the sine of their angle from it, and their length as a share of the channel's, 0 for none\nuniform vec4 strikeBranches[STRIKES * BRANCHES];\n// the glow of each strike in the clouds, in eye coordinates, and the map's intensity at the strike,\n// 0 for none; and 0 below the cloud base to 1 above it, where the glow replaces the channel\nuniform vec4 strikeGlow[STRIKES];\nuniform float above;\nin vec2 v_textureCoordinates;\n\nconst int MAX_STROKES = 4;\n// how far the main channel and the branches wander to either side, as a fraction of their length\nconst float MAIN_WANDER = 0.7;\nconst float BRANCH_WANDER = 0.6;\n// the brightness of the branches against the main channel's\nconst float BRANCH_BRIGHTNESS = 0.5;\n// how far from the line between its ends a channel reaches, as a fraction of its length: the main one's\n// wander, then its branches; and the widest halo in pixels. Pixels farther than that skip the channel\nconst float MAIN_REACH = 0.35;\nconst float BRANCH_REACH = 0.5;\nconst float MAX_HALO = 80.0;\nconst float MAX_SLOPE = 2.5;\n// the channel's flicker under which it is not drawn\nconst float FAINT = 0.01;\n// the width of the core and of the halo, in meters: scaled to pixels by the distance, the core to no\n// less than a pixel and a half\nconst float CORE_WIDTH = 1.0;\nconst float HALO_WIDTH = 25.0;\n// how bright the halo is against the core\nconst float HALO = 0.35;\n// the channel is white at its core and blue around it, from the nitrogen lines of a 30000 K plasma, with a\n// violet cast from the hydrogen line of the water in a storm's air (Kieu et al., 2021)\nconst vec3 HALO_COLOR = vec3(0.68, 0.66, 1.0);\nconst vec3 FLASH_COLOR = vec3(0.8, 0.82, 1.0);\n// the extinction of the light of a strike per meter, in red, green and blue: the scattering of the air goes\n// with the wavelength to the minus 4, so far strikes turn yellow, then red, as at sunset\nconst vec3 EXTINCTION = vec3(1.0, 1.9, 3.4) * 2e-5;\n// the distance, in meters, at which the flash on the land has fallen to half\nconst float FLASH_REACH = 3000.0;\n// the sky is a ray this long\nconst float SKY_DISTANCE = 20000.0;\n// time constants of the channel's flicker and of the flash, in seconds\nconst float BOLT_DECAY = 0.05;\nconst float FLASH_DECAY = 0.15;\n// the glow in the clouds above a strike, seen from above: as wide as this, in meters, and as bright\nconst float GLOW_RADIUS = 4000.0;\nconst float GLOW_BRIGHTNESS = 0.9;\n// seen from above, most of the way to the glow is through thin air: its light is dimmed by at most\n// this many meters of the air near the ground, about the height over which the air thins by e\nconst float GLOW_AIR = 8000.0;\n\n// noise of one coordinate, in [-0.5, 0.5), and its slope: linear between the random values of the whole\n// numbers, not smoothed, so that the path is made of straight segments with sharp turns, as a bolt is\nvec2 valueNoise(float x, float seed) {\n float cell = floor(x);\n float low = hash(vec2(cell, seed));\n float high = hash(vec2(cell + 1.0, seed));\n return vec2(mix(low, high, fract(x)) - 0.5, high - low);\n}\n\n// four octaves of it along a channel, from 4 segments to 34: the wander at s and its slope\nvec2 wander(float s, float seed) {\n vec2 sum = vec2(0.0);\n float amplitude = 1.0;\n float frequency = 4.0;\n for (int i = 0; i < 4; i++) {\n sum += amplitude * valueNoise(s * frequency, seed + 7.0 * float(i)) * vec2(1.0, frequency);\n amplitude *= 0.45;\n frequency *= 2.1;\n }\n return sum;\n}\n\n// how far a channel is from its line at s, in its lengths, and the slope of that: the wander held to 0\n// at the start, by a smoothstep over the first quarter of a branch, and at both ends of the main\n// channel, by a sine, so that it leaves the cloud and reaches the ground upright\nvec2 offsetAt(float s, float seed, bool main) {\n vec2 w = wander(s, seed);\n float envelope = sin(czm_pi * s);\n float slope = czm_pi * cos(czm_pi * s);\n if (!main) {\n float u = clamp(4.0 * s, 0.0, 1.0);\n envelope = u * u * (3.0 - 2.0 * u);\n slope = 24.0 * u * (1.0 - u);\n }\n return vec2(w.x * envelope, w.y * envelope + w.x * slope);\n}\n\n// the distance in pixels from p to a channel that leaves a along dir, len pixels long, and the share s\n// of the way along it where p is nearest\nfloat channelDistance(vec2 p, vec2 a, vec2 dir, float len, float amplitude, float seed, bool main, out float s) {\n vec2 r = p - a;\n float along = dot(r, dir);\n s = clamp(along / len, 0.0, 1.0);\n vec2 offset = offsetAt(s, seed, main);\n float across = dot(r, vec2(-dir.y, dir.x)) - amplitude * len * offset.x;\n // the estimate holds near the channel only: past a slope of a few, the halo of a steep segment would\n // stretch sideways\n float slope = clamp(amplitude * offset.y, -MAX_SLOPE, MAX_SLOPE);\n // past the ends, the distance to the end\n return length(vec2(across / sqrt(1.0 + slope * slope), along - s * len));\n}\n\n// the core and the halo of the channel at a distance in pixels\nvec2 channelProfile(float d, float core, float halo) {\n return vec2(exp(-d * d / (core * core)), HALO * exp(-d / halo));\n}\n\n// the light of a strike seen from this far, in each color\nvec3 transmittance(float d) {\n return exp(-EXTINCTION * d);\n}\n\n// the flicker of the channel and the light of the flash, at an age in seconds: each stroke lights it up\n// at once and fades, the first one the brightest, and a dimmer current keeps the channel lit between them\nvoid strokes(float age, float seed, out float bolt, out float flash) {\n bolt = 0.3 * exp(-age / 0.3);\n flash = 0.0;\n float count = 2.0 + floor(3.0 * hash(vec2(seed, 91.0)));\n float start = 0.0;\n for (int i = 0; i < MAX_STROKES; i++) {\n if (float(i) >= count) {\n break;\n }\n float strength = i == 0 ? 1.0 : 0.35 + 0.5 * hash(vec2(seed, 50.0 + float(i)));\n float since = age - start;\n if (since >= 0.0) {\n bolt += strength * exp(-since / BOLT_DECAY);\n flash += strength * exp(-since / FLASH_DECAY);\n }\n start += 0.04 + 0.08 * hash(vec2(seed, 70.0 + float(i)));\n }\n}\n\nvec2 screenPoint(vec3 eye) {\n vec4 clip = czm_projection * vec4(eye, 1.0);\n return (0.5 * clip.xy / clip.w + 0.5) * czm_viewport.zw;\n}\n\n// the distance from p to the segment ab\nfloat segmentDistance(vec2 p, vec2 a, vec2 b) {\n vec2 ab = b - a;\n return length(p - a - ab * clamp(dot(p - a, ab) / dot(ab, ab), 0.0, 1.0));\n}\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n vec3 color = sceneColor.rgb;\n vec4 eye = eyeAt(depthTexture, uv);\n float sceneDistance = eye.w > 0.0 ? length(eye.xyz) : 1e9;\n vec3 pixelEye = eye.w > 0.0 ? eye.xyz : eye.xyz * SKY_DISTANCE;\n vec2 pixel = uv * czm_viewport.zw;\n // the focal length in pixels\n float focal = 0.5 * czm_projection[1][1] * czm_viewport.w;\n\n vec3 light = vec3(0.0);\n vec3 channel = vec3(0.0);\n for (int k = 0; k < STRIKES; k++) {\n float age = strikeBottom[k].w;\n if (age < 0.0) {\n continue;\n }\n vec3 top = strikeTop[k].xyz;\n vec3 bottom = strikeBottom[k].xyz;\n float seed = strikeTop[k].w;\n float bolt;\n float flash;\n strokes(age, seed, bolt, flash);\n\n // the land around the foot of the strike, and the sky toward the cloud above it\n float reach = distance(pixelEye, bottom) / FLASH_REACH;\n float sky = eye.w > 0.0 ? 0.0 : pow(max(dot(eye.xyz, normalize(top)), 0.0), 6.0);\n vec3 seen = transmittance(length(bottom));\n light += FLASH_COLOR * seen * flash * (color * 1.2 + 0.08) / (1.0 + reach * reach);\n light += FLASH_COLOR * seen * flash * sky * 0.5;\n\n // seen from above, the flash lights the cloud over the strike from inside: a glow around the\n // point of the view ray nearest to it, hidden behind nearer terrain\n vec4 glow = strikeGlow[k];\n float along = dot(glow.xyz, normalize(eye.xyz));\n if (above > 0.0 && glow.w > 0.0 && along > 0.0 && sceneDistance > along * 0.98) {\n float across = length(glow.xyz - normalize(eye.xyz) * along);\n light += FLASH_COLOR * transmittance(min(along, GLOW_AIR)) * flash * glow.w * above * GLOW_BRIGHTNESS * exp(-across * across / (GLOW_RADIUS * GLOW_RADIUS));\n }\n\n // the channel, when both its ends are in front of the camera, and the pixel is near it\n if (top.z > -1.0 || bottom.z > -1.0) {\n continue;\n }\n vec2 a = screenPoint(top);\n vec2 b = screenPoint(bottom);\n float len = distance(a, b);\n // the halo's widest reach, around the middle of the channel: pixels farther than that skip the channel\n float margin = 3.0 * clamp(HALO_WIDTH * focal / length(0.5 * (top + bottom)), 4.0, MAX_HALO);\n // the branches reach further from the line than the main channel's wander does\n float fromLine = segmentDistance(pixel, a, b);\n if (bolt < FAINT || len < 2.0 || fromLine > BRANCH_REACH * len + margin) {\n continue;\n }\n vec2 dir = (b - a) / len;\n float s = clamp(dot(pixel - a, dir) / len, 0.0, 1.0);\n float boltDistance = length(mix(top, bottom, s));\n float core = max(1.5, CORE_WIDTH * focal / boltDistance);\n float halo = clamp(HALO_WIDTH * focal / boltDistance, 4.0, MAX_HALO);\n vec2 profile = vec2(0.0);\n if (fromLine < MAIN_REACH * len + margin) {\n profile = channelProfile(channelDistance(pixel, a, dir, len, MAIN_WANDER, seed, true, s), core, halo);\n }\n for (int j = 0; j < BRANCHES; j++) {\n vec4 branch = strikeBranches[k * BRANCHES + j];\n float branchLen = len * branch.w;\n if (branchLen <= 0.0) {\n continue;\n }\n float at = branch.x;\n vec2 branchDir = vec2(branch.y * dir.x - branch.z * dir.y, branch.z * dir.x + branch.y * dir.y);\n // nowhere near the branch, which stays within its length and wander of its middle, and the main\n // channel's wander of its line\n vec2 onLine = a + dir * len * at;\n if (distance(pixel, onLine + branchDir * 0.5 * branchLen) > (0.5 + 0.5 * BRANCH_WANDER) * branchLen + MAIN_REACH * len + margin) {\n continue;\n }\n vec2 base = onLine + vec2(-dir.y, dir.x) * MAIN_WANDER * len * offsetAt(at, seed, true).x;\n float along;\n float branchDistance = channelDistance(pixel, base, branchDir, branchLen, BRANCH_WANDER, seed + 5.0 * float(j + 1), false, along);\n profile = max(profile, BRANCH_BRIGHTNESS * (1.0 - 0.7 * along) * channelProfile(branchDistance, core, halo));\n }\n // hidden behind terrain nearer than the channel at this height\n if (sceneDistance > boltDistance * 0.98 - 30.0) {\n channel += (1.0 - above) * bolt * transmittance(boltDistance) * (profile.x + profile.y * HALO_COLOR);\n }\n }\n out_FragColor = vec4(color + light + channel, sceneColor.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Lightning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lightning.d.ts","sourceRoot":"","sources":["../../src/shaders/Lightning.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Lightning.glsl.
|
|
2
|
+
export default "// Lightning, cloud-to-ground strikes: a branching channel from the cloud base to the ground, with 2 to 4\n// return strokes tens of milliseconds apart, down one channel, and a flash that follows their flicker, as\n// in the descriptions of the lightning flash (Rakov and Uman, \"Lightning: Physics and Effects\", 2003). The\n// channel is drawn over the picture in screen space as a hot core in a halo, at least a pixel and a half\n// wide: a channel is centimeters wide, and a thousand meters away it would not show at its true width. It\n// is a line from the cloud to the ground that wanders to either side, by value noise of the position along\n// it in four octaves, pinned at both ends, with branches that leave it downward at an angle and wander the\n// same way, fading toward their ends. The distance to it is the pixel's across the line, less the wander,\n// over the slope of the wander, so that the width stays the same where it zigzags: a function of the\n// position along the line, a handful of noise lookups for each channel, not a polyline for each pixel.\n// The channel is hidden behind nearer terrain. The flash lights each pixel in proportion to its own color,\n// less with its distance to the strike, and the sky toward the cloud above it. Seen from above the cloud\n// base, the channel is hidden in the cloud, and the flash lights the cloud over the strike from inside, as\n// a glow. Needs EyeFromDepth and Hash.\nprecision highp sampler2D;\nconst int STRIKES = 4;\nconst int BRANCHES = 5;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// the top of each strike's channel, at the cloud base, in eye coordinates, and its seed; and its foot\n// and its age in seconds, negative when there is no strike in the slot\nuniform vec4 strikeTop[STRIKES];\nuniform vec4 strikeBottom[STRIKES];\n// the branches of each strike's channel, from the CPU: where along the channel they leave it, the cosine\n// and the sine of their angle from it, and their length as a share of the channel's, 0 for none\nuniform vec4 strikeBranches[STRIKES * BRANCHES];\n// the glow of each strike in the clouds, in eye coordinates, and the map's intensity at the strike,\n// 0 for none; and 0 below the cloud base to 1 above it, where the glow replaces the channel\nuniform vec4 strikeGlow[STRIKES];\nuniform float above;\nin vec2 v_textureCoordinates;\n\nconst int MAX_STROKES = 4;\n// how far the main channel and the branches wander to either side, as a fraction of their length\nconst float MAIN_WANDER = 0.7;\nconst float BRANCH_WANDER = 0.6;\n// the brightness of the branches against the main channel's\nconst float BRANCH_BRIGHTNESS = 0.5;\n// how far from the line between its ends a channel reaches, as a fraction of its length: the main one's\n// wander, then its branches; and the widest halo in pixels. Pixels farther than that skip the channel\nconst float MAIN_REACH = 0.35;\nconst float BRANCH_REACH = 0.5;\nconst float MAX_HALO = 80.0;\nconst float MAX_SLOPE = 2.5;\n// the channel's flicker under which it is not drawn\nconst float FAINT = 0.01;\n// the width of the core and of the halo, in meters: scaled to pixels by the distance, the core to no\n// less than a pixel and a half\nconst float CORE_WIDTH = 1.0;\nconst float HALO_WIDTH = 25.0;\n// how bright the halo is against the core\nconst float HALO = 0.35;\n// the channel is white at its core and blue around it, from the nitrogen lines of a 30000 K plasma, with a\n// violet cast from the hydrogen line of the water in a storm's air (Kieu et al., 2021)\nconst vec3 HALO_COLOR = vec3(0.68, 0.66, 1.0);\nconst vec3 FLASH_COLOR = vec3(0.8, 0.82, 1.0);\n// the extinction of the light of a strike per meter, in red, green and blue: the scattering of the air goes\n// with the wavelength to the minus 4, so far strikes turn yellow, then red, as at sunset\nconst vec3 EXTINCTION = vec3(1.0, 1.9, 3.4) * 2e-5;\n// the distance, in meters, at which the flash on the land has fallen to half\nconst float FLASH_REACH = 3000.0;\n// the sky is a ray this long\nconst float SKY_DISTANCE = 20000.0;\n// time constants of the channel's flicker and of the flash, in seconds\nconst float BOLT_DECAY = 0.05;\nconst float FLASH_DECAY = 0.15;\n// the glow in the clouds above a strike, seen from above: as wide as this, in meters, and as bright\nconst float GLOW_RADIUS = 4000.0;\nconst float GLOW_BRIGHTNESS = 0.9;\n// seen from above, most of the way to the glow is through thin air: its light is dimmed by at most\n// this many meters of the air near the ground, about the height over which the air thins by e\nconst float GLOW_AIR = 8000.0;\n\n// noise of one coordinate, in [-0.5, 0.5), and its slope: linear between the random values of the whole\n// numbers, not smoothed, so that the path is made of straight segments with sharp turns, as a bolt is\nvec2 valueNoise(float x, float seed) {\n float cell = floor(x);\n float low = hash(vec2(cell, seed));\n float high = hash(vec2(cell + 1.0, seed));\n return vec2(mix(low, high, fract(x)) - 0.5, high - low);\n}\n\n// four octaves of it along a channel, from 4 segments to 34: the wander at s and its slope\nvec2 wander(float s, float seed) {\n vec2 sum = vec2(0.0);\n float amplitude = 1.0;\n float frequency = 4.0;\n for (int i = 0; i < 4; i++) {\n sum += amplitude * valueNoise(s * frequency, seed + 7.0 * float(i)) * vec2(1.0, frequency);\n amplitude *= 0.45;\n frequency *= 2.1;\n }\n return sum;\n}\n\n// how far a channel is from its line at s, in its lengths, and the slope of that: the wander held to 0\n// at the start, by a smoothstep over the first quarter of a branch, and at both ends of the main\n// channel, by a sine, so that it leaves the cloud and reaches the ground upright\nvec2 offsetAt(float s, float seed, bool main) {\n vec2 w = wander(s, seed);\n float envelope = sin(czm_pi * s);\n float slope = czm_pi * cos(czm_pi * s);\n if (!main) {\n float u = clamp(4.0 * s, 0.0, 1.0);\n envelope = u * u * (3.0 - 2.0 * u);\n slope = 24.0 * u * (1.0 - u);\n }\n return vec2(w.x * envelope, w.y * envelope + w.x * slope);\n}\n\n// the distance in pixels from p to a channel that leaves a along dir, len pixels long, and the share s\n// of the way along it where p is nearest\nfloat channelDistance(vec2 p, vec2 a, vec2 dir, float len, float amplitude, float seed, bool main, out float s) {\n vec2 r = p - a;\n float along = dot(r, dir);\n s = clamp(along / len, 0.0, 1.0);\n vec2 offset = offsetAt(s, seed, main);\n float across = dot(r, vec2(-dir.y, dir.x)) - amplitude * len * offset.x;\n // the estimate holds near the channel only: past a slope of a few, the halo of a steep segment would\n // stretch sideways\n float slope = clamp(amplitude * offset.y, -MAX_SLOPE, MAX_SLOPE);\n // past the ends, the distance to the end\n return length(vec2(across / sqrt(1.0 + slope * slope), along - s * len));\n}\n\n// the core and the halo of the channel at a distance in pixels\nvec2 channelProfile(float d, float core, float halo) {\n return vec2(exp(-d * d / (core * core)), HALO * exp(-d / halo));\n}\n\n// the light of a strike seen from this far, in each color\nvec3 transmittance(float d) {\n return exp(-EXTINCTION * d);\n}\n\n// the flicker of the channel and the light of the flash, at an age in seconds: each stroke lights it up\n// at once and fades, the first one the brightest, and a dimmer current keeps the channel lit between them\nvoid strokes(float age, float seed, out float bolt, out float flash) {\n bolt = 0.3 * exp(-age / 0.3);\n flash = 0.0;\n float count = 2.0 + floor(3.0 * hash(vec2(seed, 91.0)));\n float start = 0.0;\n for (int i = 0; i < MAX_STROKES; i++) {\n if (float(i) >= count) {\n break;\n }\n float strength = i == 0 ? 1.0 : 0.35 + 0.5 * hash(vec2(seed, 50.0 + float(i)));\n float since = age - start;\n if (since >= 0.0) {\n bolt += strength * exp(-since / BOLT_DECAY);\n flash += strength * exp(-since / FLASH_DECAY);\n }\n start += 0.04 + 0.08 * hash(vec2(seed, 70.0 + float(i)));\n }\n}\n\nvec2 screenPoint(vec3 eye) {\n vec4 clip = czm_projection * vec4(eye, 1.0);\n return (0.5 * clip.xy / clip.w + 0.5) * czm_viewport.zw;\n}\n\n// the distance from p to the segment ab\nfloat segmentDistance(vec2 p, vec2 a, vec2 b) {\n vec2 ab = b - a;\n return length(p - a - ab * clamp(dot(p - a, ab) / dot(ab, ab), 0.0, 1.0));\n}\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec4 sceneColor = texture(colorTexture, uv);\n vec3 color = sceneColor.rgb;\n vec4 eye = eyeAt(depthTexture, uv);\n float sceneDistance = eye.w > 0.0 ? length(eye.xyz) : 1e9;\n vec3 pixelEye = eye.w > 0.0 ? eye.xyz : eye.xyz * SKY_DISTANCE;\n vec2 pixel = uv * czm_viewport.zw;\n // the focal length in pixels\n float focal = 0.5 * czm_projection[1][1] * czm_viewport.w;\n\n vec3 light = vec3(0.0);\n vec3 channel = vec3(0.0);\n for (int k = 0; k < STRIKES; k++) {\n float age = strikeBottom[k].w;\n if (age < 0.0) {\n continue;\n }\n vec3 top = strikeTop[k].xyz;\n vec3 bottom = strikeBottom[k].xyz;\n float seed = strikeTop[k].w;\n float bolt;\n float flash;\n strokes(age, seed, bolt, flash);\n\n // the land around the foot of the strike, and the sky toward the cloud above it\n float reach = distance(pixelEye, bottom) / FLASH_REACH;\n float sky = eye.w > 0.0 ? 0.0 : pow(max(dot(eye.xyz, normalize(top)), 0.0), 6.0);\n vec3 seen = transmittance(length(bottom));\n light += FLASH_COLOR * seen * flash * (color * 1.2 + 0.08) / (1.0 + reach * reach);\n light += FLASH_COLOR * seen * flash * sky * 0.5;\n\n // seen from above, the flash lights the cloud over the strike from inside: a glow around the\n // point of the view ray nearest to it, hidden behind nearer terrain\n vec4 glow = strikeGlow[k];\n float along = dot(glow.xyz, normalize(eye.xyz));\n if (above > 0.0 && glow.w > 0.0 && along > 0.0 && sceneDistance > along * 0.98) {\n float across = length(glow.xyz - normalize(eye.xyz) * along);\n light += FLASH_COLOR * transmittance(min(along, GLOW_AIR)) * flash * glow.w * above * GLOW_BRIGHTNESS * exp(-across * across / (GLOW_RADIUS * GLOW_RADIUS));\n }\n\n // the channel, when both its ends are in front of the camera, and the pixel is near it\n if (top.z > -1.0 || bottom.z > -1.0) {\n continue;\n }\n vec2 a = screenPoint(top);\n vec2 b = screenPoint(bottom);\n float len = distance(a, b);\n // the halo's widest reach, around the middle of the channel: pixels farther than that skip the channel\n float margin = 3.0 * clamp(HALO_WIDTH * focal / length(0.5 * (top + bottom)), 4.0, MAX_HALO);\n // the branches reach further from the line than the main channel's wander does\n float fromLine = segmentDistance(pixel, a, b);\n if (bolt < FAINT || len < 2.0 || fromLine > BRANCH_REACH * len + margin) {\n continue;\n }\n vec2 dir = (b - a) / len;\n float s = clamp(dot(pixel - a, dir) / len, 0.0, 1.0);\n float boltDistance = length(mix(top, bottom, s));\n float core = max(1.5, CORE_WIDTH * focal / boltDistance);\n float halo = clamp(HALO_WIDTH * focal / boltDistance, 4.0, MAX_HALO);\n vec2 profile = vec2(0.0);\n if (fromLine < MAIN_REACH * len + margin) {\n profile = channelProfile(channelDistance(pixel, a, dir, len, MAIN_WANDER, seed, true, s), core, halo);\n }\n for (int j = 0; j < BRANCHES; j++) {\n vec4 branch = strikeBranches[k * BRANCHES + j];\n float branchLen = len * branch.w;\n if (branchLen <= 0.0) {\n continue;\n }\n float at = branch.x;\n vec2 branchDir = vec2(branch.y * dir.x - branch.z * dir.y, branch.z * dir.x + branch.y * dir.y);\n // nowhere near the branch, which stays within its length and wander of its middle, and the main\n // channel's wander of its line\n vec2 onLine = a + dir * len * at;\n if (distance(pixel, onLine + branchDir * 0.5 * branchLen) > (0.5 + 0.5 * BRANCH_WANDER) * branchLen + MAIN_REACH * len + margin) {\n continue;\n }\n vec2 base = onLine + vec2(-dir.y, dir.x) * MAIN_WANDER * len * offsetAt(at, seed, true).x;\n float along;\n float branchDistance = channelDistance(pixel, base, branchDir, branchLen, BRANCH_WANDER, seed + 5.0 * float(j + 1), false, along);\n profile = max(profile, BRANCH_BRIGHTNESS * (1.0 - 0.7 * along) * channelProfile(branchDistance, core, halo));\n }\n // hidden behind terrain nearer than the channel at this height\n if (sceneDistance > boltDistance * 0.98 - 30.0) {\n channel += (1.0 - above) * bolt * transmittance(boltDistance) * (profile.x + profile.y * HALO_COLOR);\n }\n }\n out_FragColor = vec4(color + light + channel, sceneColor.a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=Lightning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lightning.js","sourceRoot":"","sources":["../../src/shaders/Lightning.js"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAe,+9YAA+9Y,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Camera motion blur, after \"A Reconstruction Filter for Plausible Motion Blur\" (McGuire et al.,\n// I3D 2012). Only the camera moves, so each pixel's motion follows from its depth and the\n// reprojection into the previous frame, computed once per pixel into the velocity buffer of\n// MotionBlurVelocity.glsl. The blur gathers jittered samples along the pixel's motion, weighted\n// by depth so that near terrain and far ridges or sky do not smear into each other.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// xy: half the blur, as a fraction of the viewport; z: the distance from the camera\nuniform sampler2D velocityTexture;\nin vec2 v_textureCoordinates;\n\nconst int SAMPLES = 16;\n// depth difference, relative to the depth, over which a sample goes from in front to behind\nconst float SOFT_DEPTH = 0.1;\n\n\n// xy: half the blur of the pixel at uv, in pixels; z: its distance from the camera\nvec3 halfBlurAt(vec2 uv) {\n vec3 velocity = texture(velocityTexture, uv).xyz;\n return vec3(velocity.xy * czm_viewport.zw, velocity.z);\n}\n\n// 1 when b is in front of a, 0 when it is SOFT_DEPTH behind\nfloat inFront(float a, float b) {\n return clamp(1.0 - (b - a) / (SOFT_DEPTH * min(a, b)), 0.0, 1.0);\n}\n\n// the blur of a pixel with this half blur covers a sample this far away; the extents are kept\n// above 0 for samples without blur\nfloat cone(float gap, vec2 halfBlur) {\n return clamp(1.0 - gap / max(length(halfBlur), 1e-3), 0.0, 1.0);\n}\n\n// both pixels are blurred over the gap between them\nfloat cylinder(float gap, vec2 halfBlur) {\n float extent = max(length(halfBlur), 1e-3);\n return 1.0 - smoothstep(0.95 * extent, 1.05 * extent, gap);\n}\n\nvoid main() {\n vec3 center = halfBlurAt(v_textureCoordinates);\n vec2 halfBlur = center.xy;\n vec4 centerColor = texture(colorTexture, v_textureCoordinates);\n float extent = length(halfBlur);\n if (extent < 0.5) {\n out_FragColor = centerColor;\n return;\n }\n\n float weight = 1.0 / extent;\n vec4 color = centerColor * weight;\n // the jitter turns the banding of few samples into fine noise\n float jitter = pixelNoise(gl_FragCoord.xy) - 0.5;\n for (int i = 0; i < SAMPLES; i++) {\n float t = mix(-1.0, 1.0, (float(i) + jitter + 1.0) / float(SAMPLES + 1));\n vec2 uv = v_textureCoordinates + t * halfBlur / czm_viewport.zw;\n vec3 other = halfBlurAt(uv);\n float gap = abs(t) * extent;\n float front = inFront(center.z, other.z);\n float behind = inFront(other.z, center.z);\n // a sample in front counts when its own blur reaches this pixel, one behind when this\n // pixel's blur reaches it, and both when they are blurred together\n float alpha =\n front * cone(gap, other.xy) +\n behind * cone(gap, halfBlur) +\n 2.0 * cylinder(gap, other.xy) * cylinder(gap, halfBlur);\n weight += alpha;\n color += alpha * texture(colorTexture, uv);\n }\n out_FragColor = color / weight;\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=MotionBlur.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MotionBlur.d.ts","sourceRoot":"","sources":["../../src/shaders/MotionBlur.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from MotionBlur.glsl.
|
|
2
|
+
export default "// Camera motion blur, after \"A Reconstruction Filter for Plausible Motion Blur\" (McGuire et al.,\n// I3D 2012). Only the camera moves, so each pixel's motion follows from its depth and the\n// reprojection into the previous frame, computed once per pixel into the velocity buffer of\n// MotionBlurVelocity.glsl. The blur gathers jittered samples along the pixel's motion, weighted\n// by depth so that near terrain and far ridges or sky do not smear into each other.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\n// xy: half the blur, as a fraction of the viewport; z: the distance from the camera\nuniform sampler2D velocityTexture;\nin vec2 v_textureCoordinates;\n\nconst int SAMPLES = 16;\n// depth difference, relative to the depth, over which a sample goes from in front to behind\nconst float SOFT_DEPTH = 0.1;\n\n\n// xy: half the blur of the pixel at uv, in pixels; z: its distance from the camera\nvec3 halfBlurAt(vec2 uv) {\n vec3 velocity = texture(velocityTexture, uv).xyz;\n return vec3(velocity.xy * czm_viewport.zw, velocity.z);\n}\n\n// 1 when b is in front of a, 0 when it is SOFT_DEPTH behind\nfloat inFront(float a, float b) {\n return clamp(1.0 - (b - a) / (SOFT_DEPTH * min(a, b)), 0.0, 1.0);\n}\n\n// the blur of a pixel with this half blur covers a sample this far away; the extents are kept\n// above 0 for samples without blur\nfloat cone(float gap, vec2 halfBlur) {\n return clamp(1.0 - gap / max(length(halfBlur), 1e-3), 0.0, 1.0);\n}\n\n// both pixels are blurred over the gap between them\nfloat cylinder(float gap, vec2 halfBlur) {\n float extent = max(length(halfBlur), 1e-3);\n return 1.0 - smoothstep(0.95 * extent, 1.05 * extent, gap);\n}\n\nvoid main() {\n vec3 center = halfBlurAt(v_textureCoordinates);\n vec2 halfBlur = center.xy;\n vec4 centerColor = texture(colorTexture, v_textureCoordinates);\n float extent = length(halfBlur);\n if (extent < 0.5) {\n out_FragColor = centerColor;\n return;\n }\n\n float weight = 1.0 / extent;\n vec4 color = centerColor * weight;\n // the jitter turns the banding of few samples into fine noise\n float jitter = pixelNoise(gl_FragCoord.xy) - 0.5;\n for (int i = 0; i < SAMPLES; i++) {\n float t = mix(-1.0, 1.0, (float(i) + jitter + 1.0) / float(SAMPLES + 1));\n vec2 uv = v_textureCoordinates + t * halfBlur / czm_viewport.zw;\n vec3 other = halfBlurAt(uv);\n float gap = abs(t) * extent;\n float front = inFront(center.z, other.z);\n float behind = inFront(other.z, center.z);\n // a sample in front counts when its own blur reaches this pixel, one behind when this\n // pixel's blur reaches it, and both when they are blurred together\n float alpha =\n front * cone(gap, other.xy) +\n behind * cone(gap, halfBlur) +\n 2.0 * cylinder(gap, other.xy) * cylinder(gap, halfBlur);\n weight += alpha;\n color += alpha * texture(colorTexture, uv);\n }\n out_FragColor = color / weight;\n}\n";
|
|
3
|
+
//# sourceMappingURL=MotionBlur.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MotionBlur.js","sourceRoot":"","sources":["../../src/shaders/MotionBlur.js"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAe,44FAA44F,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The velocity buffer of the motion blur, at a fraction of the resolution: each pixel's half\n// blur, as a fraction of the viewport, and its distance from the camera. Computed once per\n// pixel here rather than once per sample in the gather. Needs EyeFromDepth.\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// current eye coordinates to the previous frame's clip coordinates, computed in double\n// precision on the CPU\nuniform mat4 reprojection;\n// exposure time over the time since the previous frame: the blur spans the motion during the\n// exposure, whatever the frame rate\nuniform float exposureScale;\nin vec2 v_textureCoordinates;\n\n// longest blur, as a fraction of the viewport height\nconst float MAX_BLUR = 0.05;\n\nvoid main() {\n // the sky is a direction: only the camera rotation moves it\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec4 previous = reprojection * eye;\n vec2 motion = previous.w > 0.0 ? v_textureCoordinates - (previous.xy / previous.w * 0.5 + 0.5) : vec2(0.0);\n motion *= exposureScale;\n // the clamp is resolution independent: the ratio to the viewport height is the same at any scale\n vec2 pixels = motion * czm_viewport.zw;\n float extent = length(pixels);\n float maxExtent = MAX_BLUR * czm_viewport.w;\n if (extent > maxExtent) {\n motion *= maxExtent / extent;\n }\n out_FragColor = vec4(0.5 * motion, eye.w == 0.0 ? 1e30 : length(eye.xyz), 1.0);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=MotionBlurVelocity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MotionBlurVelocity.d.ts","sourceRoot":"","sources":["../../src/shaders/MotionBlurVelocity.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from MotionBlurVelocity.glsl.
|
|
2
|
+
export default "// The velocity buffer of the motion blur, at a fraction of the resolution: each pixel's half\n// blur, as a fraction of the viewport, and its distance from the camera. Computed once per\n// pixel here rather than once per sample in the gather. Needs EyeFromDepth.\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// current eye coordinates to the previous frame's clip coordinates, computed in double\n// precision on the CPU\nuniform mat4 reprojection;\n// exposure time over the time since the previous frame: the blur spans the motion during the\n// exposure, whatever the frame rate\nuniform float exposureScale;\nin vec2 v_textureCoordinates;\n\n// longest blur, as a fraction of the viewport height\nconst float MAX_BLUR = 0.05;\n\nvoid main() {\n // the sky is a direction: only the camera rotation moves it\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec4 previous = reprojection * eye;\n vec2 motion = previous.w > 0.0 ? v_textureCoordinates - (previous.xy / previous.w * 0.5 + 0.5) : vec2(0.0);\n motion *= exposureScale;\n // the clamp is resolution independent: the ratio to the viewport height is the same at any scale\n vec2 pixels = motion * czm_viewport.zw;\n float extent = length(pixels);\n float maxExtent = MAX_BLUR * czm_viewport.w;\n if (extent > maxExtent) {\n motion *= maxExtent / extent;\n }\n out_FragColor = vec4(0.5 * motion, eye.w == 0.0 ? 1e30 : length(eye.xyz), 1.0);\n}\n";
|
|
3
|
+
//# sourceMappingURL=MotionBlurVelocity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MotionBlurVelocity.js","sourceRoot":"","sources":["../../src/shaders/MotionBlurVelocity.js"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,eAAe,y6CAAy6C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// random gradient in [-1, 1] at a lattice point\nvec3 gradient(vec3 p) {\n p = fract(p * vec3(0.1031, 0.1030, 0.0973));\n p += dot(p, p.yxz + 33.33);\n return fract((p.xxy + p.yxx) * p.zyx) * 2.0 - 1.0;\n}\n\n// gradient noise, about -0.7 to 0.7. After prod80's ReShade Film Grain (MIT), with gradients\n// from a hash instead of a texture\nfloat gradientNoise(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p);\n vec3 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(\n mix(dot(gradient(i), f), dot(gradient(i + vec3(1.0, 0.0, 0.0)), f - vec3(1.0, 0.0, 0.0)), u.x),\n mix(dot(gradient(i + vec3(0.0, 1.0, 0.0)), f - vec3(0.0, 1.0, 0.0)), dot(gradient(i + vec3(1.0, 1.0, 0.0)), f - vec3(1.0, 1.0, 0.0)), u.x),\n u.y),\n mix(\n mix(dot(gradient(i + vec3(0.0, 0.0, 1.0)), f - vec3(0.0, 0.0, 1.0)), dot(gradient(i + vec3(1.0, 0.0, 1.0)), f - vec3(1.0, 0.0, 1.0)), u.x),\n mix(dot(gradient(i + vec3(0.0, 1.0, 1.0)), f - vec3(0.0, 1.0, 1.0)), dot(gradient(i + vec3(1.0, 1.0, 1.0)), f - vec3(1.0, 1.0, 1.0)), u.x),\n u.y),\n u.z);\n}\n\n// random gradient in [-1, 1] at a lattice point of the plane, for a seed\nvec2 gradient(vec2 p, float seed) {\n vec3 p3 = fract(vec3(p, seed) * vec3(0.1031, 0.1030, 0.0973));\n p3 += dot(p3, p3.yxz + 33.33);\n return fract((p3.xx + p3.yz) * p3.zy) * 2.0 - 1.0;\n}\n\n// gradient noise over the plane, about -0.7 to 0.7, a new pattern for each seed: half the\n// hashes of the volume's, for a pattern that only has to change by whole frames\nfloat gradientNoise(vec2 p, float seed) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(dot(gradient(i, seed), f), dot(gradient(i + vec2(1.0, 0.0), seed), f - vec2(1.0, 0.0)), u.x),\n mix(dot(gradient(i + vec2(0.0, 1.0), seed), f - vec2(0.0, 1.0)), dot(gradient(i + vec2(1.0, 1.0), seed), f - vec2(1.0, 1.0)), u.x),\n u.y);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Noise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Noise.d.ts","sourceRoot":"","sources":["../../src/shaders/Noise.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Noise.glsl.
|
|
2
|
+
export default "// random gradient in [-1, 1] at a lattice point\nvec3 gradient(vec3 p) {\n p = fract(p * vec3(0.1031, 0.1030, 0.0973));\n p += dot(p, p.yxz + 33.33);\n return fract((p.xxy + p.yxx) * p.zyx) * 2.0 - 1.0;\n}\n\n// gradient noise, about -0.7 to 0.7. After prod80's ReShade Film Grain (MIT), with gradients\n// from a hash instead of a texture\nfloat gradientNoise(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p);\n vec3 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(\n mix(dot(gradient(i), f), dot(gradient(i + vec3(1.0, 0.0, 0.0)), f - vec3(1.0, 0.0, 0.0)), u.x),\n mix(dot(gradient(i + vec3(0.0, 1.0, 0.0)), f - vec3(0.0, 1.0, 0.0)), dot(gradient(i + vec3(1.0, 1.0, 0.0)), f - vec3(1.0, 1.0, 0.0)), u.x),\n u.y),\n mix(\n mix(dot(gradient(i + vec3(0.0, 0.0, 1.0)), f - vec3(0.0, 0.0, 1.0)), dot(gradient(i + vec3(1.0, 0.0, 1.0)), f - vec3(1.0, 0.0, 1.0)), u.x),\n mix(dot(gradient(i + vec3(0.0, 1.0, 1.0)), f - vec3(0.0, 1.0, 1.0)), dot(gradient(i + vec3(1.0, 1.0, 1.0)), f - vec3(1.0, 1.0, 1.0)), u.x),\n u.y),\n u.z);\n}\n\n// random gradient in [-1, 1] at a lattice point of the plane, for a seed\nvec2 gradient(vec2 p, float seed) {\n vec3 p3 = fract(vec3(p, seed) * vec3(0.1031, 0.1030, 0.0973));\n p3 += dot(p3, p3.yxz + 33.33);\n return fract((p3.xx + p3.yz) * p3.zy) * 2.0 - 1.0;\n}\n\n// gradient noise over the plane, about -0.7 to 0.7, a new pattern for each seed: half the\n// hashes of the volume's, for a pattern that only has to change by whole frames\nfloat gradientNoise(vec2 p, float seed) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(dot(gradient(i, seed), f), dot(gradient(i + vec2(1.0, 0.0), seed), f - vec2(1.0, 0.0)), u.x),\n mix(dot(gradient(i + vec2(0.0, 1.0), seed), f - vec2(0.0, 1.0)), dot(gradient(i + vec2(1.0, 1.0), seed), f - vec2(1.0, 1.0)), u.x),\n u.y);\n}\n";
|
|
3
|
+
//# sourceMappingURL=Noise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Noise.js","sourceRoot":"","sources":["../../src/shaders/Noise.js"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAe,k6DAAk6D,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// normal at the pixel from its neighbors at this distance in pixels: on each axis the nearer\n// side, so that the edges of the scene do not bend it\nprecision highp sampler2D;\nvec3 normalAt(sampler2D depthTexture, vec2 uv, vec3 center, float distance) {\n vec2 step = distance / czm_viewport.zw;\n vec3 right = eyeAt(depthTexture, uv + vec2(step.x, 0.0)).xyz - center;\n vec3 left = center - eyeAt(depthTexture, uv - vec2(step.x, 0.0)).xyz;\n vec3 above = eyeAt(depthTexture, uv + vec2(0.0, step.y)).xyz - center;\n vec3 below = center - eyeAt(depthTexture, uv - vec2(0.0, step.y)).xyz;\n vec3 dx = dot(right, right) < dot(left, left) ? right : left;\n vec3 dy = dot(above, above) < dot(below, below) ? above : below;\n vec3 normal = normalize(cross(dx, dy));\n // toward the camera\n return normal * sign(dot(normal, -center));\n}\n\n// the terrain mesh is made of flat triangles, and so are the normals from the depth buffer:\n// averaged over several distances, the facets blend into a smoother surface\nvec3 smoothNormalAt(sampler2D depthTexture, vec2 uv, vec3 center) {\n return normalize(normalAt(depthTexture, uv, center, 2.0 * czm_pixelRatio) + normalAt(depthTexture, uv, center, 6.0 * czm_pixelRatio));\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Normal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Normal.d.ts","sourceRoot":"","sources":["../../src/shaders/Normal.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Normal.glsl.
|
|
2
|
+
export default "// normal at the pixel from its neighbors at this distance in pixels: on each axis the nearer\n// side, so that the edges of the scene do not bend it\nprecision highp sampler2D;\nvec3 normalAt(sampler2D depthTexture, vec2 uv, vec3 center, float distance) {\n vec2 step = distance / czm_viewport.zw;\n vec3 right = eyeAt(depthTexture, uv + vec2(step.x, 0.0)).xyz - center;\n vec3 left = center - eyeAt(depthTexture, uv - vec2(step.x, 0.0)).xyz;\n vec3 above = eyeAt(depthTexture, uv + vec2(0.0, step.y)).xyz - center;\n vec3 below = center - eyeAt(depthTexture, uv - vec2(0.0, step.y)).xyz;\n vec3 dx = dot(right, right) < dot(left, left) ? right : left;\n vec3 dy = dot(above, above) < dot(below, below) ? above : below;\n vec3 normal = normalize(cross(dx, dy));\n // toward the camera\n return normal * sign(dot(normal, -center));\n}\n\n// the terrain mesh is made of flat triangles, and so are the normals from the depth buffer:\n// averaged over several distances, the facets blend into a smoother surface\nvec3 smoothNormalAt(sampler2D depthTexture, vec2 uv, vec3 center) {\n return normalize(normalAt(depthTexture, uv, center, 2.0 * czm_pixelRatio) + normalAt(depthTexture, uv, center, 6.0 * czm_pixelRatio));\n}\n";
|
|
3
|
+
//# sourceMappingURL=Normal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Normal.js","sourceRoot":"","sources":["../../src/shaders/Normal.js"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAe,gtCAAgtC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Henyey-Greenstein's phase function, normalized: 1 / (4 pi) for light scattered alike in all\n// directions, which the haze and the clouds share.\nfloat henyeyGreenstein(float cosTheta, float g) {\n float g2 = g * g;\n return (1.0 - g2) / (4.0 * czm_pi * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Phase.d.ts","sourceRoot":"","sources":["../../src/shaders/Phase.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Phase.glsl.
|
|
2
|
+
export default "// Henyey-Greenstein's phase function, normalized: 1 / (4 pi) for light scattered alike in all\n// directions, which the haze and the clouds share.\nfloat henyeyGreenstein(float cosTheta, float g) {\n float g2 = g * g;\n return (1.0 - g2) / (4.0 * czm_pi * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));\n}\n";
|
|
3
|
+
//# sourceMappingURL=Phase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Phase.js","sourceRoot":"","sources":["../../src/shaders/Phase.js"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAe,mTAAmT,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Precipitation, rain or snow: streaks of falling drops in four layers, nearer ones larger, faster\n// and more opaque, in one pass over the scene, after the composite rainfall of ToyShop (Tatarchuk\n// 2006). The drops are laid out on the sphere of view directions, around the direction they fall\n// toward: drops falling along parallel lines appear on great circles through it, so in its Mercator\n// coordinates (the angle around it, and log(tan(theta / 2)) of the angle theta from it) the drops\n// of a layer, at one distance, are a regular grid scrolling at a constant rate: their size and\n// speed on the sphere both go with sin(theta). The streaks fall down the screen at the horizon and\n// radiate from below the camera when it looks down. The drops are hidden behind what is nearer than\n// their layer, and the rain veils the distance in an overcast haze, whose light the drops refract,\n// and in shafts of heavier rain hanging below the cloud base. The wind comes in gusts. The snow,\n// from 0 to 1, turns the rain to snow in one population: the drops slow down from 9 m/s to 1 m/s,\n// which shortens their streak, and grow from thin sharp lines into soft round flakes that flutter,\n// the nearest layer out of focus as in Andrew Baldwin's \"Just snow\", in a thicker, whiter haze.\n// Where it rains comes from the map: the shafts and the share of each ray in the rain from the\n// shafts' pass, the drops from the map's intensity at the camera, read on the CPU. The haze's length\n// below the cloud base is this pass's, from each pixel's depth, sharp at the ridges. Seen from\n// above, where Clouds draws the clouds, they hide the rain under them: no shafts nor haze.\n// Needs EyeFromDepth, Hash, Height, PrecipitationWind, Fog, Phase and RainHaze.\nprecision highp sampler2D;\nconst int LAYERS = 4;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, from PrecipitationShafts.glsl at a fraction of the resolution\nuniform sampler2D shaftTexture;\n// 1 when Clouds draws the clouds, 0 otherwise\nuniform float clouds;\n// 1 when their shadow map lights the haze, 0 otherwise\nuniform float shadowed;\n// the map's intensity at the camera, 0 to 1\nuniform float localIntensity;\n// from the CPU, as they change with the snow: the length of a drop's trail, its motion over the\n// exposure, in cells, and the scroll of the grid along the fall, in cells, wrapped at PERIOD, which\n// has to follow the speed without a jump\nuniform float trail;\nuniform float offset;\n// what the layers share, from the CPU rather than computed for each pixel: the cells around and\n// along the fall per radian, the number of cells around, and the distance in meters; and the\n// brightness, how far the largest drop's shape reaches around its trail in pixels, the radius of a\n// streak and the radius of the largest flake in pixels\nuniform vec4 layerShape[LAYERS];\nuniform vec4 layerLook[LAYERS];\nin vec2 v_textureCoordinates;\n\n// cells along the fall, for the random drops to repeat seamlessly as they scroll\nconst float PERIOD = 1000.0;\n// the nearest layer is 2 m away, each further layer twice as far; at the horizon, a drop every\n// 0.05 rad around\nconst float NEAREST = 2.0;\n// share of the cells with a drop, at full intensity\nconst float DENSITY = 0.6;\n// a drop is a capsule from a point in its cell, its trail within a cell: the cells are taller than\n// wide in the rain, square in the snow\n// how far a flake flutters across its cell, in cells, and a streak wavers in the gusts\nconst float FLUTTER = 0.12;\nconst float WAVER = 0.08;\n// the drops refract the haze's light, whiter than they would, as the milk film crews add to the\n// water, for rain that shows; the flakes scatter it, near white\nconst float RAIN_MILK = 0.25;\nconst float SNOW_MILK = 0.35;\n// the shafts' shade of the haze: darker in the rain, lighter in the snow\nconst float RAIN_SHAFT_SHADE = 0.75;\nconst float SNOW_SHAFT_SHADE = 1.1;\n// the shafts' resolution, precipitation.js's SHAFT_SCALE\nconst float SHAFT_SCALE = 0.125;\n\n// the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, blurred by PrecipitationShaftBlur.glsl and upsampled bilinearly from their texture,\n// which is read at its nearest texel\nvec4 shafts() {\n // the size Cesium gives the texture\n vec2 size = ceil(czm_viewport.zw * SHAFT_SCALE);\n vec2 p = v_textureCoordinates * size - 0.5;\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 center = (i + 0.5) / size;\n vec2 texel = 1.0 / size;\n vec4 bottom = mix(texture(shaftTexture, center), texture(shaftTexture, center + vec2(texel.x, 0.0)), f.x);\n vec4 top = mix(texture(shaftTexture, center + vec2(0.0, texel.y)), texture(shaftTexture, center + texel), f.x);\n return mix(bottom, top, f.y);\n}\n\n// the opacity at the pixel of the drop with its head in the cell `back` cells above its own, if it\n// has one: f is the pixel's place in its own cell. The drop morphs from a thin, sharp, long streak\n// to a round, soft, short flake with the snow: its radius and softness, brightness and flutter.\nfloat drop(vec4 look, float index, float count, float density, float streak, float amplitude, vec2 reach, vec2 pixelCells, vec2 cell, vec2 f, float back) {\n vec2 id = vec2(mod(cell.x, count), mod(cell.y - back, PERIOD) + PERIOD * index);\n float h = hash(id);\n if (h >= density) {\n return 0.0;\n }\n // the drop's random values, from the one hash: uniform in [0, 1) for the cells with a drop; its\n // head somewhere in the middle of its cell, and the pixel's place around its trail\n h /= density;\n vec2 head = vec2(0.25 + 0.5 * fract(h * 13.7), 0.25 + 0.5 * fract(h * 71.3));\n vec2 toHead = vec2(f.x, f.y + back) - head;\n // most drops are nowhere near the pixel: the rest of the shape is for the few that are\n if (abs(toHead.x) > amplitude + reach.x || toHead.y < -reach.y || toHead.y > streak + reach.y) {\n return 0.0;\n }\n // wavering in the gusts or fluttering across the cell at its own rate\n float rate = mix(1.7, 1.0 + 2.0 * fract(h * 5.1), snow);\n toHead.x -= amplitude * sin(rate * time + czm_twoPi * fract(h * 7.3));\n float t = streak > 0.0 ? clamp(toHead.y / streak, 0.0, 1.0) : 0.0;\n // the distance to the trail, in pixels\n float distanceToTrail = length(vec2(toHead.x, toHead.y - t * streak) / pixelCells);\n float radius = mix(look.z, look.w * (0.6 + 0.8 * fract(h * 3.7)), snow);\n // the nearest layer's flakes out of focus, soft and wide; the others sharp\n float soft = mix(0.5, index == 0.0 ? 0.8 * radius : 0.5, snow);\n float coverage = 1.0 - smoothstep(radius - soft, radius + soft, distanceToTrail);\n // fading out along a streak, not along a flake\n float taper = mix(1.0, 4.0 * t * (1.0 - t), streak);\n return look.x * (0.55 + 0.45 * fract(h * 37.1)) * coverage * taper;\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n // the pixel's view direction and distance, the sky far away, and the angle a pixel covers\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec3 view = normalize(eye.xyz);\n float sceneDistance = eye.w == 0.0 ? SKY_DISTANCE : length(eye.xyz);\n float pixel = 2.0 / (czm_projection[1][1] * czm_viewport.w);\n\n // the local frame at the camera, in world coordinates\n vec3 upWorld = upWC();\n vec3 eastWorld = eastWC();\n vec3 northWorld = cross(upWorld, eastWorld);\n float tilt = gustingTilt();\n\n // none above the cloud base; as hard as it rains at the camera\n float raining = 1.0 - smoothstep(cloudBase - 50.0, cloudBase + 50.0, cameraHeight);\n\n // the haze over the part of the ray below the cloud base, as rainy as the shafts' pass found it,\n // from the rain's to the snow's color; from above, hidden by the clouds where Clouds draws them\n vec2 below = belowHeight(view * sceneDistance, cloudBase);\n vec4 sampled = shafts();\n vec3 shaft = sampled.xyz * (1.0 - clouds * (1.0 - raining));\n // the rain's, in its bands, and the clear air's and the mist's over the share of the ray in the\n // rain, thinning out with the height, summed in optical depth\n float rainLength = (below.y - below.x) * sceneDistance;\n float h0 = heightAt(view * sceneDistance * below.x);\n float h1 = heightAt(view * sceneDistance * below.y);\n float layers = layerDepth(CLEAR_AIR, h0, h1, rainLength) + layerDepth(MIST, h0, h1, rainLength);\n float haze = rainHaze(rainLength * shaft.y * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow) + shaft.z * layers);\n // a rain cell seen from a dry spot is still under its own clouds\n float overcast = max(localIntensity, min(shaft.y * (1.0 + RAIN_BANDS), 1.0));\n // the sun through the gaps of the clouds, from their shadow map, or as much as the overcast lets\n float sunlit = shadowed > 0.0 ? sampled.w : 1.0 - overcast;\n vec3 hazeColor = rainHazeColor(view, daylight(), snow, overcast, sunlit);\n vec3 color = mix(sceneColor.rgb, hazeColor, haze);\n\n color = mix(color, min(mix(RAIN_SHAFT_SHADE, SNOW_SHAFT_SHADE, snow) * hazeColor, vec3(1.0)), shaft.x);\n float local = intensity * localIntensity;\n // in eye coordinates: the direction the drops fall toward, tilted toward the east by the wind,\n // and north across it\n vec3 fall = czm_viewRotation * (sin(tilt) * eastWorld - cos(tilt) * upWorld);\n vec3 north = czm_viewRotation * northWorld;\n vec3 across = normalize(north - dot(north, fall) * fall);\n vec3 dropColor = min(hazeColor + mix(RAIN_MILK, SNOW_MILK, snow), vec3(1.0));\n\n float cosTheta = dot(view, fall);\n float sinTheta = sqrt(max(1.0 - cosTheta * cosTheta, 0.0));\n // none toward the poles, where the cells shrink below a pixel\n if (raining > 0.0 && local > 0.0 && sinTheta > 0.01) {\n float around = atan(dot(view, cross(fall, across)), dot(view, across));\n float along = log(sinTheta / max(1.0 + cosTheta, 1e-6));\n float density = DENSITY * local;\n float streak = trail;\n float amplitude = mix(WAVER, FLUTTER, snow);\n // a pixel in radians, around the pole of the fall, where cells shrink\n float pixelOverSin = pixel / sinTheta;\n float brightness = raining * (0.5 + 0.5 * local);\n for (int i = 0; i < LAYERS; i++) {\n vec4 shape = layerShape[i];\n // hidden behind what is nearer than the layer\n float depthFade = smoothstep(0.5, 1.0, sceneDistance / shape.w);\n // a pixel in cells; the layer fades out as its cells get a few pixels wide\n vec2 pixelCells = pixelOverSin * shape.xy;\n float fade = brightness * depthFade * (1.0 - smoothstep(0.15, 0.4, pixelCells.x));\n if (fade <= 0.0) {\n continue;\n }\n float index = float(i);\n vec2 p = vec2(around * shape.x, along * shape.y + offset + 0.37 * index);\n vec2 cell = floor(p);\n vec2 f = p - cell;\n vec4 look = layerLook[i];\n vec2 reach = look.y * pixelCells;\n // the drops with their head in the pixel's cell, and in the cell above, whose trail or soft\n // edge may reach into it\n float alpha = drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 0.0);\n if (f.y <= streak) {\n alpha = 1.0 - (1.0 - alpha) * (1.0 - drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 1.0));\n }\n color = mix(color, dropColor, alpha * fade);\n }\n }\n out_FragColor = vec4(color, sceneColor.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Precipitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Precipitation.d.ts","sourceRoot":"","sources":["../../src/shaders/Precipitation.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Precipitation.glsl.
|
|
2
|
+
export default "// Precipitation, rain or snow: streaks of falling drops in four layers, nearer ones larger, faster\n// and more opaque, in one pass over the scene, after the composite rainfall of ToyShop (Tatarchuk\n// 2006). The drops are laid out on the sphere of view directions, around the direction they fall\n// toward: drops falling along parallel lines appear on great circles through it, so in its Mercator\n// coordinates (the angle around it, and log(tan(theta / 2)) of the angle theta from it) the drops\n// of a layer, at one distance, are a regular grid scrolling at a constant rate: their size and\n// speed on the sphere both go with sin(theta). The streaks fall down the screen at the horizon and\n// radiate from below the camera when it looks down. The drops are hidden behind what is nearer than\n// their layer, and the rain veils the distance in an overcast haze, whose light the drops refract,\n// and in shafts of heavier rain hanging below the cloud base. The wind comes in gusts. The snow,\n// from 0 to 1, turns the rain to snow in one population: the drops slow down from 9 m/s to 1 m/s,\n// which shortens their streak, and grow from thin sharp lines into soft round flakes that flutter,\n// the nearest layer out of focus as in Andrew Baldwin's \"Just snow\", in a thicker, whiter haze.\n// Where it rains comes from the map: the shafts and the share of each ray in the rain from the\n// shafts' pass, the drops from the map's intensity at the camera, read on the CPU. The haze's length\n// below the cloud base is this pass's, from each pixel's depth, sharp at the ridges. Seen from\n// above, where Clouds draws the clouds, they hide the rain under them: no shafts nor haze.\n// Needs EyeFromDepth, Hash, Height, PrecipitationWind, Fog, Phase and RainHaze.\nprecision highp sampler2D;\nconst int LAYERS = 4;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, from PrecipitationShafts.glsl at a fraction of the resolution\nuniform sampler2D shaftTexture;\n// 1 when Clouds draws the clouds, 0 otherwise\nuniform float clouds;\n// 1 when their shadow map lights the haze, 0 otherwise\nuniform float shadowed;\n// the map's intensity at the camera, 0 to 1\nuniform float localIntensity;\n// from the CPU, as they change with the snow: the length of a drop's trail, its motion over the\n// exposure, in cells, and the scroll of the grid along the fall, in cells, wrapped at PERIOD, which\n// has to follow the speed without a jump\nuniform float trail;\nuniform float offset;\n// what the layers share, from the CPU rather than computed for each pixel: the cells around and\n// along the fall per radian, the number of cells around, and the distance in meters; and the\n// brightness, how far the largest drop's shape reaches around its trail in pixels, the radius of a\n// streak and the radius of the largest flake in pixels\nuniform vec4 layerShape[LAYERS];\nuniform vec4 layerLook[LAYERS];\nin vec2 v_textureCoordinates;\n\n// cells along the fall, for the random drops to repeat seamlessly as they scroll\nconst float PERIOD = 1000.0;\n// the nearest layer is 2 m away, each further layer twice as far; at the horizon, a drop every\n// 0.05 rad around\nconst float NEAREST = 2.0;\n// share of the cells with a drop, at full intensity\nconst float DENSITY = 0.6;\n// a drop is a capsule from a point in its cell, its trail within a cell: the cells are taller than\n// wide in the rain, square in the snow\n// how far a flake flutters across its cell, in cells, and a streak wavers in the gusts\nconst float FLUTTER = 0.12;\nconst float WAVER = 0.08;\n// the drops refract the haze's light, whiter than they would, as the milk film crews add to the\n// water, for rain that shows; the flakes scatter it, near white\nconst float RAIN_MILK = 0.25;\nconst float SNOW_MILK = 0.35;\n// the shafts' shade of the haze: darker in the rain, lighter in the snow\nconst float RAIN_SHAFT_SHADE = 0.75;\nconst float SNOW_SHAFT_SHADE = 1.1;\n// the shafts' resolution, precipitation.js's SHAFT_SCALE\nconst float SHAFT_SCALE = 0.125;\n\n// the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, blurred by PrecipitationShaftBlur.glsl and upsampled bilinearly from their texture,\n// which is read at its nearest texel\nvec4 shafts() {\n // the size Cesium gives the texture\n vec2 size = ceil(czm_viewport.zw * SHAFT_SCALE);\n vec2 p = v_textureCoordinates * size - 0.5;\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 center = (i + 0.5) / size;\n vec2 texel = 1.0 / size;\n vec4 bottom = mix(texture(shaftTexture, center), texture(shaftTexture, center + vec2(texel.x, 0.0)), f.x);\n vec4 top = mix(texture(shaftTexture, center + vec2(0.0, texel.y)), texture(shaftTexture, center + texel), f.x);\n return mix(bottom, top, f.y);\n}\n\n// the opacity at the pixel of the drop with its head in the cell `back` cells above its own, if it\n// has one: f is the pixel's place in its own cell. The drop morphs from a thin, sharp, long streak\n// to a round, soft, short flake with the snow: its radius and softness, brightness and flutter.\nfloat drop(vec4 look, float index, float count, float density, float streak, float amplitude, vec2 reach, vec2 pixelCells, vec2 cell, vec2 f, float back) {\n vec2 id = vec2(mod(cell.x, count), mod(cell.y - back, PERIOD) + PERIOD * index);\n float h = hash(id);\n if (h >= density) {\n return 0.0;\n }\n // the drop's random values, from the one hash: uniform in [0, 1) for the cells with a drop; its\n // head somewhere in the middle of its cell, and the pixel's place around its trail\n h /= density;\n vec2 head = vec2(0.25 + 0.5 * fract(h * 13.7), 0.25 + 0.5 * fract(h * 71.3));\n vec2 toHead = vec2(f.x, f.y + back) - head;\n // most drops are nowhere near the pixel: the rest of the shape is for the few that are\n if (abs(toHead.x) > amplitude + reach.x || toHead.y < -reach.y || toHead.y > streak + reach.y) {\n return 0.0;\n }\n // wavering in the gusts or fluttering across the cell at its own rate\n float rate = mix(1.7, 1.0 + 2.0 * fract(h * 5.1), snow);\n toHead.x -= amplitude * sin(rate * time + czm_twoPi * fract(h * 7.3));\n float t = streak > 0.0 ? clamp(toHead.y / streak, 0.0, 1.0) : 0.0;\n // the distance to the trail, in pixels\n float distanceToTrail = length(vec2(toHead.x, toHead.y - t * streak) / pixelCells);\n float radius = mix(look.z, look.w * (0.6 + 0.8 * fract(h * 3.7)), snow);\n // the nearest layer's flakes out of focus, soft and wide; the others sharp\n float soft = mix(0.5, index == 0.0 ? 0.8 * radius : 0.5, snow);\n float coverage = 1.0 - smoothstep(radius - soft, radius + soft, distanceToTrail);\n // fading out along a streak, not along a flake\n float taper = mix(1.0, 4.0 * t * (1.0 - t), streak);\n return look.x * (0.55 + 0.45 * fract(h * 37.1)) * coverage * taper;\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n // the pixel's view direction and distance, the sky far away, and the angle a pixel covers\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec3 view = normalize(eye.xyz);\n float sceneDistance = eye.w == 0.0 ? SKY_DISTANCE : length(eye.xyz);\n float pixel = 2.0 / (czm_projection[1][1] * czm_viewport.w);\n\n // the local frame at the camera, in world coordinates\n vec3 upWorld = upWC();\n vec3 eastWorld = eastWC();\n vec3 northWorld = cross(upWorld, eastWorld);\n float tilt = gustingTilt();\n\n // none above the cloud base; as hard as it rains at the camera\n float raining = 1.0 - smoothstep(cloudBase - 50.0, cloudBase + 50.0, cameraHeight);\n\n // the haze over the part of the ray below the cloud base, as rainy as the shafts' pass found it,\n // from the rain's to the snow's color; from above, hidden by the clouds where Clouds draws them\n vec2 below = belowHeight(view * sceneDistance, cloudBase);\n vec4 sampled = shafts();\n vec3 shaft = sampled.xyz * (1.0 - clouds * (1.0 - raining));\n // the rain's, in its bands, and the clear air's and the mist's over the share of the ray in the\n // rain, thinning out with the height, summed in optical depth\n float rainLength = (below.y - below.x) * sceneDistance;\n float h0 = heightAt(view * sceneDistance * below.x);\n float h1 = heightAt(view * sceneDistance * below.y);\n float layers = layerDepth(CLEAR_AIR, h0, h1, rainLength) + layerDepth(MIST, h0, h1, rainLength);\n float haze = rainHaze(rainLength * shaft.y * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow) + shaft.z * layers);\n // a rain cell seen from a dry spot is still under its own clouds\n float overcast = max(localIntensity, min(shaft.y * (1.0 + RAIN_BANDS), 1.0));\n // the sun through the gaps of the clouds, from their shadow map, or as much as the overcast lets\n float sunlit = shadowed > 0.0 ? sampled.w : 1.0 - overcast;\n vec3 hazeColor = rainHazeColor(view, daylight(), snow, overcast, sunlit);\n vec3 color = mix(sceneColor.rgb, hazeColor, haze);\n\n color = mix(color, min(mix(RAIN_SHAFT_SHADE, SNOW_SHAFT_SHADE, snow) * hazeColor, vec3(1.0)), shaft.x);\n float local = intensity * localIntensity;\n // in eye coordinates: the direction the drops fall toward, tilted toward the east by the wind,\n // and north across it\n vec3 fall = czm_viewRotation * (sin(tilt) * eastWorld - cos(tilt) * upWorld);\n vec3 north = czm_viewRotation * northWorld;\n vec3 across = normalize(north - dot(north, fall) * fall);\n vec3 dropColor = min(hazeColor + mix(RAIN_MILK, SNOW_MILK, snow), vec3(1.0));\n\n float cosTheta = dot(view, fall);\n float sinTheta = sqrt(max(1.0 - cosTheta * cosTheta, 0.0));\n // none toward the poles, where the cells shrink below a pixel\n if (raining > 0.0 && local > 0.0 && sinTheta > 0.01) {\n float around = atan(dot(view, cross(fall, across)), dot(view, across));\n float along = log(sinTheta / max(1.0 + cosTheta, 1e-6));\n float density = DENSITY * local;\n float streak = trail;\n float amplitude = mix(WAVER, FLUTTER, snow);\n // a pixel in radians, around the pole of the fall, where cells shrink\n float pixelOverSin = pixel / sinTheta;\n float brightness = raining * (0.5 + 0.5 * local);\n for (int i = 0; i < LAYERS; i++) {\n vec4 shape = layerShape[i];\n // hidden behind what is nearer than the layer\n float depthFade = smoothstep(0.5, 1.0, sceneDistance / shape.w);\n // a pixel in cells; the layer fades out as its cells get a few pixels wide\n vec2 pixelCells = pixelOverSin * shape.xy;\n float fade = brightness * depthFade * (1.0 - smoothstep(0.15, 0.4, pixelCells.x));\n if (fade <= 0.0) {\n continue;\n }\n float index = float(i);\n vec2 p = vec2(around * shape.x, along * shape.y + offset + 0.37 * index);\n vec2 cell = floor(p);\n vec2 f = p - cell;\n vec4 look = layerLook[i];\n vec2 reach = look.y * pixelCells;\n // the drops with their head in the pixel's cell, and in the cell above, whose trail or soft\n // edge may reach into it\n float alpha = drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 0.0);\n if (f.y <= streak) {\n alpha = 1.0 - (1.0 - alpha) * (1.0 - drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 1.0));\n }\n color = mix(color, dropColor, alpha * fade);\n }\n }\n out_FragColor = vec4(color, sceneColor.a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=Precipitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Precipitation.js","sourceRoot":"","sources":["../../src/shaders/Precipitation.js"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAe,myWAAmyW,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, blurred over the neighboring texels at\n// their own resolution: they fade out around the ridges in front of them rather than stopping at\n// their outline. A 3 x 3 binomial kernel here costs a 64th of the reads the same blur would take\n// at the full resolution.\nprecision highp sampler2D;\nuniform sampler2D shaftTexture;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n // czm_viewport is this pass's texture, the size of the shafts'\n vec2 texel = 1.0 / czm_viewport.zw;\n vec4 sum = vec4(0.0);\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n float weight = (x == 0 ? 2.0 : 1.0) * (y == 0 ? 2.0 : 1.0);\n sum += weight * texture(shaftTexture, v_textureCoordinates + vec2(float(x), float(y)) * texel);\n }\n }\n out_FragColor = sum / 16.0;\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=PrecipitationShaftBlur.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationShaftBlur.d.ts","sourceRoot":"","sources":["../../src/shaders/PrecipitationShaftBlur.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from PrecipitationShaftBlur.glsl.
|
|
2
|
+
export default "// The shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain\n// in the sun, blurred over the neighboring texels at\n// their own resolution: they fade out around the ridges in front of them rather than stopping at\n// their outline. A 3 x 3 binomial kernel here costs a 64th of the reads the same blur would take\n// at the full resolution.\nprecision highp sampler2D;\nuniform sampler2D shaftTexture;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n // czm_viewport is this pass's texture, the size of the shafts'\n vec2 texel = 1.0 / czm_viewport.zw;\n vec4 sum = vec4(0.0);\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n float weight = (x == 0 ? 2.0 : 1.0) * (y == 0 ? 2.0 : 1.0);\n sum += weight * texture(shaftTexture, v_textureCoordinates + vec2(float(x), float(y)) * texel);\n }\n }\n out_FragColor = sum / 16.0;\n}\n";
|
|
3
|
+
//# sourceMappingURL=PrecipitationShaftBlur.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationShaftBlur.js","sourceRoot":"","sources":["../../src/shaders/PrecipitationShaftBlur.js"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,eAAe,g5BAAg5B,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The shafts of the rain or the snow, at a fraction of the resolution: their opacity along each\n// view ray, for Precipitation.glsl to shade, and the ray's mean extinction, as a share of the\n// extinction where the map is full, for its haze, which it computes at its own resolution, sharp at\n// the ridges. Both are over the part of the ray below the cloud base, where it rains, found from the\n// scene's depth before it is sampled:\n// from far above, a pixel shows the rain in the column under it. Along that part, patches of noise\n// on the ground under each sample, more of them as it rains harder, slanting with the wind from the\n// cloud base and drifting with it, where the map has rain. Not dithered: at this resolution the\n// dither shows as dots, where the patches are too soft to band. Needs EyeFromDepth, Noise, Height,\n// PrecipitationWind, WeatherMap, Fog, Phase, RainHaze and CloudsShadow. With clouds in the scene, it also finds\n// the share of the rain along the ray that the sun lights through their gaps, from their shadow map:\n// the haze's light shafts (Wronski 2014's front-to-back march, on the clouds' shadow map as\n// Hillaire 2016, sec. 5.9).\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// 1 when the clouds' shadow map is there to read, 0 otherwise\nuniform float shadowed;\nin vec2 v_textureCoordinates;\n\n// samples along the part of each ray below the cloud base, as far as SHAFT_DISTANCE from its\n// start, size of the patches in meters, extinction inside them per meter, about 6 km of visibility\nconst int SHAFT_STEPS = 12;\nconst float SHAFT_DISTANCE = 20000.0;\nconst float SHAFT_SIZE = 2500.0;\n// snow hides more, about 2.5 km\nconst vec2 SHAFT_EXTINCTION = vec2(0.0006, 0.0015);\n// the wind's speed, from its tilt of the drops' fall at 9 m/s, also in the snow: a drift changing\n// with the snow would move the shafts\nconst float DRIFT_VELOCITY = 9.0;\n// the shafts thin out over this height below the cloud base, into the clouds\nconst float SHAFT_TOP = 1000.0;\n\nvoid main() {\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec3 rayEnd = eye.w == 0.0 ? eye.xyz * SKY_DISTANCE : eye.xyz;\n // the part of the ray below the cloud base, and the part of it that is sampled\n vec2 below = belowHeight(rayEnd, cloudBase);\n float t0 = below.x;\n float t1 = below.y;\n float opacity = 0.0;\n float share = 0.0;\n float wet = 0.0;\n float lit = 1.0;\n if (t1 > t0) {\n float rayLength = length(rayEnd);\n float sampled = min(t1, t0 + SHAFT_DISTANCE / rayLength);\n // the ray in world coordinates, once rather than for each sample\n vec3 rayWC = czm_inverseViewRotation * rayEnd;\n vec3 upWorld = upWC();\n vec3 eastWorld = eastWC();\n float threshold = mix(0.4, 0.0, intensity);\n // the gusts sway the shafts, but they drift with the steady wind\n float slant = tan(gustingTilt());\n float drift = DRIFT_VELOCITY * speed * tan(radians(wind)) * time;\n float raining = 0.0;\n float sunlit = 0.0;\n float density = 0.0;\n for (int i = 0; i < SHAFT_STEPS; i++) {\n float t = mix(t0, sampled, (float(i) + 0.5) / float(SHAFT_STEPS));\n float h = heightAt(rayEnd * t);\n vec3 ground = czm_viewerPositionWC + rayWC * t - upWorld * h;\n float local = mapAt(ground);\n ground -= eastWorld * ((cloudBase - h) * slant + drift);\n float patches = gradientNoise(ground / SHAFT_SIZE);\n // in bands drifting with the shafts, the noise being about -0.7 to 0.7\n float extinction = rainExtinction(intensity * local, snow) * (1.0 + RAIN_BANDS * patches / 0.7);\n raining += extinction;\n // the sun through the clouds above the sample, weighted by how much it scatters there\n vec3 sampleWC = czm_viewerPositionWC + rayWC * t;\n sunlit += extinction * (shadowed > 0.0 ? exp(-shadowDepth(sampleWC)) : 1.0);\n wet += smoothstep(0.0, 0.15, local);\n float top = clamp((cloudBase - h) / SHAFT_TOP, 0.0, 1.0);\n density += local * top * smoothstep(threshold - 0.3, threshold + 0.3, patches);\n }\n // the whole part below the cloud base is as rainy as its sampled part, its extinction as a\n // share of the heaviest bands', and the share of it in the rain\n share = raining / (float(SHAFT_STEPS) * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow));\n wet /= float(SHAFT_STEPS);\n lit = raining > 0.0 ? sunlit / raining : 1.0;\n float depth = mix(SHAFT_EXTINCTION.x, SHAFT_EXTINCTION.y, snow) * (0.5 + 0.5 * intensity) * density * (sampled - t0) * rayLength / float(SHAFT_STEPS);\n opacity = 1.0 - exp(-depth);\n }\n out_FragColor = vec4(opacity, share, wet, lit);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=PrecipitationShafts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationShafts.d.ts","sourceRoot":"","sources":["../../src/shaders/PrecipitationShafts.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from PrecipitationShafts.glsl.
|
|
2
|
+
export default "// The shafts of the rain or the snow, at a fraction of the resolution: their opacity along each\n// view ray, for Precipitation.glsl to shade, and the ray's mean extinction, as a share of the\n// extinction where the map is full, for its haze, which it computes at its own resolution, sharp at\n// the ridges. Both are over the part of the ray below the cloud base, where it rains, found from the\n// scene's depth before it is sampled:\n// from far above, a pixel shows the rain in the column under it. Along that part, patches of noise\n// on the ground under each sample, more of them as it rains harder, slanting with the wind from the\n// cloud base and drifting with it, where the map has rain. Not dithered: at this resolution the\n// dither shows as dots, where the patches are too soft to band. Needs EyeFromDepth, Noise, Height,\n// PrecipitationWind, WeatherMap, Fog, Phase, RainHaze and CloudsShadow. With clouds in the scene, it also finds\n// the share of the rain along the ray that the sun lights through their gaps, from their shadow map:\n// the haze's light shafts (Wronski 2014's front-to-back march, on the clouds' shadow map as\n// Hillaire 2016, sec. 5.9).\nprecision highp sampler2D;\nuniform sampler2D depthTexture;\n// 1 when the clouds' shadow map is there to read, 0 otherwise\nuniform float shadowed;\nin vec2 v_textureCoordinates;\n\n// samples along the part of each ray below the cloud base, as far as SHAFT_DISTANCE from its\n// start, size of the patches in meters, extinction inside them per meter, about 6 km of visibility\nconst int SHAFT_STEPS = 12;\nconst float SHAFT_DISTANCE = 20000.0;\nconst float SHAFT_SIZE = 2500.0;\n// snow hides more, about 2.5 km\nconst vec2 SHAFT_EXTINCTION = vec2(0.0006, 0.0015);\n// the wind's speed, from its tilt of the drops' fall at 9 m/s, also in the snow: a drift changing\n// with the snow would move the shafts\nconst float DRIFT_VELOCITY = 9.0;\n// the shafts thin out over this height below the cloud base, into the clouds\nconst float SHAFT_TOP = 1000.0;\n\nvoid main() {\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec3 rayEnd = eye.w == 0.0 ? eye.xyz * SKY_DISTANCE : eye.xyz;\n // the part of the ray below the cloud base, and the part of it that is sampled\n vec2 below = belowHeight(rayEnd, cloudBase);\n float t0 = below.x;\n float t1 = below.y;\n float opacity = 0.0;\n float share = 0.0;\n float wet = 0.0;\n float lit = 1.0;\n if (t1 > t0) {\n float rayLength = length(rayEnd);\n float sampled = min(t1, t0 + SHAFT_DISTANCE / rayLength);\n // the ray in world coordinates, once rather than for each sample\n vec3 rayWC = czm_inverseViewRotation * rayEnd;\n vec3 upWorld = upWC();\n vec3 eastWorld = eastWC();\n float threshold = mix(0.4, 0.0, intensity);\n // the gusts sway the shafts, but they drift with the steady wind\n float slant = tan(gustingTilt());\n float drift = DRIFT_VELOCITY * speed * tan(radians(wind)) * time;\n float raining = 0.0;\n float sunlit = 0.0;\n float density = 0.0;\n for (int i = 0; i < SHAFT_STEPS; i++) {\n float t = mix(t0, sampled, (float(i) + 0.5) / float(SHAFT_STEPS));\n float h = heightAt(rayEnd * t);\n vec3 ground = czm_viewerPositionWC + rayWC * t - upWorld * h;\n float local = mapAt(ground);\n ground -= eastWorld * ((cloudBase - h) * slant + drift);\n float patches = gradientNoise(ground / SHAFT_SIZE);\n // in bands drifting with the shafts, the noise being about -0.7 to 0.7\n float extinction = rainExtinction(intensity * local, snow) * (1.0 + RAIN_BANDS * patches / 0.7);\n raining += extinction;\n // the sun through the clouds above the sample, weighted by how much it scatters there\n vec3 sampleWC = czm_viewerPositionWC + rayWC * t;\n sunlit += extinction * (shadowed > 0.0 ? exp(-shadowDepth(sampleWC)) : 1.0);\n wet += smoothstep(0.0, 0.15, local);\n float top = clamp((cloudBase - h) / SHAFT_TOP, 0.0, 1.0);\n density += local * top * smoothstep(threshold - 0.3, threshold + 0.3, patches);\n }\n // the whole part below the cloud base is as rainy as its sampled part, its extinction as a\n // share of the heaviest bands', and the share of it in the rain\n share = raining / (float(SHAFT_STEPS) * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow));\n wet /= float(SHAFT_STEPS);\n lit = raining > 0.0 ? sunlit / raining : 1.0;\n float depth = mix(SHAFT_EXTINCTION.x, SHAFT_EXTINCTION.y, snow) * (0.5 + 0.5 * intensity) * density * (sampled - t0) * rayLength / float(SHAFT_STEPS);\n opacity = 1.0 - exp(-depth);\n }\n out_FragColor = vec4(opacity, share, wet, lit);\n}\n";
|
|
3
|
+
//# sourceMappingURL=PrecipitationShafts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationShafts.js","sourceRoot":"","sources":["../../src/shaders/PrecipitationShafts.js"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,eAAe,glJAAglJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// What the passes of the precipitation share: the local frame at the camera and the wind, in gusts.\n// Needs Height.\n// seconds, wrapped at an hour\nuniform float time;\n// tilt of the fall toward the east, in degrees\nuniform float wind;\n// speed of the drops, 1 at their terminal velocity\nuniform float speed;\n// meters above the ellipsoid\nuniform float cloudBase;\n// 0 to 1\nuniform float intensity;\n// share of the precipitation that is snow, 0 to 1\nuniform float snow;\n\n// the gusts: the wind's tilt varies by this share, over periods of 18 and 7.2 s that divide the\n// hour the time wraps at\nconst float GUSTS = 0.35;\n\n// up and east at the camera, in world coordinates\nvec3 upWC() {\n return czm_inverseViewRotation * up;\n}\n\nvec3 eastWC() {\n return normalize(cross(vec3(0.0, 0.0, 1.0), upWC()));\n}\n\n// the wind's tilt, in radians, in gusts\nfloat gustingTilt() {\n float gust = 1.0 + GUSTS * (0.6 * sin(czm_twoPi * time / 18.0) + 0.4 * sin(czm_twoPi * time / 7.2 + 1.3));\n return radians(wind) * gust;\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=PrecipitationWind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationWind.d.ts","sourceRoot":"","sources":["../../src/shaders/PrecipitationWind.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from PrecipitationWind.glsl.
|
|
2
|
+
export default "// What the passes of the precipitation share: the local frame at the camera and the wind, in gusts.\n// Needs Height.\n// seconds, wrapped at an hour\nuniform float time;\n// tilt of the fall toward the east, in degrees\nuniform float wind;\n// speed of the drops, 1 at their terminal velocity\nuniform float speed;\n// meters above the ellipsoid\nuniform float cloudBase;\n// 0 to 1\nuniform float intensity;\n// share of the precipitation that is snow, 0 to 1\nuniform float snow;\n\n// the gusts: the wind's tilt varies by this share, over periods of 18 and 7.2 s that divide the\n// hour the time wraps at\nconst float GUSTS = 0.35;\n\n// up and east at the camera, in world coordinates\nvec3 upWC() {\n return czm_inverseViewRotation * up;\n}\n\nvec3 eastWC() {\n return normalize(cross(vec3(0.0, 0.0, 1.0), upWC()));\n}\n\n// the wind's tilt, in radians, in gusts\nfloat gustingTilt() {\n float gust = 1.0 + GUSTS * (0.6 * sin(czm_twoPi * time / 18.0) + 0.4 * sin(czm_twoPi * time / 7.2 + 1.3));\n return radians(wind) * gust;\n}\n";
|
|
3
|
+
//# sourceMappingURL=PrecipitationWind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrecipitationWind.js","sourceRoot":"","sources":["../../src/shaders/PrecipitationWind.js"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAe,ohCAAohC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The haze of the rain or the snow, which Precipitation and Clouds share: its extinction, its\n// opacity over an optical depth, and its color. The rain has no color of its own: its extinction\n// is the same at all wavelengths for drops above 0.2 mm (Montero-Martinez et al. 2025), so the\n// haze is the light of the sky and the sun it scatters toward the eye, L_in = (1 - T) * (the light\n// scattered toward the eye) (Hillaire 2020): the clear sky of Cesium's atmosphere at the horizon,\n// warm toward the sun and blue away from it, turning under thick clouds to the gray of an\n// overcast sky, brighter overhead, and the sun's forward glow through thin clouds. A moonlit blue\n// at night, as ValleyFog's. Needs Height, Fog and Phase.\nprecision highp sampler2D;\n\n// the light intensity of the sky's atmosphere, which is not the scene's atmosphere's: 50 rather than\n// 10 by default\nuniform float skyLightIntensity;\n// the clear sky toward the horizon and overhead, from SkyTable.glsl\nuniform sampler2D skyTable;\n\n// the rain rate, in mm/h, at intensity 1, the map's intensity being sqrt(R / RAIN_RATE), as the\n// weather demo draws it from MeteoSwiss' radar\nconst float RAIN_RATE = 10.0;\n// the extinction per meter of the rain, 0.11 R^0.85 per km at R mm/h, added to the clear air's, 0.1\n// per km (Montero-Martinez et al. 2025): 39 km of visibility in dry air, 11.5 km at 2.5 mm/h, 4.4 km\n// at 10 mm/h\nconst vec2 RAIN_LAW = vec2(0.00011, 0.85);\n// layers of haze thinning out with the height, their extinction per meter at sea level and their\n// scale height in meters, summed in optical depth with the rain's: the clear air's, 0.1 per km at\n// the ground, over an aerosol's scale height of 1 to 2 km; and a mist lying low, 1 per km at the\n// Swiss plateau's 500 m, that fills the valleys and leaves the ridges above it. Both scale heights\n// and the mist's extinction are not from a source\nconst vec2 CLEAR_AIR = vec2(0.0001, 1200.0);\nconst vec2 MIST = vec2(0.0035, 400.0);\n// the rain's extinction drifts in bands, by this share around its mean: sigma_rain *=\n// mix(0.6, 1.4, noise) (Wronski 2014, \"procedural Perlin noise animated by wind\")\nconst float RAIN_BANDS = 0.4;\n// visibility in meters at intensity 0 and 1 in the snow\nconst vec2 SNOW_VISIBILITY = vec2(20000.0, 500.0);\n// the haze never quite hides the sky and the far terrain\nconst float MAX_HAZE = 0.9;\n// the overcast sky at the horizon by day, a brighter gray under snow clouds; overhead, it is three\n// times as bright, the CIE's overcast sky, L / L_zenith = (1 + 2 sin(elevation)) / 3 (CIE 2003),\n// and darker under thick clouds, by up to this share: the report's 0.6 left the haze under the\n// heaviest rain at a quarter of the brightness, darker than the scene it veils, which the overcast\n// only dims by half\nconst vec3 RAIN_HAZE = vec3(0.6, 0.64, 0.68);\nconst vec3 SNOW_HAZE = vec3(0.7, 0.72, 0.76);\nconst float THICK_CLOUDS = 0.3;\n// the asymmetry of the light scattered by the rain and by the snow, from the haze's 0.7 to the\n// rain's 0.9 to 1 (arXiv 1403.2977)\nconst vec2 HAZE_ASYMMETRY = vec2(0.9, 0.75);\n// the sky toward the horizon is a ray this long, out of the atmosphere\nconst float SKY_RAY = 1e7;\n// the clear sky at the horizon is read this far above it, in radians, 5 degrees: right at it,\n// Cesium's atmosphere turns a pale cyan that its sky, interpolated from the vertices of its dome,\n// never shows\nconst float SKY_ELEVATION = 0.087;\n// the sky table's texels toward the horizon, besides the one overhead, SkyTable.glsl's\nconst float SKY_TABLE = 64.0;\n\n// the extinction per meter, from the rain's to the snow's, as hard as it rains: 3.912 / visibility\n// is the extinction that leaves 2 % of the light. None where it does not rain, rising from 0 at the\n// edge of the rain: the dry air is Cesium's fog's\nfloat rainExtinction(float intensity, float snow) {\n float rain = max(RAIN_LAW.x * pow(RAIN_RATE * intensity * intensity, RAIN_LAW.y), 1e-9);\n float snowfall = 3.912 / (SNOW_VISIBILITY.x * pow(SNOW_VISIBILITY.y / SNOW_VISIBILITY.x, intensity));\n return smoothstep(0.0, 0.15, intensity) * rain * pow(snowfall / rain, snow);\n}\n\n// the optical depth of a layer of haze along a straight ray this long from height h0 to h1, its\n// height linear along it: the line integral of exponential height fog,\n// (a / b) exp(-b h0) (1 - exp(-b dh)) / dh per unit of length (Quilez), with the first terms of its\n// Taylor series where the ray is level, as Flax's ExponentialHeightFog.hlsl\nfloat layerDepth(vec2 layer, float h0, float h1, float rayLength) {\n float x = (h1 - h0) / layer.y;\n float level = abs(x) < 1e-3 ? 1.0 - 0.5 * x : (1.0 - exp(-x)) / x;\n return layer.x * rayLength * exp(-h0 / layer.y) * level;\n}\n\n// the haze's opacity over an optical depth in the rain\nfloat rainHaze(float opticalDepth) {\n return MAX_HAZE * (1.0 - exp(-opticalDepth));\n}\n\n// the clear sky in a direction in world coordinates from a point at a height, as the sky shader of Cesium's atmosphere\n// renders it without high dynamic range, its inner radius lowered as SkyAtmosphereCommon.glsl\n// lowers it: from the ellipsoid's surface, a ray toward the horizon would cross the densest air\n// for hundreds of kilometers and turn a dim yellow\nvec3 clearSkyFrom(vec3 originWC, float height, vec3 directionWC, vec3 lightWC) {\n czm_ray ray = czm_ray(originWC, directionWC);\n float radiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;\n float adjust = 0.5 * radiiDifference * clamp((height - 0.25 * czm_ellipsoidRadii.x) / (0.75 * czm_ellipsoidRadii.x), 0.0, 1.0);\n float innerRadius = length(originWC) - height - 0.25 * radiiDifference - adjust;\n vec3 rayleigh;\n vec3 mie;\n float opacity;\n czm_computeScattering(ray, SKY_RAY, lightWC, innerRadius, rayleigh, mie, opacity);\n vec3 color = czm_computeAtmosphereColor(ray, lightWC, rayleigh, mie, opacity).rgb * skyLightIntensity / czm_atmosphereLightIntensity;\n return czm_inverseGamma(czm_pbrNeutralTonemapping(color));\n}\n\n// the clear sky seen from the camera\nvec3 clearSky(vec3 directionWC, vec3 lightWC) {\n return clearSkyFrom(czm_viewerPositionWC, czm_eyeHeight, directionWC, lightWC);\n}\n\n// the clear sky seen from under the camera at a height, or from the camera if it is lower: from\n// far above, the camera sees the black of space overhead, not the sky the clouds and the haze see,\n// whose color divided by its luminance would turn to any hue\nvec3 clearSkyBelow(float height, vec3 directionWC, vec3 lightWC) {\n float h = min(czm_eyeHeight, height);\n return clearSkyFrom(czm_viewerPositionWC - normalize(czm_viewerPositionWC) * (czm_eyeHeight - h), h, directionWC, lightWC);\n}\n\n// the clear sky toward a view direction in eye coordinates, at its azimuth and at an elevation\n// above the horizon, in radians, lit by the scene's light, as the sky's atmosphere is lit by\n// default: the scene's atmosphere is lit from overhead by default, and would turn the horizon cyan\n// at any time of day\nvec3 skyToward(vec3 view, float elevation) {\n vec3 level = view - dot(view, up) * up;\n level = dot(level, level) > 1e-6 ? normalize(level) : normalize(cross(up, vec3(1.0, 0.0, 0.0)));\n return clearSky(czm_inverseViewRotation * (cos(elevation) * level + sin(elevation) * up), czm_lightDirectionWC);\n}\n\n// the clear sky toward a view direction in eye coordinates, from the sky table: at its azimuth from\n// the sun's, SKY_ELEVATION above the horizon, toward overhead as it looks up\nvec3 skyFromTable(vec3 view) {\n vec3 level = view - dot(view, up) * up;\n vec3 sun = czm_lightDirectionEC - dot(czm_lightDirectionEC, up) * up;\n float cosAzimuth = dot(level, level) > 1e-6 && dot(sun, sun) > 1e-6 ? dot(normalize(level), normalize(sun)) : 1.0;\n float u = (acos(clamp(cosAzimuth, -1.0, 1.0)) / czm_pi * (SKY_TABLE - 1.0) + 0.5) / (SKY_TABLE + 1.0);\n vec3 horizon = texture(skyTable, vec2(u, 0.5)).rgb;\n vec3 zenith = texture(skyTable, vec2((SKY_TABLE + 0.5) / (SKY_TABLE + 1.0), 0.5)).rgb;\n return mix(horizon, zenith, max(dot(view, up), 0.0));\n}\n\n// the haze's light toward the eye along a view direction in eye coordinates, under an overcast as\n// thick as it rains at the camera or along the ray, 0 to 1: the sky's, from the clear sky to the\n// overcast gray, and the sun's through the clouds, as much of it as reaches the haze, 0 to 1.\n// Drops scatter nearly all the light they intercept: an albedo of 1\nvec3 rainHazeColor(vec3 view, float day, float snow, float overcast, float sunlit) {\n float elevation = max(dot(view, up), 0.0);\n vec3 sky = skyFromTable(view);\n vec3 overcastSky = mix(RAIN_HAZE, SNOW_HAZE, snow) * (1.0 + 2.0 * elevation) * (1.0 - THICK_CLOUDS * overcast);\n vec3 sun = czm_lightColor * sunlit * henyeyGreenstein(dot(view, czm_lightDirectionEC), mix(HAZE_ASYMMETRY.x, HAZE_ASYMMETRY.y, snow));\n vec3 color = min(mix(sky, overcastSky, overcast) + sun, vec3(1.0));\n return byDaylight(color, day);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=RainHaze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RainHaze.d.ts","sourceRoot":"","sources":["../../src/shaders/RainHaze.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from RainHaze.glsl.
|
|
2
|
+
export default "// The haze of the rain or the snow, which Precipitation and Clouds share: its extinction, its\n// opacity over an optical depth, and its color. The rain has no color of its own: its extinction\n// is the same at all wavelengths for drops above 0.2 mm (Montero-Martinez et al. 2025), so the\n// haze is the light of the sky and the sun it scatters toward the eye, L_in = (1 - T) * (the light\n// scattered toward the eye) (Hillaire 2020): the clear sky of Cesium's atmosphere at the horizon,\n// warm toward the sun and blue away from it, turning under thick clouds to the gray of an\n// overcast sky, brighter overhead, and the sun's forward glow through thin clouds. A moonlit blue\n// at night, as ValleyFog's. Needs Height, Fog and Phase.\nprecision highp sampler2D;\n\n// the light intensity of the sky's atmosphere, which is not the scene's atmosphere's: 50 rather than\n// 10 by default\nuniform float skyLightIntensity;\n// the clear sky toward the horizon and overhead, from SkyTable.glsl\nuniform sampler2D skyTable;\n\n// the rain rate, in mm/h, at intensity 1, the map's intensity being sqrt(R / RAIN_RATE), as the\n// weather demo draws it from MeteoSwiss' radar\nconst float RAIN_RATE = 10.0;\n// the extinction per meter of the rain, 0.11 R^0.85 per km at R mm/h, added to the clear air's, 0.1\n// per km (Montero-Martinez et al. 2025): 39 km of visibility in dry air, 11.5 km at 2.5 mm/h, 4.4 km\n// at 10 mm/h\nconst vec2 RAIN_LAW = vec2(0.00011, 0.85);\n// layers of haze thinning out with the height, their extinction per meter at sea level and their\n// scale height in meters, summed in optical depth with the rain's: the clear air's, 0.1 per km at\n// the ground, over an aerosol's scale height of 1 to 2 km; and a mist lying low, 1 per km at the\n// Swiss plateau's 500 m, that fills the valleys and leaves the ridges above it. Both scale heights\n// and the mist's extinction are not from a source\nconst vec2 CLEAR_AIR = vec2(0.0001, 1200.0);\nconst vec2 MIST = vec2(0.0035, 400.0);\n// the rain's extinction drifts in bands, by this share around its mean: sigma_rain *=\n// mix(0.6, 1.4, noise) (Wronski 2014, \"procedural Perlin noise animated by wind\")\nconst float RAIN_BANDS = 0.4;\n// visibility in meters at intensity 0 and 1 in the snow\nconst vec2 SNOW_VISIBILITY = vec2(20000.0, 500.0);\n// the haze never quite hides the sky and the far terrain\nconst float MAX_HAZE = 0.9;\n// the overcast sky at the horizon by day, a brighter gray under snow clouds; overhead, it is three\n// times as bright, the CIE's overcast sky, L / L_zenith = (1 + 2 sin(elevation)) / 3 (CIE 2003),\n// and darker under thick clouds, by up to this share: the report's 0.6 left the haze under the\n// heaviest rain at a quarter of the brightness, darker than the scene it veils, which the overcast\n// only dims by half\nconst vec3 RAIN_HAZE = vec3(0.6, 0.64, 0.68);\nconst vec3 SNOW_HAZE = vec3(0.7, 0.72, 0.76);\nconst float THICK_CLOUDS = 0.3;\n// the asymmetry of the light scattered by the rain and by the snow, from the haze's 0.7 to the\n// rain's 0.9 to 1 (arXiv 1403.2977)\nconst vec2 HAZE_ASYMMETRY = vec2(0.9, 0.75);\n// the sky toward the horizon is a ray this long, out of the atmosphere\nconst float SKY_RAY = 1e7;\n// the clear sky at the horizon is read this far above it, in radians, 5 degrees: right at it,\n// Cesium's atmosphere turns a pale cyan that its sky, interpolated from the vertices of its dome,\n// never shows\nconst float SKY_ELEVATION = 0.087;\n// the sky table's texels toward the horizon, besides the one overhead, SkyTable.glsl's\nconst float SKY_TABLE = 64.0;\n\n// the extinction per meter, from the rain's to the snow's, as hard as it rains: 3.912 / visibility\n// is the extinction that leaves 2 % of the light. None where it does not rain, rising from 0 at the\n// edge of the rain: the dry air is Cesium's fog's\nfloat rainExtinction(float intensity, float snow) {\n float rain = max(RAIN_LAW.x * pow(RAIN_RATE * intensity * intensity, RAIN_LAW.y), 1e-9);\n float snowfall = 3.912 / (SNOW_VISIBILITY.x * pow(SNOW_VISIBILITY.y / SNOW_VISIBILITY.x, intensity));\n return smoothstep(0.0, 0.15, intensity) * rain * pow(snowfall / rain, snow);\n}\n\n// the optical depth of a layer of haze along a straight ray this long from height h0 to h1, its\n// height linear along it: the line integral of exponential height fog,\n// (a / b) exp(-b h0) (1 - exp(-b dh)) / dh per unit of length (Quilez), with the first terms of its\n// Taylor series where the ray is level, as Flax's ExponentialHeightFog.hlsl\nfloat layerDepth(vec2 layer, float h0, float h1, float rayLength) {\n float x = (h1 - h0) / layer.y;\n float level = abs(x) < 1e-3 ? 1.0 - 0.5 * x : (1.0 - exp(-x)) / x;\n return layer.x * rayLength * exp(-h0 / layer.y) * level;\n}\n\n// the haze's opacity over an optical depth in the rain\nfloat rainHaze(float opticalDepth) {\n return MAX_HAZE * (1.0 - exp(-opticalDepth));\n}\n\n// the clear sky in a direction in world coordinates from a point at a height, as the sky shader of Cesium's atmosphere\n// renders it without high dynamic range, its inner radius lowered as SkyAtmosphereCommon.glsl\n// lowers it: from the ellipsoid's surface, a ray toward the horizon would cross the densest air\n// for hundreds of kilometers and turn a dim yellow\nvec3 clearSkyFrom(vec3 originWC, float height, vec3 directionWC, vec3 lightWC) {\n czm_ray ray = czm_ray(originWC, directionWC);\n float radiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;\n float adjust = 0.5 * radiiDifference * clamp((height - 0.25 * czm_ellipsoidRadii.x) / (0.75 * czm_ellipsoidRadii.x), 0.0, 1.0);\n float innerRadius = length(originWC) - height - 0.25 * radiiDifference - adjust;\n vec3 rayleigh;\n vec3 mie;\n float opacity;\n czm_computeScattering(ray, SKY_RAY, lightWC, innerRadius, rayleigh, mie, opacity);\n vec3 color = czm_computeAtmosphereColor(ray, lightWC, rayleigh, mie, opacity).rgb * skyLightIntensity / czm_atmosphereLightIntensity;\n return czm_inverseGamma(czm_pbrNeutralTonemapping(color));\n}\n\n// the clear sky seen from the camera\nvec3 clearSky(vec3 directionWC, vec3 lightWC) {\n return clearSkyFrom(czm_viewerPositionWC, czm_eyeHeight, directionWC, lightWC);\n}\n\n// the clear sky seen from under the camera at a height, or from the camera if it is lower: from\n// far above, the camera sees the black of space overhead, not the sky the clouds and the haze see,\n// whose color divided by its luminance would turn to any hue\nvec3 clearSkyBelow(float height, vec3 directionWC, vec3 lightWC) {\n float h = min(czm_eyeHeight, height);\n return clearSkyFrom(czm_viewerPositionWC - normalize(czm_viewerPositionWC) * (czm_eyeHeight - h), h, directionWC, lightWC);\n}\n\n// the clear sky toward a view direction in eye coordinates, at its azimuth and at an elevation\n// above the horizon, in radians, lit by the scene's light, as the sky's atmosphere is lit by\n// default: the scene's atmosphere is lit from overhead by default, and would turn the horizon cyan\n// at any time of day\nvec3 skyToward(vec3 view, float elevation) {\n vec3 level = view - dot(view, up) * up;\n level = dot(level, level) > 1e-6 ? normalize(level) : normalize(cross(up, vec3(1.0, 0.0, 0.0)));\n return clearSky(czm_inverseViewRotation * (cos(elevation) * level + sin(elevation) * up), czm_lightDirectionWC);\n}\n\n// the clear sky toward a view direction in eye coordinates, from the sky table: at its azimuth from\n// the sun's, SKY_ELEVATION above the horizon, toward overhead as it looks up\nvec3 skyFromTable(vec3 view) {\n vec3 level = view - dot(view, up) * up;\n vec3 sun = czm_lightDirectionEC - dot(czm_lightDirectionEC, up) * up;\n float cosAzimuth = dot(level, level) > 1e-6 && dot(sun, sun) > 1e-6 ? dot(normalize(level), normalize(sun)) : 1.0;\n float u = (acos(clamp(cosAzimuth, -1.0, 1.0)) / czm_pi * (SKY_TABLE - 1.0) + 0.5) / (SKY_TABLE + 1.0);\n vec3 horizon = texture(skyTable, vec2(u, 0.5)).rgb;\n vec3 zenith = texture(skyTable, vec2((SKY_TABLE + 0.5) / (SKY_TABLE + 1.0), 0.5)).rgb;\n return mix(horizon, zenith, max(dot(view, up), 0.0));\n}\n\n// the haze's light toward the eye along a view direction in eye coordinates, under an overcast as\n// thick as it rains at the camera or along the ray, 0 to 1: the sky's, from the clear sky to the\n// overcast gray, and the sun's through the clouds, as much of it as reaches the haze, 0 to 1.\n// Drops scatter nearly all the light they intercept: an albedo of 1\nvec3 rainHazeColor(vec3 view, float day, float snow, float overcast, float sunlit) {\n float elevation = max(dot(view, up), 0.0);\n vec3 sky = skyFromTable(view);\n vec3 overcastSky = mix(RAIN_HAZE, SNOW_HAZE, snow) * (1.0 + 2.0 * elevation) * (1.0 - THICK_CLOUDS * overcast);\n vec3 sun = czm_lightColor * sunlit * henyeyGreenstein(dot(view, czm_lightDirectionEC), mix(HAZE_ASYMMETRY.x, HAZE_ASYMMETRY.y, snow));\n vec3 color = min(mix(sky, overcastSky, overcast) + sun, vec3(1.0));\n return byDaylight(color, day);\n}\n";
|
|
3
|
+
//# sourceMappingURL=RainHaze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RainHaze.js","sourceRoot":"","sources":["../../src/shaders/RainHaze.js"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,eAAe,+zRAA+zR,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Rings where the rain lands: the ground cut into cells of a local frame, in each cell a drop landing, as often as the intensity says, where the\n// cell's hash puts it, a thin ring growing from it and fading as it grows, on what is flat enough. Over water slower and wider. The cells are in a\n// local frame, in double precision from the CPU (local-frame.js), so they stay where they are as the camera moves and do not step with the globe's\n// size. Needs EyeFromDepth, Height, Hash and Normal.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform mat4 localFromEye;\n// 0 to 1: the share of the cells that have a drop\nuniform float intensity;\n// meters: a cell's size, and how far a ring on the ground grows\nuniform float cell;\nuniform float reach;\n// meters above the ellipsoid, far above anything with no water\nuniform float waterLevel;\n// radians\nuniform float maxSlope;\n// rings a second\nuniform float rate;\n// seconds\nuniform float time;\n// the color of a ring, its alpha how strongly it shows\nuniform vec4 color;\nin vec2 v_textureCoordinates;\n\n// a ring over water reaches this much farther, and runs this much slower\nconst float WATER_REACH = 1.7;\nconst float WATER_RATE = 0.5;\n// meters from the water's level within which a surface is water, and beyond which it is not\nconst vec2 WET = vec2(0.1, 0.25);\n// the drop lands in the middle of its cell, this far from its edge, in cells: a ring is clipped at the edge\nconst float MARGIN = 0.3;\n// the narrowest line, in meters\nconst float LINE = 0.045;\n// a pixel wider than the first, in meters, fades the rings out to none at the second: they would be a speckle\nconst vec2 SMALL = vec2(0.08, 0.2);\n// half the width of the slope limit, in radians\nconst float SLOPE_EDGE = 0.1;\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n if (intensity <= 0.0 || eye.w == 0.0) {\n out_FragColor = sceneColor;\n return;\n }\n vec3 normal = smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz);\n float slope = acos(clamp(dot(normal, up), -1.0, 1.0));\n vec2 local = (localFromEye * vec4(eye.xyz, 1.0)).xy;\n float wet = 1.0 - smoothstep(WET.x, WET.y, abs(heightAt(eye.xyz) - waterLevel));\n\n vec2 id = floor(local / cell);\n vec2 centre = (id + MARGIN + (1.0 - 2.0 * MARGIN) * vec2(hash(id + 3.1), hash(id + 7.7))) * cell;\n float phase = fract(time * rate * mix(1.0, WATER_RATE, wet) + hash(id + 11.3));\n // never past the cell's edge from the centre\n float grown = min(reach * mix(1.0, WATER_REACH, wet), MARGIN * cell) * phase;\n float distance = length(local - centre);\n float width = max(LINE, 1.5 * fwidth(distance));\n float ring = (1.0 - smoothstep(0.0, width, abs(distance - grown))) * (1.0 - phase);\n ring *= float(hash(id) < intensity);\n ring *= 1.0 - smoothstep(maxSlope - SLOPE_EDGE, maxSlope + SLOPE_EDGE, slope);\n ring *= 1.0 - smoothstep(SMALL.x, SMALL.y, length(fwidth(local)));\n out_FragColor = vec4(mix(sceneColor.rgb, color.rgb, ring * color.a), sceneColor.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=RainRings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RainRings.d.ts","sourceRoot":"","sources":["../../src/shaders/RainRings.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from RainRings.glsl.
|
|
2
|
+
export default "// Rings where the rain lands: the ground cut into cells of a local frame, in each cell a drop landing, as often as the intensity says, where the\n// cell's hash puts it, a thin ring growing from it and fading as it grows, on what is flat enough. Over water slower and wider. The cells are in a\n// local frame, in double precision from the CPU (local-frame.js), so they stay where they are as the camera moves and do not step with the globe's\n// size. Needs EyeFromDepth, Height, Hash and Normal.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform mat4 localFromEye;\n// 0 to 1: the share of the cells that have a drop\nuniform float intensity;\n// meters: a cell's size, and how far a ring on the ground grows\nuniform float cell;\nuniform float reach;\n// meters above the ellipsoid, far above anything with no water\nuniform float waterLevel;\n// radians\nuniform float maxSlope;\n// rings a second\nuniform float rate;\n// seconds\nuniform float time;\n// the color of a ring, its alpha how strongly it shows\nuniform vec4 color;\nin vec2 v_textureCoordinates;\n\n// a ring over water reaches this much farther, and runs this much slower\nconst float WATER_REACH = 1.7;\nconst float WATER_RATE = 0.5;\n// meters from the water's level within which a surface is water, and beyond which it is not\nconst vec2 WET = vec2(0.1, 0.25);\n// the drop lands in the middle of its cell, this far from its edge, in cells: a ring is clipped at the edge\nconst float MARGIN = 0.3;\n// the narrowest line, in meters\nconst float LINE = 0.045;\n// a pixel wider than the first, in meters, fades the rings out to none at the second: they would be a speckle\nconst vec2 SMALL = vec2(0.08, 0.2);\n// half the width of the slope limit, in radians\nconst float SLOPE_EDGE = 0.1;\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n if (intensity <= 0.0 || eye.w == 0.0) {\n out_FragColor = sceneColor;\n return;\n }\n vec3 normal = smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz);\n float slope = acos(clamp(dot(normal, up), -1.0, 1.0));\n vec2 local = (localFromEye * vec4(eye.xyz, 1.0)).xy;\n float wet = 1.0 - smoothstep(WET.x, WET.y, abs(heightAt(eye.xyz) - waterLevel));\n\n vec2 id = floor(local / cell);\n vec2 centre = (id + MARGIN + (1.0 - 2.0 * MARGIN) * vec2(hash(id + 3.1), hash(id + 7.7))) * cell;\n float phase = fract(time * rate * mix(1.0, WATER_RATE, wet) + hash(id + 11.3));\n // never past the cell's edge from the centre\n float grown = min(reach * mix(1.0, WATER_REACH, wet), MARGIN * cell) * phase;\n float distance = length(local - centre);\n float width = max(LINE, 1.5 * fwidth(distance));\n float ring = (1.0 - smoothstep(0.0, width, abs(distance - grown))) * (1.0 - phase);\n ring *= float(hash(id) < intensity);\n ring *= 1.0 - smoothstep(maxSlope - SLOPE_EDGE, maxSlope + SLOPE_EDGE, slope);\n ring *= 1.0 - smoothstep(SMALL.x, SMALL.y, length(fwidth(local)));\n out_FragColor = vec4(mix(sceneColor.rgb, color.rgb, ring * color.a), sceneColor.a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=RainRings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RainRings.js","sourceRoot":"","sources":["../../src/shaders/RainRings.js"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAe,wkGAAwkG,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Shockwave: from each impact, a ring of refraction spreads over the picture, pushing it\n// outward, with a faint bright rim, and dies out. The ring is measured in meters at the\n// impact's depth, so a far impact makes a small ring.\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nconst int MAX_IMPACTS = 8;\n// in eye coordinates; w is the age in seconds, negative for an unused slot\nuniform vec4 impacts[MAX_IMPACTS];\n// 0 to 1\nuniform float strength;\n// meters per second\nuniform float speed;\n// seconds\nuniform float duration;\nin vec2 v_textureCoordinates;\n\n// meters, at full strength\nconst float WIDTH = 0.4;\nconst float AMPLITUDE = 0.1;\nconst float GLOW = 0.06;\n// an impact this far behind the depth under it is hidden, meters\nconst float OCCLUSION = 0.5;\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);\n // in half screen heights, from the middle of the screen\n vec2 pixel = (2.0 * uv - 1.0) * aspect;\n vec2 offset = vec2(0.0);\n float glow = 0.0;\n for (int i = 0; i < MAX_IMPACTS; i++) {\n vec4 impact = impacts[i];\n if (impact.w < 0.0 || impact.w > duration || impact.z >= 0.0) {\n continue;\n }\n vec4 clip = czm_projection * vec4(impact.xyz, 1.0);\n vec2 center = clip.xy / clip.w;\n vec4 under = eyeAt(depthTexture, 0.5 * center + 0.5);\n if (under.w != 0.0 && length(under.xyz) < length(impact.xyz) - OCCLUSION) {\n continue;\n }\n // meters at the impact's depth to half screen heights\n float scale = czm_projection[1][1] / -impact.z;\n vec2 toPixel = pixel - center * aspect;\n float distance = length(toPixel) / scale;\n float radius = speed * impact.w;\n float band = exp(-pow((distance - radius) / WIDTH, 2.0));\n float decay = strength * pow(1.0 - impact.w / duration, 2.0);\n vec2 direction = distance > 0.0 ? normalize(toPixel) : vec2(0.0);\n // pushed outward: the pixel shows what was nearer the center\n offset -= direction * AMPLITUDE * scale * band * decay;\n glow += GLOW * band * decay;\n }\n // half screen heights to texture coordinates\n vec4 color = texture(colorTexture, clamp(uv + 0.5 * offset / aspect, 0.0, 1.0));\n out_FragColor = vec4(color.rgb + glow, color.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=Shockwave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shockwave.d.ts","sourceRoot":"","sources":["../../src/shaders/Shockwave.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from Shockwave.glsl.
|
|
2
|
+
export default "// Shockwave: from each impact, a ring of refraction spreads over the picture, pushing it\n// outward, with a faint bright rim, and dies out. The ring is measured in meters at the\n// impact's depth, so a far impact makes a small ring.\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nconst int MAX_IMPACTS = 8;\n// in eye coordinates; w is the age in seconds, negative for an unused slot\nuniform vec4 impacts[MAX_IMPACTS];\n// 0 to 1\nuniform float strength;\n// meters per second\nuniform float speed;\n// seconds\nuniform float duration;\nin vec2 v_textureCoordinates;\n\n// meters, at full strength\nconst float WIDTH = 0.4;\nconst float AMPLITUDE = 0.1;\nconst float GLOW = 0.06;\n// an impact this far behind the depth under it is hidden, meters\nconst float OCCLUSION = 0.5;\n\nvoid main() {\n vec2 uv = v_textureCoordinates;\n vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);\n // in half screen heights, from the middle of the screen\n vec2 pixel = (2.0 * uv - 1.0) * aspect;\n vec2 offset = vec2(0.0);\n float glow = 0.0;\n for (int i = 0; i < MAX_IMPACTS; i++) {\n vec4 impact = impacts[i];\n if (impact.w < 0.0 || impact.w > duration || impact.z >= 0.0) {\n continue;\n }\n vec4 clip = czm_projection * vec4(impact.xyz, 1.0);\n vec2 center = clip.xy / clip.w;\n vec4 under = eyeAt(depthTexture, 0.5 * center + 0.5);\n if (under.w != 0.0 && length(under.xyz) < length(impact.xyz) - OCCLUSION) {\n continue;\n }\n // meters at the impact's depth to half screen heights\n float scale = czm_projection[1][1] / -impact.z;\n vec2 toPixel = pixel - center * aspect;\n float distance = length(toPixel) / scale;\n float radius = speed * impact.w;\n float band = exp(-pow((distance - radius) / WIDTH, 2.0));\n float decay = strength * pow(1.0 - impact.w / duration, 2.0);\n vec2 direction = distance > 0.0 ? normalize(toPixel) : vec2(0.0);\n // pushed outward: the pixel shows what was nearer the center\n offset -= direction * AMPLITUDE * scale * band * decay;\n glow += GLOW * band * decay;\n }\n // half screen heights to texture coordinates\n vec4 color = texture(colorTexture, clamp(uv + 0.5 * offset / aspect, 0.0, 1.0));\n out_FragColor = vec4(color.rgb + glow, color.a);\n}\n";
|
|
3
|
+
//# sourceMappingURL=Shockwave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shockwave.js","sourceRoot":"","sources":["../../src/shaders/Shockwave.js"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAe,qvEAAqvE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// The clear sky the haze scatters, drawn by precipitation.js into a small table at each frame,\n// rather than computed twice for each pixel: its first SKY_TABLE texels at SKY_ELEVATION above the\n// horizon, at azimuths from the sun's to its opposite, the sky being symmetric about the sun's\n// vertical plane, and its last overhead, seen from no higher than the cloud base. In world\n// coordinates, the camera's up the ellipsoid's normal under it, so that the camera turning between\n// frames does not skew it. Needs Height, Fog, Phase and RainHaze.\n// meters above the ellipsoid, the precipitation's\nuniform float cloudBase;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n vec3 upWC = normalize(czm_viewerPositionWC * czm_ellipsoidInverseRadii * czm_ellipsoidInverseRadii);\n float i = floor(v_textureCoordinates.x * (SKY_TABLE + 1.0));\n if (i >= SKY_TABLE) {\n out_FragColor = vec4(clearSkyBelow(cloudBase, upWC, czm_lightDirectionWC), 1.0);\n return;\n }\n vec3 sun = czm_lightDirectionWC - dot(czm_lightDirectionWC, upWC) * upWC;\n sun = dot(sun, sun) > 1e-6 ? normalize(sun) : normalize(cross(upWC, vec3(1.0, 0.0, 0.0)));\n float azimuth = czm_pi * i / (SKY_TABLE - 1.0);\n vec3 level = cos(azimuth) * sun + sin(azimuth) * cross(upWC, sun);\n out_FragColor = vec4(clearSkyBelow(cloudBase, cos(SKY_ELEVATION) * level + sin(SKY_ELEVATION) * upWC, czm_lightDirectionWC), 1.0);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=SkyTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkyTable.d.ts","sourceRoot":"","sources":["../../src/shaders/SkyTable.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file is automatically rebuilt from SkyTable.glsl.
|
|
2
|
+
export default "// The clear sky the haze scatters, drawn by precipitation.js into a small table at each frame,\n// rather than computed twice for each pixel: its first SKY_TABLE texels at SKY_ELEVATION above the\n// horizon, at azimuths from the sun's to its opposite, the sky being symmetric about the sun's\n// vertical plane, and its last overhead, seen from no higher than the cloud base. In world\n// coordinates, the camera's up the ellipsoid's normal under it, so that the camera turning between\n// frames does not skew it. Needs Height, Fog, Phase and RainHaze.\n// meters above the ellipsoid, the precipitation's\nuniform float cloudBase;\nin vec2 v_textureCoordinates;\n\nvoid main() {\n vec3 upWC = normalize(czm_viewerPositionWC * czm_ellipsoidInverseRadii * czm_ellipsoidInverseRadii);\n float i = floor(v_textureCoordinates.x * (SKY_TABLE + 1.0));\n if (i >= SKY_TABLE) {\n out_FragColor = vec4(clearSkyBelow(cloudBase, upWC, czm_lightDirectionWC), 1.0);\n return;\n }\n vec3 sun = czm_lightDirectionWC - dot(czm_lightDirectionWC, upWC) * upWC;\n sun = dot(sun, sun) > 1e-6 ? normalize(sun) : normalize(cross(upWC, vec3(1.0, 0.0, 0.0)));\n float azimuth = czm_pi * i / (SKY_TABLE - 1.0);\n vec3 level = cos(azimuth) * sun + sin(azimuth) * cross(upWC, sun);\n out_FragColor = vec4(clearSkyBelow(cloudBase, cos(SKY_ELEVATION) * level + sin(SKY_ELEVATION) * upWC, czm_lightDirectionWC), 1.0);\n}\n";
|
|
3
|
+
//# sourceMappingURL=SkyTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkyTable.js","sourceRoot":"","sources":["../../src/shaders/SkyTable.js"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,eAAe,m4CAAm4C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default = "// Snow above an altitude, on slopes gentle enough to hold it, shaded by the sun and by the\n// brightness of the scene so that the relief stays readable. The slope comes from a normal\n// rebuilt from the neighboring pixels and smoothed over the facets of the terrain. Noise anchored\n// to the ground breaks up the edge of the snow, which lasts lower on the slopes away from the sun.\nprecision highp sampler2D;\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n// meters above the ellipsoid: half covered at the altitude, over a band transition meters high\nuniform float altitude;\nuniform float transition;\n// radians\nuniform float maxSlope;\n// 0 to 1\nuniform float coverage;\n// 0 to 1: how far the coverage thins the snow into patches, where 0 fades it\nuniform float patchiness;\n// meters: the noise's largest scale, its finer ones a third and a ninth of it\nuniform float grain;\n// 0 to 1: how far the snow's brightness is the scene's own (its shadows, the dusk), where 0 is the sun's shading\nuniform float sceneLight;\n// 0 to 1: the part of the snow that still covers the steep slopes at the limit, as a fraction of the coverage\nuniform float steepCover;\n// the local frame's coordinates from the eye's, made in double precision on the CPU (local-frame.js): the noise's place\nuniform mat4 localFromEye;\n// meters above the ellipsoid, far above anything with no water: none lies within a quarter meter of it\nuniform float waterLevel;\n// the sun toward which the snow is shaded, in eye coordinates, when ownSun is 1; else Cesium's\nuniform vec3 sunEC;\nuniform float ownSun;\nin vec2 v_textureCoordinates;\n\nconst vec3 SNOW_SHADE = vec3(0.80, 0.87, 1.0);\nconst vec3 SNOW_SUN = vec3(1.0, 0.98, 0.94);\n// meters the snow line moves down on a slope facing away from the sun, and up on one facing it\nconst float ASPECT_SHIFT = 0.6;\n// meters the noise moves the snow line, as a fraction of the transition\nconst float NOISE_SHIFT = 0.8;\n// half width of the slope limit, in radians (8 degrees), so that the snow thins out across the\n// facets of the terrain rather than stopping at their edges\nconst float SLOPE_EDGE = 0.14;\n// the coverage, moved by the noise, from which the snow begins and is whole when it is patches; how far the noise moves it\nconst vec2 PATCH = vec2(0.25, 0.6);\nconst float PATCH_NOISE = 1.6;\n// meters from the water's level within which a surface is water, and beyond which it is not\nconst vec2 WET = vec2(0.1, 0.25);\n\nfloat hash(vec3 p) {\n p = fract(p * 0.3183099 + 0.1);\n p *= 17.0;\n return fract(p.x * p.y * p.z * (p.x + p.y + p.z));\n}\n\nfloat valueNoise(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(mix(hash(i), hash(i + vec3(1, 0, 0)), f.x), mix(hash(i + vec3(0, 1, 0)), hash(i + vec3(1, 1, 0)), f.x), f.y),\n mix(mix(hash(i + vec3(0, 0, 1)), hash(i + vec3(1, 0, 1)), f.x), mix(hash(i + vec3(0, 1, 1)), hash(i + vec3(1, 1, 1)), f.x), f.y),\n f.z);\n}\n\n// 0 to 1, from a few octaves anchored to the ground, in the local frame: in world coordinates a float steps by half a meter\nfloat groundNoise(vec3 local) {\n return 0.55 * valueNoise(local / grain) + 0.3 * valueNoise(3.0 * local / grain) + 0.15 * valueNoise(9.0 * local / grain);\n}\n\nvoid main() {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n vec4 eye = eyeAt(depthTexture, v_textureCoordinates);\n vec3 normal = smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz);\n float slope = acos(clamp(dot(normal, up), -1.0, 1.0));\n\n float sun = max(dot(normal, ownSun > 0.5 ? sunEC : czm_sunDirectionEC), 0.0);\n float noise = groundNoise((localFromEye * vec4(eye.xyz, 1.0)).xyz) - 0.5;\n // lower on the slopes away from the sun, irregular along the edge\n float shift = transition * (NOISE_SHIFT * noise + ASPECT_SHIFT * (0.5 - sun));\n float snowLine = altitude + shift;\n float snow = smoothstep(snowLine - 0.5 * transition, snowLine + 0.5 * transition, heightAt(eye.xyz));\n // opaque before the top of the band, so that the imagery does not show through the snow\n snow = smoothstep(0.0, 0.7, snow);\n // the steep slopes keep a thin, patchy cover, and the rock shows through\n float steep = smoothstep(maxSlope - SLOPE_EDGE, maxSlope + SLOPE_EDGE, slope);\n snow *= 1.0 - steep * (1.0 - steepCover * smoothstep(0.35, 0.65, noise + 0.5));\n // the coverage an opacity, or, by the patchiness, the share of the ground the snow covers, the noise leaving it in patches\n float scattered = smoothstep(PATCH.x, PATCH.y, coverage + PATCH_NOISE * noise);\n // eye.w is 0 for the sky\n snow *= mix(coverage, scattered, patchiness) * eye.w;\n snow *= smoothstep(WET.x, WET.y, abs(heightAt(eye.xyz) - waterLevel));\n float brightness = czm_luminance(sceneColor.rgb);\n // blue in the shade, warm in the sun, with the relief of the scene kept in the brightness; or as bright as the scene, its shadows and its\n // dusk kept on the snow\n float shaded = clamp(0.68 + 0.25 * sun + 0.1 * brightness, 0.0, 1.0);\n float scene = clamp(0.15 + 1.35 * brightness, 0.0, 1.0);\n vec3 lit = mix(SNOW_SHADE, SNOW_SUN, sun) * mix(shaded, scene, sceneLight);\n out_FragColor = vec4(mix(sceneColor.rgb, lit, snow), sceneColor.a);\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=SnowLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnowLine.d.ts","sourceRoot":"","sources":["../../src/shaders/SnowLine.js"],"names":[],"mappings":""}
|