@geoblocks/cesium-post-process 0.4.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/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/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/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/{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/{local-frame.js → src/local-frame.js} +0 -0
- /package/{motion-blur.js → src/motion-blur.js} +0 -0
- /package/{precipitation.js → src/precipitation.js} +0 -0
- /package/{rain-rings.js → src/rain-rings.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}/SnowLine.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/{snow-line.js → src/snow-line.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,21 @@
|
|
|
1
|
+
// The shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain
|
|
2
|
+
// in the sun, blurred over the neighboring texels at
|
|
3
|
+
// their own resolution: they fade out around the ridges in front of them rather than stopping at
|
|
4
|
+
// their outline. A 3 x 3 binomial kernel here costs a 64th of the reads the same blur would take
|
|
5
|
+
// at the full resolution.
|
|
6
|
+
precision highp sampler2D;
|
|
7
|
+
uniform sampler2D shaftTexture;
|
|
8
|
+
in vec2 v_textureCoordinates;
|
|
9
|
+
|
|
10
|
+
void main() {
|
|
11
|
+
// czm_viewport is this pass's texture, the size of the shafts'
|
|
12
|
+
vec2 texel = 1.0 / czm_viewport.zw;
|
|
13
|
+
vec4 sum = vec4(0.0);
|
|
14
|
+
for (int y = -1; y <= 1; y++) {
|
|
15
|
+
for (int x = -1; x <= 1; x++) {
|
|
16
|
+
float weight = (x == 0 ? 2.0 : 1.0) * (y == 0 ? 2.0 : 1.0);
|
|
17
|
+
sum += weight * texture(shaftTexture, v_textureCoordinates + vec2(float(x), float(y)) * texel);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
out_FragColor = sum / 16.0;
|
|
21
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The shafts of the rain or the snow, at a fraction of the resolution: their opacity along each
|
|
2
|
+
// view ray, for Precipitation.glsl to shade, and the ray's mean extinction, as a share of the
|
|
3
|
+
// extinction where the map is full, for its haze, which it computes at its own resolution, sharp at
|
|
4
|
+
// the ridges. Both are over the part of the ray below the cloud base, where it rains, found from the
|
|
5
|
+
// scene's depth before it is sampled:
|
|
6
|
+
// from far above, a pixel shows the rain in the column under it. Along that part, patches of noise
|
|
7
|
+
// on the ground under each sample, more of them as it rains harder, slanting with the wind from the
|
|
8
|
+
// cloud base and drifting with it, where the map has rain. Not dithered: at this resolution the
|
|
9
|
+
// dither shows as dots, where the patches are too soft to band. Needs EyeFromDepth, Noise, Height,
|
|
10
|
+
// PrecipitationWind, WeatherMap, Fog, Phase, RainHaze and CloudsShadow. With clouds in the scene, it also finds
|
|
11
|
+
// the share of the rain along the ray that the sun lights through their gaps, from their shadow map:
|
|
12
|
+
// the haze's light shafts (Wronski 2014's front-to-back march, on the clouds' shadow map as
|
|
13
|
+
// Hillaire 2016, sec. 5.9).
|
|
14
|
+
precision highp sampler2D;
|
|
15
|
+
uniform sampler2D depthTexture;
|
|
16
|
+
// 1 when the clouds' shadow map is there to read, 0 otherwise
|
|
17
|
+
uniform float shadowed;
|
|
18
|
+
in vec2 v_textureCoordinates;
|
|
19
|
+
|
|
20
|
+
// samples along the part of each ray below the cloud base, as far as SHAFT_DISTANCE from its
|
|
21
|
+
// start, size of the patches in meters, extinction inside them per meter, about 6 km of visibility
|
|
22
|
+
const int SHAFT_STEPS = 12;
|
|
23
|
+
const float SHAFT_DISTANCE = 20000.0;
|
|
24
|
+
const float SHAFT_SIZE = 2500.0;
|
|
25
|
+
// snow hides more, about 2.5 km
|
|
26
|
+
const vec2 SHAFT_EXTINCTION = vec2(0.0006, 0.0015);
|
|
27
|
+
// the wind's speed, from its tilt of the drops' fall at 9 m/s, also in the snow: a drift changing
|
|
28
|
+
// with the snow would move the shafts
|
|
29
|
+
const float DRIFT_VELOCITY = 9.0;
|
|
30
|
+
// the shafts thin out over this height below the cloud base, into the clouds
|
|
31
|
+
const float SHAFT_TOP = 1000.0;
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
35
|
+
vec3 rayEnd = eye.w == 0.0 ? eye.xyz * SKY_DISTANCE : eye.xyz;
|
|
36
|
+
// the part of the ray below the cloud base, and the part of it that is sampled
|
|
37
|
+
vec2 below = belowHeight(rayEnd, cloudBase);
|
|
38
|
+
float t0 = below.x;
|
|
39
|
+
float t1 = below.y;
|
|
40
|
+
float opacity = 0.0;
|
|
41
|
+
float share = 0.0;
|
|
42
|
+
float wet = 0.0;
|
|
43
|
+
float lit = 1.0;
|
|
44
|
+
if (t1 > t0) {
|
|
45
|
+
float rayLength = length(rayEnd);
|
|
46
|
+
float sampled = min(t1, t0 + SHAFT_DISTANCE / rayLength);
|
|
47
|
+
// the ray in world coordinates, once rather than for each sample
|
|
48
|
+
vec3 rayWC = czm_inverseViewRotation * rayEnd;
|
|
49
|
+
vec3 upWorld = upWC();
|
|
50
|
+
vec3 eastWorld = eastWC();
|
|
51
|
+
float threshold = mix(0.4, 0.0, intensity);
|
|
52
|
+
// the gusts sway the shafts, but they drift with the steady wind
|
|
53
|
+
float slant = tan(gustingTilt());
|
|
54
|
+
float drift = DRIFT_VELOCITY * speed * tan(radians(wind)) * time;
|
|
55
|
+
float raining = 0.0;
|
|
56
|
+
float sunlit = 0.0;
|
|
57
|
+
float density = 0.0;
|
|
58
|
+
for (int i = 0; i < SHAFT_STEPS; i++) {
|
|
59
|
+
float t = mix(t0, sampled, (float(i) + 0.5) / float(SHAFT_STEPS));
|
|
60
|
+
float h = heightAt(rayEnd * t);
|
|
61
|
+
vec3 ground = czm_viewerPositionWC + rayWC * t - upWorld * h;
|
|
62
|
+
float local = mapAt(ground);
|
|
63
|
+
ground -= eastWorld * ((cloudBase - h) * slant + drift);
|
|
64
|
+
float patches = gradientNoise(ground / SHAFT_SIZE);
|
|
65
|
+
// in bands drifting with the shafts, the noise being about -0.7 to 0.7
|
|
66
|
+
float extinction = rainExtinction(intensity * local, snow) * (1.0 + RAIN_BANDS * patches / 0.7);
|
|
67
|
+
raining += extinction;
|
|
68
|
+
// the sun through the clouds above the sample, weighted by how much it scatters there
|
|
69
|
+
vec3 sampleWC = czm_viewerPositionWC + rayWC * t;
|
|
70
|
+
sunlit += extinction * (shadowed > 0.0 ? exp(-shadowDepth(sampleWC)) : 1.0);
|
|
71
|
+
wet += smoothstep(0.0, 0.15, local);
|
|
72
|
+
float top = clamp((cloudBase - h) / SHAFT_TOP, 0.0, 1.0);
|
|
73
|
+
density += local * top * smoothstep(threshold - 0.3, threshold + 0.3, patches);
|
|
74
|
+
}
|
|
75
|
+
// the whole part below the cloud base is as rainy as its sampled part, its extinction as a
|
|
76
|
+
// share of the heaviest bands', and the share of it in the rain
|
|
77
|
+
share = raining / (float(SHAFT_STEPS) * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow));
|
|
78
|
+
wet /= float(SHAFT_STEPS);
|
|
79
|
+
lit = raining > 0.0 ? sunlit / raining : 1.0;
|
|
80
|
+
float depth = mix(SHAFT_EXTINCTION.x, SHAFT_EXTINCTION.y, snow) * (0.5 + 0.5 * intensity) * density * (sampled - t0) * rayLength / float(SHAFT_STEPS);
|
|
81
|
+
opacity = 1.0 - exp(-depth);
|
|
82
|
+
}
|
|
83
|
+
out_FragColor = vec4(opacity, share, wet, lit);
|
|
84
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// What the passes of the precipitation share: the local frame at the camera and the wind, in gusts.
|
|
2
|
+
// Needs Height.
|
|
3
|
+
// seconds, wrapped at an hour
|
|
4
|
+
uniform float time;
|
|
5
|
+
// tilt of the fall toward the east, in degrees
|
|
6
|
+
uniform float wind;
|
|
7
|
+
// speed of the drops, 1 at their terminal velocity
|
|
8
|
+
uniform float speed;
|
|
9
|
+
// meters above the ellipsoid
|
|
10
|
+
uniform float cloudBase;
|
|
11
|
+
// 0 to 1
|
|
12
|
+
uniform float intensity;
|
|
13
|
+
// share of the precipitation that is snow, 0 to 1
|
|
14
|
+
uniform float snow;
|
|
15
|
+
|
|
16
|
+
// the gusts: the wind's tilt varies by this share, over periods of 18 and 7.2 s that divide the
|
|
17
|
+
// hour the time wraps at
|
|
18
|
+
const float GUSTS = 0.35;
|
|
19
|
+
|
|
20
|
+
// up and east at the camera, in world coordinates
|
|
21
|
+
vec3 upWC() {
|
|
22
|
+
return czm_inverseViewRotation * up;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec3 eastWC() {
|
|
26
|
+
return normalize(cross(vec3(0.0, 0.0, 1.0), upWC()));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// the wind's tilt, in radians, in gusts
|
|
30
|
+
float gustingTilt() {
|
|
31
|
+
float gust = 1.0 + GUSTS * (0.6 * sin(czm_twoPi * time / 18.0) + 0.4 * sin(czm_twoPi * time / 7.2 + 1.3));
|
|
32
|
+
return radians(wind) * gust;
|
|
33
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// The haze of the rain or the snow, which Precipitation and Clouds share: its extinction, its
|
|
2
|
+
// opacity over an optical depth, and its color. The rain has no color of its own: its extinction
|
|
3
|
+
// is the same at all wavelengths for drops above 0.2 mm (Montero-Martinez et al. 2025), so the
|
|
4
|
+
// haze is the light of the sky and the sun it scatters toward the eye, L_in = (1 - T) * (the light
|
|
5
|
+
// scattered toward the eye) (Hillaire 2020): the clear sky of Cesium's atmosphere at the horizon,
|
|
6
|
+
// warm toward the sun and blue away from it, turning under thick clouds to the gray of an
|
|
7
|
+
// overcast sky, brighter overhead, and the sun's forward glow through thin clouds. A moonlit blue
|
|
8
|
+
// at night, as ValleyFog's. Needs Height, Fog and Phase.
|
|
9
|
+
precision highp sampler2D;
|
|
10
|
+
|
|
11
|
+
// the light intensity of the sky's atmosphere, which is not the scene's atmosphere's: 50 rather than
|
|
12
|
+
// 10 by default
|
|
13
|
+
uniform float skyLightIntensity;
|
|
14
|
+
// the clear sky toward the horizon and overhead, from SkyTable.glsl
|
|
15
|
+
uniform sampler2D skyTable;
|
|
16
|
+
|
|
17
|
+
// the rain rate, in mm/h, at intensity 1, the map's intensity being sqrt(R / RAIN_RATE), as the
|
|
18
|
+
// weather demo draws it from MeteoSwiss' radar
|
|
19
|
+
const float RAIN_RATE = 10.0;
|
|
20
|
+
// 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
|
|
21
|
+
// 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
|
|
22
|
+
// at 10 mm/h
|
|
23
|
+
const vec2 RAIN_LAW = vec2(0.00011, 0.85);
|
|
24
|
+
// layers of haze thinning out with the height, their extinction per meter at sea level and their
|
|
25
|
+
// scale height in meters, summed in optical depth with the rain's: the clear air's, 0.1 per km at
|
|
26
|
+
// the ground, over an aerosol's scale height of 1 to 2 km; and a mist lying low, 1 per km at the
|
|
27
|
+
// Swiss plateau's 500 m, that fills the valleys and leaves the ridges above it. Both scale heights
|
|
28
|
+
// and the mist's extinction are not from a source
|
|
29
|
+
const vec2 CLEAR_AIR = vec2(0.0001, 1200.0);
|
|
30
|
+
const vec2 MIST = vec2(0.0035, 400.0);
|
|
31
|
+
// the rain's extinction drifts in bands, by this share around its mean: sigma_rain *=
|
|
32
|
+
// mix(0.6, 1.4, noise) (Wronski 2014, "procedural Perlin noise animated by wind")
|
|
33
|
+
const float RAIN_BANDS = 0.4;
|
|
34
|
+
// visibility in meters at intensity 0 and 1 in the snow
|
|
35
|
+
const vec2 SNOW_VISIBILITY = vec2(20000.0, 500.0);
|
|
36
|
+
// the haze never quite hides the sky and the far terrain
|
|
37
|
+
const float MAX_HAZE = 0.9;
|
|
38
|
+
// the overcast sky at the horizon by day, a brighter gray under snow clouds; overhead, it is three
|
|
39
|
+
// times as bright, the CIE's overcast sky, L / L_zenith = (1 + 2 sin(elevation)) / 3 (CIE 2003),
|
|
40
|
+
// and darker under thick clouds, by up to this share: the report's 0.6 left the haze under the
|
|
41
|
+
// heaviest rain at a quarter of the brightness, darker than the scene it veils, which the overcast
|
|
42
|
+
// only dims by half
|
|
43
|
+
const vec3 RAIN_HAZE = vec3(0.6, 0.64, 0.68);
|
|
44
|
+
const vec3 SNOW_HAZE = vec3(0.7, 0.72, 0.76);
|
|
45
|
+
const float THICK_CLOUDS = 0.3;
|
|
46
|
+
// the asymmetry of the light scattered by the rain and by the snow, from the haze's 0.7 to the
|
|
47
|
+
// rain's 0.9 to 1 (arXiv 1403.2977)
|
|
48
|
+
const vec2 HAZE_ASYMMETRY = vec2(0.9, 0.75);
|
|
49
|
+
// the sky toward the horizon is a ray this long, out of the atmosphere
|
|
50
|
+
const float SKY_RAY = 1e7;
|
|
51
|
+
// the clear sky at the horizon is read this far above it, in radians, 5 degrees: right at it,
|
|
52
|
+
// Cesium's atmosphere turns a pale cyan that its sky, interpolated from the vertices of its dome,
|
|
53
|
+
// never shows
|
|
54
|
+
const float SKY_ELEVATION = 0.087;
|
|
55
|
+
// the sky table's texels toward the horizon, besides the one overhead, SkyTable.glsl's
|
|
56
|
+
const float SKY_TABLE = 64.0;
|
|
57
|
+
|
|
58
|
+
// the extinction per meter, from the rain's to the snow's, as hard as it rains: 3.912 / visibility
|
|
59
|
+
// is the extinction that leaves 2 % of the light. None where it does not rain, rising from 0 at the
|
|
60
|
+
// edge of the rain: the dry air is Cesium's fog's
|
|
61
|
+
float rainExtinction(float intensity, float snow) {
|
|
62
|
+
float rain = max(RAIN_LAW.x * pow(RAIN_RATE * intensity * intensity, RAIN_LAW.y), 1e-9);
|
|
63
|
+
float snowfall = 3.912 / (SNOW_VISIBILITY.x * pow(SNOW_VISIBILITY.y / SNOW_VISIBILITY.x, intensity));
|
|
64
|
+
return smoothstep(0.0, 0.15, intensity) * rain * pow(snowfall / rain, snow);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// the optical depth of a layer of haze along a straight ray this long from height h0 to h1, its
|
|
68
|
+
// height linear along it: the line integral of exponential height fog,
|
|
69
|
+
// (a / b) exp(-b h0) (1 - exp(-b dh)) / dh per unit of length (Quilez), with the first terms of its
|
|
70
|
+
// Taylor series where the ray is level, as Flax's ExponentialHeightFog.hlsl
|
|
71
|
+
float layerDepth(vec2 layer, float h0, float h1, float rayLength) {
|
|
72
|
+
float x = (h1 - h0) / layer.y;
|
|
73
|
+
float level = abs(x) < 1e-3 ? 1.0 - 0.5 * x : (1.0 - exp(-x)) / x;
|
|
74
|
+
return layer.x * rayLength * exp(-h0 / layer.y) * level;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// the haze's opacity over an optical depth in the rain
|
|
78
|
+
float rainHaze(float opticalDepth) {
|
|
79
|
+
return MAX_HAZE * (1.0 - exp(-opticalDepth));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// the clear sky in a direction in world coordinates from a point at a height, as the sky shader of Cesium's atmosphere
|
|
83
|
+
// renders it without high dynamic range, its inner radius lowered as SkyAtmosphereCommon.glsl
|
|
84
|
+
// lowers it: from the ellipsoid's surface, a ray toward the horizon would cross the densest air
|
|
85
|
+
// for hundreds of kilometers and turn a dim yellow
|
|
86
|
+
vec3 clearSkyFrom(vec3 originWC, float height, vec3 directionWC, vec3 lightWC) {
|
|
87
|
+
czm_ray ray = czm_ray(originWC, directionWC);
|
|
88
|
+
float radiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;
|
|
89
|
+
float adjust = 0.5 * radiiDifference * clamp((height - 0.25 * czm_ellipsoidRadii.x) / (0.75 * czm_ellipsoidRadii.x), 0.0, 1.0);
|
|
90
|
+
float innerRadius = length(originWC) - height - 0.25 * radiiDifference - adjust;
|
|
91
|
+
vec3 rayleigh;
|
|
92
|
+
vec3 mie;
|
|
93
|
+
float opacity;
|
|
94
|
+
czm_computeScattering(ray, SKY_RAY, lightWC, innerRadius, rayleigh, mie, opacity);
|
|
95
|
+
vec3 color = czm_computeAtmosphereColor(ray, lightWC, rayleigh, mie, opacity).rgb * skyLightIntensity / czm_atmosphereLightIntensity;
|
|
96
|
+
return czm_inverseGamma(czm_pbrNeutralTonemapping(color));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// the clear sky seen from the camera
|
|
100
|
+
vec3 clearSky(vec3 directionWC, vec3 lightWC) {
|
|
101
|
+
return clearSkyFrom(czm_viewerPositionWC, czm_eyeHeight, directionWC, lightWC);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// the clear sky seen from under the camera at a height, or from the camera if it is lower: from
|
|
105
|
+
// far above, the camera sees the black of space overhead, not the sky the clouds and the haze see,
|
|
106
|
+
// whose color divided by its luminance would turn to any hue
|
|
107
|
+
vec3 clearSkyBelow(float height, vec3 directionWC, vec3 lightWC) {
|
|
108
|
+
float h = min(czm_eyeHeight, height);
|
|
109
|
+
return clearSkyFrom(czm_viewerPositionWC - normalize(czm_viewerPositionWC) * (czm_eyeHeight - h), h, directionWC, lightWC);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// the clear sky toward a view direction in eye coordinates, at its azimuth and at an elevation
|
|
113
|
+
// above the horizon, in radians, lit by the scene's light, as the sky's atmosphere is lit by
|
|
114
|
+
// default: the scene's atmosphere is lit from overhead by default, and would turn the horizon cyan
|
|
115
|
+
// at any time of day
|
|
116
|
+
vec3 skyToward(vec3 view, float elevation) {
|
|
117
|
+
vec3 level = view - dot(view, up) * up;
|
|
118
|
+
level = dot(level, level) > 1e-6 ? normalize(level) : normalize(cross(up, vec3(1.0, 0.0, 0.0)));
|
|
119
|
+
return clearSky(czm_inverseViewRotation * (cos(elevation) * level + sin(elevation) * up), czm_lightDirectionWC);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// the clear sky toward a view direction in eye coordinates, from the sky table: at its azimuth from
|
|
123
|
+
// the sun's, SKY_ELEVATION above the horizon, toward overhead as it looks up
|
|
124
|
+
vec3 skyFromTable(vec3 view) {
|
|
125
|
+
vec3 level = view - dot(view, up) * up;
|
|
126
|
+
vec3 sun = czm_lightDirectionEC - dot(czm_lightDirectionEC, up) * up;
|
|
127
|
+
float cosAzimuth = dot(level, level) > 1e-6 && dot(sun, sun) > 1e-6 ? dot(normalize(level), normalize(sun)) : 1.0;
|
|
128
|
+
float u = (acos(clamp(cosAzimuth, -1.0, 1.0)) / czm_pi * (SKY_TABLE - 1.0) + 0.5) / (SKY_TABLE + 1.0);
|
|
129
|
+
vec3 horizon = texture(skyTable, vec2(u, 0.5)).rgb;
|
|
130
|
+
vec3 zenith = texture(skyTable, vec2((SKY_TABLE + 0.5) / (SKY_TABLE + 1.0), 0.5)).rgb;
|
|
131
|
+
return mix(horizon, zenith, max(dot(view, up), 0.0));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// the haze's light toward the eye along a view direction in eye coordinates, under an overcast as
|
|
135
|
+
// thick as it rains at the camera or along the ray, 0 to 1: the sky's, from the clear sky to the
|
|
136
|
+
// overcast gray, and the sun's through the clouds, as much of it as reaches the haze, 0 to 1.
|
|
137
|
+
// Drops scatter nearly all the light they intercept: an albedo of 1
|
|
138
|
+
vec3 rainHazeColor(vec3 view, float day, float snow, float overcast, float sunlit) {
|
|
139
|
+
float elevation = max(dot(view, up), 0.0);
|
|
140
|
+
vec3 sky = skyFromTable(view);
|
|
141
|
+
vec3 overcastSky = mix(RAIN_HAZE, SNOW_HAZE, snow) * (1.0 + 2.0 * elevation) * (1.0 - THICK_CLOUDS * overcast);
|
|
142
|
+
vec3 sun = czm_lightColor * sunlit * henyeyGreenstein(dot(view, czm_lightDirectionEC), mix(HAZE_ASYMMETRY.x, HAZE_ASYMMETRY.y, snow));
|
|
143
|
+
vec3 color = min(mix(sky, overcastSky, overcast) + sun, vec3(1.0));
|
|
144
|
+
return byDaylight(color, day);
|
|
145
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// 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
|
|
2
|
+
// 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
|
|
3
|
+
// 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
|
|
4
|
+
// size. Needs EyeFromDepth, Height, Hash and Normal.
|
|
5
|
+
precision highp sampler2D;
|
|
6
|
+
uniform sampler2D colorTexture;
|
|
7
|
+
uniform sampler2D depthTexture;
|
|
8
|
+
uniform mat4 localFromEye;
|
|
9
|
+
// 0 to 1: the share of the cells that have a drop
|
|
10
|
+
uniform float intensity;
|
|
11
|
+
// meters: a cell's size, and how far a ring on the ground grows
|
|
12
|
+
uniform float cell;
|
|
13
|
+
uniform float reach;
|
|
14
|
+
// meters above the ellipsoid, far above anything with no water
|
|
15
|
+
uniform float waterLevel;
|
|
16
|
+
// radians
|
|
17
|
+
uniform float maxSlope;
|
|
18
|
+
// rings a second
|
|
19
|
+
uniform float rate;
|
|
20
|
+
// seconds
|
|
21
|
+
uniform float time;
|
|
22
|
+
// the color of a ring, its alpha how strongly it shows
|
|
23
|
+
uniform vec4 color;
|
|
24
|
+
in vec2 v_textureCoordinates;
|
|
25
|
+
|
|
26
|
+
// a ring over water reaches this much farther, and runs this much slower
|
|
27
|
+
const float WATER_REACH = 1.7;
|
|
28
|
+
const float WATER_RATE = 0.5;
|
|
29
|
+
// meters from the water's level within which a surface is water, and beyond which it is not
|
|
30
|
+
const vec2 WET = vec2(0.1, 0.25);
|
|
31
|
+
// the drop lands in the middle of its cell, this far from its edge, in cells: a ring is clipped at the edge
|
|
32
|
+
const float MARGIN = 0.3;
|
|
33
|
+
// the narrowest line, in meters
|
|
34
|
+
const float LINE = 0.045;
|
|
35
|
+
// a pixel wider than the first, in meters, fades the rings out to none at the second: they would be a speckle
|
|
36
|
+
const vec2 SMALL = vec2(0.08, 0.2);
|
|
37
|
+
// half the width of the slope limit, in radians
|
|
38
|
+
const float SLOPE_EDGE = 0.1;
|
|
39
|
+
|
|
40
|
+
void main() {
|
|
41
|
+
vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
|
|
42
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
43
|
+
if (intensity <= 0.0 || eye.w == 0.0) {
|
|
44
|
+
out_FragColor = sceneColor;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
vec3 normal = smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz);
|
|
48
|
+
float slope = acos(clamp(dot(normal, up), -1.0, 1.0));
|
|
49
|
+
vec2 local = (localFromEye * vec4(eye.xyz, 1.0)).xy;
|
|
50
|
+
float wet = 1.0 - smoothstep(WET.x, WET.y, abs(heightAt(eye.xyz) - waterLevel));
|
|
51
|
+
|
|
52
|
+
vec2 id = floor(local / cell);
|
|
53
|
+
vec2 centre = (id + MARGIN + (1.0 - 2.0 * MARGIN) * vec2(hash(id + 3.1), hash(id + 7.7))) * cell;
|
|
54
|
+
float phase = fract(time * rate * mix(1.0, WATER_RATE, wet) + hash(id + 11.3));
|
|
55
|
+
// never past the cell's edge from the centre
|
|
56
|
+
float grown = min(reach * mix(1.0, WATER_REACH, wet), MARGIN * cell) * phase;
|
|
57
|
+
float distance = length(local - centre);
|
|
58
|
+
float width = max(LINE, 1.5 * fwidth(distance));
|
|
59
|
+
float ring = (1.0 - smoothstep(0.0, width, abs(distance - grown))) * (1.0 - phase);
|
|
60
|
+
ring *= float(hash(id) < intensity);
|
|
61
|
+
ring *= 1.0 - smoothstep(maxSlope - SLOPE_EDGE, maxSlope + SLOPE_EDGE, slope);
|
|
62
|
+
ring *= 1.0 - smoothstep(SMALL.x, SMALL.y, length(fwidth(local)));
|
|
63
|
+
out_FragColor = vec4(mix(sceneColor.rgb, color.rgb, ring * color.a), sceneColor.a);
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The clear sky the haze scatters, drawn by precipitation.js into a small table at each frame,
|
|
2
|
+
// rather than computed twice for each pixel: its first SKY_TABLE texels at SKY_ELEVATION above the
|
|
3
|
+
// horizon, at azimuths from the sun's to its opposite, the sky being symmetric about the sun's
|
|
4
|
+
// vertical plane, and its last overhead, seen from no higher than the cloud base. In world
|
|
5
|
+
// coordinates, the camera's up the ellipsoid's normal under it, so that the camera turning between
|
|
6
|
+
// frames does not skew it. Needs Height, Fog, Phase and RainHaze.
|
|
7
|
+
// meters above the ellipsoid, the precipitation's
|
|
8
|
+
uniform float cloudBase;
|
|
9
|
+
in vec2 v_textureCoordinates;
|
|
10
|
+
|
|
11
|
+
void main() {
|
|
12
|
+
vec3 upWC = normalize(czm_viewerPositionWC * czm_ellipsoidInverseRadii * czm_ellipsoidInverseRadii);
|
|
13
|
+
float i = floor(v_textureCoordinates.x * (SKY_TABLE + 1.0));
|
|
14
|
+
if (i >= SKY_TABLE) {
|
|
15
|
+
out_FragColor = vec4(clearSkyBelow(cloudBase, upWC, czm_lightDirectionWC), 1.0);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
vec3 sun = czm_lightDirectionWC - dot(czm_lightDirectionWC, upWC) * upWC;
|
|
19
|
+
sun = dot(sun, sun) > 1e-6 ? normalize(sun) : normalize(cross(upWC, vec3(1.0, 0.0, 0.0)));
|
|
20
|
+
float azimuth = czm_pi * i / (SKY_TABLE - 1.0);
|
|
21
|
+
vec3 level = cos(azimuth) * sun + sin(azimuth) * cross(upWC, sun);
|
|
22
|
+
out_FragColor = vec4(clearSkyBelow(cloudBase, cos(SKY_ELEVATION) * level + sin(SKY_ELEVATION) * upWC, czm_lightDirectionWC), 1.0);
|
|
23
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Snow above an altitude, on slopes gentle enough to hold it, shaded by the sun and by the
|
|
2
|
+
// brightness of the scene so that the relief stays readable. The slope comes from a normal
|
|
3
|
+
// rebuilt from the neighboring pixels and smoothed over the facets of the terrain. Noise anchored
|
|
4
|
+
// to the ground breaks up the edge of the snow, which lasts lower on the slopes away from the sun.
|
|
5
|
+
precision highp sampler2D;
|
|
6
|
+
uniform sampler2D colorTexture;
|
|
7
|
+
uniform sampler2D depthTexture;
|
|
8
|
+
// meters above the ellipsoid: half covered at the altitude, over a band transition meters high
|
|
9
|
+
uniform float altitude;
|
|
10
|
+
uniform float transition;
|
|
11
|
+
// radians
|
|
12
|
+
uniform float maxSlope;
|
|
13
|
+
// 0 to 1
|
|
14
|
+
uniform float coverage;
|
|
15
|
+
// 0 to 1: how far the coverage thins the snow into patches, where 0 fades it
|
|
16
|
+
uniform float patchiness;
|
|
17
|
+
// meters: the noise's largest scale, its finer ones a third and a ninth of it
|
|
18
|
+
uniform float grain;
|
|
19
|
+
// 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
|
|
20
|
+
uniform float sceneLight;
|
|
21
|
+
// 0 to 1: the part of the snow that still covers the steep slopes at the limit, as a fraction of the coverage
|
|
22
|
+
uniform float steepCover;
|
|
23
|
+
// the local frame's coordinates from the eye's, made in double precision on the CPU (local-frame.js): the noise's place
|
|
24
|
+
uniform mat4 localFromEye;
|
|
25
|
+
// meters above the ellipsoid, far above anything with no water: none lies within a quarter meter of it
|
|
26
|
+
uniform float waterLevel;
|
|
27
|
+
// the sun toward which the snow is shaded, in eye coordinates, when ownSun is 1; else Cesium's
|
|
28
|
+
uniform vec3 sunEC;
|
|
29
|
+
uniform float ownSun;
|
|
30
|
+
in vec2 v_textureCoordinates;
|
|
31
|
+
|
|
32
|
+
const vec3 SNOW_SHADE = vec3(0.80, 0.87, 1.0);
|
|
33
|
+
const vec3 SNOW_SUN = vec3(1.0, 0.98, 0.94);
|
|
34
|
+
// meters the snow line moves down on a slope facing away from the sun, and up on one facing it
|
|
35
|
+
const float ASPECT_SHIFT = 0.6;
|
|
36
|
+
// meters the noise moves the snow line, as a fraction of the transition
|
|
37
|
+
const float NOISE_SHIFT = 0.8;
|
|
38
|
+
// half width of the slope limit, in radians (8 degrees), so that the snow thins out across the
|
|
39
|
+
// facets of the terrain rather than stopping at their edges
|
|
40
|
+
const float SLOPE_EDGE = 0.14;
|
|
41
|
+
// the coverage, moved by the noise, from which the snow begins and is whole when it is patches; how far the noise moves it
|
|
42
|
+
const vec2 PATCH = vec2(0.25, 0.6);
|
|
43
|
+
const float PATCH_NOISE = 1.6;
|
|
44
|
+
// meters from the water's level within which a surface is water, and beyond which it is not
|
|
45
|
+
const vec2 WET = vec2(0.1, 0.25);
|
|
46
|
+
|
|
47
|
+
float hash(vec3 p) {
|
|
48
|
+
p = fract(p * 0.3183099 + 0.1);
|
|
49
|
+
p *= 17.0;
|
|
50
|
+
return fract(p.x * p.y * p.z * (p.x + p.y + p.z));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
float valueNoise(vec3 p) {
|
|
54
|
+
vec3 i = floor(p);
|
|
55
|
+
vec3 f = fract(p);
|
|
56
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
57
|
+
return mix(
|
|
58
|
+
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),
|
|
59
|
+
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),
|
|
60
|
+
f.z);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 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
|
|
64
|
+
float groundNoise(vec3 local) {
|
|
65
|
+
return 0.55 * valueNoise(local / grain) + 0.3 * valueNoise(3.0 * local / grain) + 0.15 * valueNoise(9.0 * local / grain);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void main() {
|
|
69
|
+
vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
|
|
70
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
71
|
+
vec3 normal = smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz);
|
|
72
|
+
float slope = acos(clamp(dot(normal, up), -1.0, 1.0));
|
|
73
|
+
|
|
74
|
+
float sun = max(dot(normal, ownSun > 0.5 ? sunEC : czm_sunDirectionEC), 0.0);
|
|
75
|
+
float noise = groundNoise((localFromEye * vec4(eye.xyz, 1.0)).xyz) - 0.5;
|
|
76
|
+
// lower on the slopes away from the sun, irregular along the edge
|
|
77
|
+
float shift = transition * (NOISE_SHIFT * noise + ASPECT_SHIFT * (0.5 - sun));
|
|
78
|
+
float snowLine = altitude + shift;
|
|
79
|
+
float snow = smoothstep(snowLine - 0.5 * transition, snowLine + 0.5 * transition, heightAt(eye.xyz));
|
|
80
|
+
// opaque before the top of the band, so that the imagery does not show through the snow
|
|
81
|
+
snow = smoothstep(0.0, 0.7, snow);
|
|
82
|
+
// the steep slopes keep a thin, patchy cover, and the rock shows through
|
|
83
|
+
float steep = smoothstep(maxSlope - SLOPE_EDGE, maxSlope + SLOPE_EDGE, slope);
|
|
84
|
+
snow *= 1.0 - steep * (1.0 - steepCover * smoothstep(0.35, 0.65, noise + 0.5));
|
|
85
|
+
// the coverage an opacity, or, by the patchiness, the share of the ground the snow covers, the noise leaving it in patches
|
|
86
|
+
float scattered = smoothstep(PATCH.x, PATCH.y, coverage + PATCH_NOISE * noise);
|
|
87
|
+
// eye.w is 0 for the sky
|
|
88
|
+
snow *= mix(coverage, scattered, patchiness) * eye.w;
|
|
89
|
+
snow *= smoothstep(WET.x, WET.y, abs(heightAt(eye.xyz) - waterLevel));
|
|
90
|
+
float brightness = czm_luminance(sceneColor.rgb);
|
|
91
|
+
// 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
|
|
92
|
+
// dusk kept on the snow
|
|
93
|
+
float shaded = clamp(0.68 + 0.25 * sun + 0.1 * brightness, 0.0, 1.0);
|
|
94
|
+
float scene = clamp(0.15 + 1.35 * brightness, 0.0, 1.0);
|
|
95
|
+
vec3 lit = mix(SNOW_SHADE, SNOW_SUN, sun) * mix(shaded, scene, sceneLight);
|
|
96
|
+
out_FragColor = vec4(mix(sceneColor.rgb, lit, snow), sceneColor.a);
|
|
97
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Speed lines: the picture zooms toward the focus, more toward the edges of the screen, and thin
|
|
2
|
+
// streaks radiate from it, a new pattern many times a second, as in comics.
|
|
3
|
+
precision highp sampler2D;
|
|
4
|
+
uniform sampler2D colorTexture;
|
|
5
|
+
// in eye coordinates; w is 0 for the middle of the screen
|
|
6
|
+
uniform vec4 focus;
|
|
7
|
+
// 0 to 1
|
|
8
|
+
uniform float strength;
|
|
9
|
+
// seconds
|
|
10
|
+
uniform float time;
|
|
11
|
+
in vec2 v_textureCoordinates;
|
|
12
|
+
|
|
13
|
+
const int BLUR_STEPS = 8;
|
|
14
|
+
// length of the zoom blur at full strength, as a fraction of the distance to the focus
|
|
15
|
+
const float BLUR = 0.12;
|
|
16
|
+
// streaks around the focus, and their changes per second
|
|
17
|
+
const float STREAK_COUNT = 360.0;
|
|
18
|
+
const float STREAK_RATE = 24.0;
|
|
19
|
+
const float STREAK_OPACITY = 0.2;
|
|
20
|
+
|
|
21
|
+
// the streaks draw their randomness from hash: with a sin, they disappeared for half of each
|
|
22
|
+
// cycle of frames
|
|
23
|
+
void main() {
|
|
24
|
+
vec2 uv = v_textureCoordinates;
|
|
25
|
+
vec4 clip = czm_projection * vec4(focus.xyz, 1.0);
|
|
26
|
+
// on the screen, in front of the camera
|
|
27
|
+
vec2 center = focus.w > 0.0 && focus.z < 0.0 ? 0.5 * clip.xy / clip.w + 0.5 : vec2(0.5);
|
|
28
|
+
vec2 toCenter = center - uv;
|
|
29
|
+
// distance to the focus, 1 at the half height of the screen
|
|
30
|
+
vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);
|
|
31
|
+
float fromCenter = 2.0 * length(toCenter * aspect);
|
|
32
|
+
float edge = smoothstep(0.2, 1.0, fromCenter);
|
|
33
|
+
|
|
34
|
+
vec4 sceneColor = texture(colorTexture, uv);
|
|
35
|
+
vec3 color = sceneColor.rgb;
|
|
36
|
+
// zoom blur, from a start that varies with the pixel so that the steps blur into noise; none
|
|
37
|
+
// where it would be shorter than a pixel, around the focus
|
|
38
|
+
float blur = strength * BLUR * edge;
|
|
39
|
+
if (blur * length(toCenter * czm_viewport.zw) > 0.5) {
|
|
40
|
+
float jitter = pixelNoise(gl_FragCoord.xy);
|
|
41
|
+
color = vec3(0.0);
|
|
42
|
+
for (int i = 0; i < BLUR_STEPS; i++) {
|
|
43
|
+
color += texture(colorTexture, uv + toCenter * blur * (float(i) + jitter) / float(BLUR_STEPS)).rgb;
|
|
44
|
+
}
|
|
45
|
+
color /= float(BLUR_STEPS);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// streaks: noise around the focus, constant along each ray from it, only toward the edges
|
|
49
|
+
float streaks = STREAK_OPACITY * strength * smoothstep(0.5, 1.2, fromCenter);
|
|
50
|
+
if (streaks > 0.0) {
|
|
51
|
+
vec2 direction = toCenter * aspect;
|
|
52
|
+
float frame = mod(floor(time * STREAK_RATE), 1000.0);
|
|
53
|
+
// value noise over the angle, in whole cells so that it closes around the focus
|
|
54
|
+
float around = (atan(direction.y, direction.x) / czm_twoPi + 0.5) * STREAK_COUNT;
|
|
55
|
+
float cell = floor(around);
|
|
56
|
+
float t = fract(around);
|
|
57
|
+
float noise = mix(hash(vec2(cell, frame)), hash(vec2(mod(cell + 1.0, STREAK_COUNT), frame)), t * t * (3.0 - 2.0 * t));
|
|
58
|
+
color = mix(color, vec3(1.0), streaks * smoothstep(0.72, 0.9, noise));
|
|
59
|
+
}
|
|
60
|
+
out_FragColor = vec4(color, sceneColor.a);
|
|
61
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// A searchlight above the focus, pointing down: it throws a pool of warm light radius meters
|
|
2
|
+
// wide on flat ground, with a soft penumbra, shades the relief under it and lights up the haze
|
|
3
|
+
// in its beam, from SpotlightBeam.glsl; the rest of the scene darkens and loses its color. The
|
|
4
|
+
// cone and the falloff follow three.js's SpotLight. Needs EyeFromDepth, Normal, Filmic and
|
|
5
|
+
// SpotlightCone.
|
|
6
|
+
precision highp sampler2D;
|
|
7
|
+
uniform sampler2D colorTexture;
|
|
8
|
+
// the beam's haze and the log2 of the scene distance, at a fraction of the resolution
|
|
9
|
+
uniform sampler2D beamTexture;
|
|
10
|
+
// 0 to 1
|
|
11
|
+
uniform float darkness;
|
|
12
|
+
// brightness of the beam in the air, 0 to 1
|
|
13
|
+
uniform float beam;
|
|
14
|
+
// brightness of the light, 1 for the searchlight: the pool and the beam scale with it
|
|
15
|
+
uniform float power;
|
|
16
|
+
in vec2 v_textureCoordinates;
|
|
17
|
+
|
|
18
|
+
const vec3 LIGHT_COLOR = vec3(1.0, 0.93, 0.8);
|
|
19
|
+
const float INTENSITY = 1.4;
|
|
20
|
+
// difference of the log2 of the distances, about 10 %, under which the beam's texels around a
|
|
21
|
+
// pixel are interpolated
|
|
22
|
+
const float SOFT_DEPTH = 0.14;
|
|
23
|
+
|
|
24
|
+
// light reaching a point fromLight away from the light: the cone around the axis with its
|
|
25
|
+
// penumbra, and the inverse square, 1 at the focus, capped for what is close to the light
|
|
26
|
+
float spotAt(vec3 fromLight, vec3 axis, float height, float coneCos, float penumbraCos) {
|
|
27
|
+
float lightDistance = length(fromLight);
|
|
28
|
+
float spot = smoothstep(coneCos, penumbraCos, dot(fromLight, -axis) / lightDistance);
|
|
29
|
+
return spot * min(height * height / (lightDistance * lightDistance), 4.0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// the beam's haze at the pixel, from the four texels of its lower resolution around it:
|
|
33
|
+
// interpolated where they are all at the pixel's distance, else the one nearest to it, so that the
|
|
34
|
+
// haze stops at the ridges in front of it rather than spilling onto them
|
|
35
|
+
float beamAt(vec2 uv, float depth) {
|
|
36
|
+
ivec2 size = textureSize(beamTexture, 0);
|
|
37
|
+
vec2 position = uv * vec2(size) - 0.5;
|
|
38
|
+
ivec2 base = ivec2(floor(position));
|
|
39
|
+
vec2 f = fract(position);
|
|
40
|
+
float interpolated = 0.0;
|
|
41
|
+
float nearest = 0.0;
|
|
42
|
+
float nearestGap = 1e38;
|
|
43
|
+
float widestGap = 0.0;
|
|
44
|
+
for (int i = 0; i < 4; i++) {
|
|
45
|
+
ivec2 offset = ivec2(i & 1, i >> 1);
|
|
46
|
+
vec2 texel = texelFetch(beamTexture, clamp(base + offset, ivec2(0), size - 1), 0).rg;
|
|
47
|
+
float gap = abs(texel.g - depth);
|
|
48
|
+
vec2 weights = mix(1.0 - f, f, vec2(offset));
|
|
49
|
+
interpolated += weights.x * weights.y * texel.r;
|
|
50
|
+
if (gap < nearestGap) {
|
|
51
|
+
nearestGap = gap;
|
|
52
|
+
nearest = texel.r;
|
|
53
|
+
}
|
|
54
|
+
widestGap = max(widestGap, gap);
|
|
55
|
+
}
|
|
56
|
+
return widestGap < SOFT_DEPTH ? interpolated : nearest;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void main() {
|
|
60
|
+
vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
|
|
61
|
+
Cone spot;
|
|
62
|
+
if (!spotlightCone(spot)) {
|
|
63
|
+
out_FragColor = sceneColor;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
vec3 color = sceneColor.rgb;
|
|
67
|
+
vec3 ambient = czm_saturation(color, 1.0 - darkness) * (1.0 - darkness);
|
|
68
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
69
|
+
|
|
70
|
+
// eye.w is 0 for the sky, where the view ray goes on
|
|
71
|
+
float sceneDistance = eye.w == 0.0 ? 1e30 : length(eye.xyz);
|
|
72
|
+
float scattered = beam > 0.0 ? beamAt(v_textureCoordinates, log2(sceneDistance)) : 0.0;
|
|
73
|
+
vec3 haze = LIGHT_COLOR * (power * beam * scattered);
|
|
74
|
+
if (eye.w == 0.0) {
|
|
75
|
+
out_FragColor = vec4(filmic(ambient + haze), sceneColor.a);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
vec3 toLight = spot.light - eye.xyz;
|
|
80
|
+
// the normal over wider steps where the surface is seen at a grazing angle, where the facets
|
|
81
|
+
// of the terrain mesh would show as blotches; over fine ones elsewhere, for the relief
|
|
82
|
+
vec3 coarse = normalize(normalAt(depthTexture, v_textureCoordinates, eye.xyz, 6.0 * czm_pixelRatio)
|
|
83
|
+
+ normalAt(depthTexture, v_textureCoordinates, eye.xyz, 18.0 * czm_pixelRatio));
|
|
84
|
+
float grazing = smoothstep(0.7, 0.95, 1.0 - abs(dot(coarse, normalize(-eye.xyz))));
|
|
85
|
+
vec3 normal = normalize(mix(smoothNormalAt(depthTexture, v_textureCoordinates, eye.xyz), coarse, grazing));
|
|
86
|
+
float lambert = max(dot(normal, normalize(toLight)), 0.0);
|
|
87
|
+
vec3 light = LIGHT_COLOR * (power * INTENSITY * spotAt(-toLight, up, spot.height, spot.coneCos, spot.penumbraCos) * lambert);
|
|
88
|
+
out_FragColor = vec4(filmic(ambient + color * light + haze), sceneColor.a);
|
|
89
|
+
}
|