@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,132 @@
|
|
|
1
|
+
// An analog FPV video feed, as in the recordings of FPV pilots' goggles: a soft PAL picture,
|
|
2
|
+
// washed out, its color bleeding sideways (the signal carries the brightness at a higher
|
|
3
|
+
// resolution than the color, yet smeared a little), with ringing beside sharp edges and lines
|
|
4
|
+
// that jitter sideways. As the signal weakens (low over the ground, behind obstacles), the
|
|
5
|
+
// color goes first, the picture washes out toward a cold white and fills with colored streaks:
|
|
6
|
+
// short dashes along the video lines, the clicks of FM video below its threshold. Now and then
|
|
7
|
+
// the receiver loses the sync for a frame or two: the picture tears, a white band and black
|
|
8
|
+
// below it. Without a signal, the receiver shows its own noise: a dark field of colored
|
|
9
|
+
// streaks, the picture and its display gone. After ntsc-rs's chroma lowpass and delay, luma
|
|
10
|
+
// smear and ringing, and the recordings of FPV drones flying low and crashing.
|
|
11
|
+
precision highp sampler2D;
|
|
12
|
+
uniform sampler2D colorTexture;
|
|
13
|
+
// seconds
|
|
14
|
+
uniform float time;
|
|
15
|
+
// 0 to 1
|
|
16
|
+
uniform float noise;
|
|
17
|
+
// per frame: how weak the signal is now, 0 to 1, 1 without a signal; where the picture tears,
|
|
18
|
+
// as a fraction of its height from the top, or -1
|
|
19
|
+
uniform float weak;
|
|
20
|
+
uniform float tear;
|
|
21
|
+
in vec2 v_textureCoordinates;
|
|
22
|
+
|
|
23
|
+
// PAL video runs at 25 frames per second, in 576 lines of about 720 samples
|
|
24
|
+
const float FRAME_RATE = 25.0;
|
|
25
|
+
const vec2 VIDEO = vec2(720.0, 576.0);
|
|
26
|
+
// in video samples: the color spread on either side, and shifted to the right; the overshoot
|
|
27
|
+
// beside edges; the brightness trailing to the right, as through a lowpass filter
|
|
28
|
+
const float BLEED = 3.0;
|
|
29
|
+
const float BLEED_SHIFT = 1.0;
|
|
30
|
+
const float RING_DISTANCE = 1.5;
|
|
31
|
+
const float RING = 0.5;
|
|
32
|
+
const float SMEAR = 1.0;
|
|
33
|
+
// the white band of a tear, as a fraction of the picture height
|
|
34
|
+
const float TEAR_BAND = 0.07;
|
|
35
|
+
|
|
36
|
+
// BT.601 luma and color differences
|
|
37
|
+
vec3 toYuv(vec3 rgb) {
|
|
38
|
+
float y = dot(rgb, vec3(0.299, 0.587, 0.114));
|
|
39
|
+
return vec3(y, 0.492 * (rgb.b - y), 0.877 * (rgb.r - y));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
vec3 toRgb(vec3 yuv) {
|
|
43
|
+
float b = yuv.x + yuv.y / 0.492;
|
|
44
|
+
float r = yuv.x + yuv.z / 0.877;
|
|
45
|
+
return vec3(r, (yuv.x - 0.299 * r - 0.114 * b) / 0.587, b);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
float luma(vec2 uv) {
|
|
49
|
+
return toYuv(texture(colorTexture, uv).rgb).x;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// the streaks of one layer on a video line: at most one starts in each cell of the line, and runs
|
|
53
|
+
// for up to maxSpan samples, shorter than a cell so that only the previous cell reaches this one;
|
|
54
|
+
// with this chance per cell; its color, and its coverage in alpha
|
|
55
|
+
vec4 streaks(float x, float line, float frame, float cell, float maxSpan, float chance, float seed) {
|
|
56
|
+
float index = floor(x / cell);
|
|
57
|
+
vec4 streak = vec4(0.0);
|
|
58
|
+
for (int i = 0; i < 2; i++) {
|
|
59
|
+
// a new pattern each frame, offset by more cells than a line holds so that frames do not repeat
|
|
60
|
+
vec2 id = vec2(index - float(i) + frame * 61.0 + seed, line);
|
|
61
|
+
float start = (index - float(i) + hash(id + 0.5)) * cell;
|
|
62
|
+
float span = 2.0 + (maxSpan - 2.0) * hash(id + 1.5) * hash(id + 1.5);
|
|
63
|
+
float along = (x - start) / span;
|
|
64
|
+
float on = step(hash(id), chance) * step(0.0, along) * step(along, 1.0);
|
|
65
|
+
float shape = on * smoothstep(0.0, 0.15, along) * (1.0 - smoothstep(0.7, 1.0, along));
|
|
66
|
+
if (shape > streak.a) {
|
|
67
|
+
// bright, whitish or colored: magenta, green, blue, yellow
|
|
68
|
+
float angle = 6.2832 * hash(id + 3.5);
|
|
69
|
+
vec3 yuv = vec3(0.55 + 0.45 * hash(id + 2.5), 0.22 * hash(id + 4.5) * vec2(cos(angle), sin(angle)));
|
|
70
|
+
streak = vec4(toRgb(yuv), shape);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return streak;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void main() {
|
|
77
|
+
float frame = mod(floor(time * FRAME_RATE), 1000.0);
|
|
78
|
+
// the video line, counted from the top, and the sample along it
|
|
79
|
+
float fromTop = 1.0 - v_textureCoordinates.y;
|
|
80
|
+
float line = floor(fromTop * VIDEO.y);
|
|
81
|
+
// the lines jitter sideways, more as the signal weakens
|
|
82
|
+
float shake = (hash(vec2(line, frame)) - 0.5) * (0.4 + 2.0 * weak);
|
|
83
|
+
vec2 uv = vec2(v_textureCoordinates.x + shake / VIDEO.x, 1.0 - (line + 0.5) / VIDEO.y);
|
|
84
|
+
float x = uv.x * VIDEO.x;
|
|
85
|
+
|
|
86
|
+
// the brightness smeared to the right, with ringing beside the edges; the color averaged sideways
|
|
87
|
+
// and shifted
|
|
88
|
+
vec4 sceneColor = texture(colorTexture, uv);
|
|
89
|
+
vec3 yuv = toYuv(sceneColor.rgb);
|
|
90
|
+
float texel = 1.0 / VIDEO.x;
|
|
91
|
+
yuv.x = 0.5 * yuv.x + 0.3 * luma(uv - vec2(0.5 * SMEAR * texel, 0.0)) + 0.2 * luma(uv - vec2(SMEAR * texel, 0.0));
|
|
92
|
+
float left = luma(uv - vec2(RING_DISTANCE * texel, 0.0));
|
|
93
|
+
float right = luma(uv + vec2(RING_DISTANCE * texel, 0.0));
|
|
94
|
+
yuv.x += RING * (yuv.x - 0.5 * (left + right));
|
|
95
|
+
vec2 color = vec2(0.0);
|
|
96
|
+
for (int i = -2; i <= 2; i++) {
|
|
97
|
+
float offset = (BLEED_SHIFT + BLEED * float(i) / 2.0) * texel;
|
|
98
|
+
color += toYuv(texture(colorTexture, uv - vec2(offset, 0.0)).rgb).yz;
|
|
99
|
+
}
|
|
100
|
+
yuv.yz = color / 5.0;
|
|
101
|
+
|
|
102
|
+
// washed out: less color and contrast, lifted blacks; as the signal weakens, the color lost and
|
|
103
|
+
// the picture washed out toward a cold white
|
|
104
|
+
float wash = smoothstep(0.4, 0.85, weak);
|
|
105
|
+
yuv.yz *= 0.75 * (1.0 - smoothstep(0.35, 0.6, weak));
|
|
106
|
+
yuv.x = 0.06 + 0.86 * yuv.x;
|
|
107
|
+
yuv.x = mix(yuv.x, 0.55 + 0.45 * yuv.x, 0.6 * wash);
|
|
108
|
+
yuv.yz += vec2(0.04, -0.02) * wash;
|
|
109
|
+
vec3 rgb = toRgb(yuv);
|
|
110
|
+
|
|
111
|
+
// grain, one value per video sample and a new pattern each frame, heavier in the dark
|
|
112
|
+
float grain = hash(vec2(floor(x), line) + vec2(frame * 37.0, frame * 17.0)) - 0.5;
|
|
113
|
+
rgb += grain * noise * 0.2 * (1.0 - 0.6 * yuv.x);
|
|
114
|
+
|
|
115
|
+
// the sync lost: below the tear, a white band, then black
|
|
116
|
+
if (tear >= 0.0) {
|
|
117
|
+
float below = step(tear, fromTop);
|
|
118
|
+
rgb = mix(rgb, vec3(0.02 + 0.05 * grain), below);
|
|
119
|
+
rgb = mix(rgb, vec3(0.92), below * (1.0 - smoothstep(0.0, TEAR_BAND, fromTop - tear)));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// no signal: the receiver's dark noise instead of the picture
|
|
123
|
+
rgb = mix(rgb, vec3(0.08 + 0.12 * grain), smoothstep(0.92, 1.0, weak));
|
|
124
|
+
|
|
125
|
+
// the streaks, rare in a good signal, everywhere without one: long ones, and short ones as the
|
|
126
|
+
// signal fails
|
|
127
|
+
vec4 longStreak = streaks(x, line, frame, 24.0, 18.0, 0.35 * weak * weak * weak, 0.0);
|
|
128
|
+
vec4 shortStreak = streaks(x, line, frame, 8.0, 6.0, 0.6 * smoothstep(0.5, 1.0, weak), 500.0);
|
|
129
|
+
vec4 streak = longStreak.a > shortStreak.a ? longStreak : shortStreak;
|
|
130
|
+
rgb = mix(rgb, streak.rgb, 0.85 * streak.a);
|
|
131
|
+
out_FragColor = vec4(clamp(rgb, 0.0, 1.0), sceneColor.a);
|
|
132
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// The beam of a cone of light in the haze, for the spotlight and for lights of your own:
|
|
2
|
+
// raymarched along the part of the view ray inside the cone, found analytically, so that no
|
|
3
|
+
// sample is wasted and pixels next to each other see the same stretch of it. Needs Hash, and
|
|
4
|
+
// Noise for the dust.
|
|
5
|
+
|
|
6
|
+
struct Beam {
|
|
7
|
+
// the cone: its apex and the direction it points, in eye coordinates
|
|
8
|
+
vec3 apex;
|
|
9
|
+
vec3 forward;
|
|
10
|
+
// cosines of its half angle, and of the angle within which its core is hot
|
|
11
|
+
float edgeCos;
|
|
12
|
+
float coreCos;
|
|
13
|
+
// brightness of the core over the rest of the cone, 0 for a plain penumbra
|
|
14
|
+
float hotCore;
|
|
15
|
+
// the light's position, from which the haze's brightness falls off as reference^2 over
|
|
16
|
+
// (core^2 + distance^2): 1 at the reference distance for a small core, softened within it
|
|
17
|
+
vec3 light;
|
|
18
|
+
float reference;
|
|
19
|
+
float core;
|
|
20
|
+
// how far along the view ray the haze is lit, meters, and its extinction on the way, per meter
|
|
21
|
+
float reach;
|
|
22
|
+
float extinction;
|
|
23
|
+
// Henyey-Greenstein asymmetry, 0 to 1: forward scattering
|
|
24
|
+
float anisotropy;
|
|
25
|
+
// exponent of the spacing of the samples along the ray: 1 for even, 2 for dense at the start
|
|
26
|
+
float spacing;
|
|
27
|
+
// the lit haze fades in over this stretch of the view ray, meters; none when empty
|
|
28
|
+
vec2 nearFade;
|
|
29
|
+
// dust catching the light: noise across the beam, constant along each line from the light so
|
|
30
|
+
// that it streaks, in world coordinates so that it stays when the camera turns; its contrast
|
|
31
|
+
// and its density across the width of the beam
|
|
32
|
+
float dust;
|
|
33
|
+
float dustScale;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const int BEAM_SAMPLES = 8;
|
|
37
|
+
|
|
38
|
+
// the part of the view ray, from the camera at the origin, inside the cone: entry and exit
|
|
39
|
+
// distances, exit before entry when the ray misses it
|
|
40
|
+
vec2 coneSegment(vec3 ray, vec3 apex, vec3 forward, float edgeCos) {
|
|
41
|
+
// points t * ray in the cone: dot(p, forward)^2 >= edgeCos^2 dot(p, p), with p from the apex
|
|
42
|
+
vec3 v = -apex;
|
|
43
|
+
float k2 = edgeCos * edgeCos;
|
|
44
|
+
float rd = dot(ray, forward);
|
|
45
|
+
float vd = dot(v, forward);
|
|
46
|
+
float a = rd * rd - k2;
|
|
47
|
+
// a ray along the surface of the cone would divide by zero
|
|
48
|
+
a = abs(a) < 1e-7 ? -1e-7 : a;
|
|
49
|
+
float b = rd * vd - k2 * dot(ray, v);
|
|
50
|
+
float c = vd * vd - k2 * dot(v, v);
|
|
51
|
+
float discriminant = b * b - a * c;
|
|
52
|
+
if (discriminant < 0.0) {
|
|
53
|
+
return vec2(1.0, 0.0);
|
|
54
|
+
}
|
|
55
|
+
float root = sqrt(discriminant);
|
|
56
|
+
float t1 = (-b - root) / a;
|
|
57
|
+
float t2 = (-b + root) / a;
|
|
58
|
+
vec2 segment = a < 0.0 ? vec2(min(t1, t2), max(t1, t2))
|
|
59
|
+
// a ray steeper than the cone stays in it on one side, of the lit nappe or the other one
|
|
60
|
+
: rd > 0.0 ? vec2(max(t1, t2), 1e30) : vec2(-1e30, min(t1, t2));
|
|
61
|
+
// ahead of the apex, not in the mirrored cone behind it
|
|
62
|
+
return vd + 0.5 * (segment.x + segment.y) * rd > 0.0 ? segment : vec2(1.0, 0.0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Henyey-Greenstein phase, normalized over the sphere
|
|
66
|
+
float henyeyGreenstein(float cosTheta, float g) {
|
|
67
|
+
float g2 = g * g;
|
|
68
|
+
return (1.0 - g2) / (4.0 * czm_pi * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// the haze lit by the beam along the view ray up to sceneDistance: samples over the part of the
|
|
72
|
+
// ray inside the cone, each weighted by the softness of the cone with its core, the dust, the
|
|
73
|
+
// falloff from the light and what the haze has dimmed so far, dithered per pixel so that they do
|
|
74
|
+
// not band, then scattered toward the camera
|
|
75
|
+
float beamAlong(vec3 ray, float sceneDistance, Beam beam) {
|
|
76
|
+
vec2 segment = coneSegment(ray, beam.apex, beam.forward, beam.edgeCos);
|
|
77
|
+
float start = max(segment.x, 0.0);
|
|
78
|
+
float end = min(min(segment.y, sceneDistance), beam.reach);
|
|
79
|
+
if (end <= start) {
|
|
80
|
+
return 0.0;
|
|
81
|
+
}
|
|
82
|
+
float length_ = end - start;
|
|
83
|
+
float jitter = pixelNoise(gl_FragCoord.xy);
|
|
84
|
+
float scattered = 0.0;
|
|
85
|
+
float transmittance = exp(-beam.extinction * start);
|
|
86
|
+
for (int i = 0; i < BEAM_SAMPLES; i++) {
|
|
87
|
+
float u = (float(i) + jitter) / float(BEAM_SAMPLES);
|
|
88
|
+
float t = start + length_ * pow(u, beam.spacing);
|
|
89
|
+
// pow(0, 0) is undefined, a NaN on some GPUs, where the jitter is 0
|
|
90
|
+
float step = length_ * beam.spacing * pow(max(u, 1e-6), beam.spacing - 1.0) / float(BEAM_SAMPLES);
|
|
91
|
+
vec3 p = ray * t;
|
|
92
|
+
vec3 fromApex = p - beam.apex;
|
|
93
|
+
float cosine = dot(fromApex, beam.forward) / length(fromApex);
|
|
94
|
+
float cone = smoothstep(beam.edgeCos, beam.coreCos, cosine) + beam.hotCore * smoothstep(beam.coreCos, 1.0, cosine);
|
|
95
|
+
vec3 fromLight = p - beam.light;
|
|
96
|
+
if (beam.dust > 0.0) {
|
|
97
|
+
float along = max(dot(fromLight, beam.forward), 1e-3);
|
|
98
|
+
vec3 section = czm_inverseViewRotation * ((fromLight - along * beam.forward) * 2.0 / along);
|
|
99
|
+
float noise = gradientNoise(beam.dustScale * section) + 0.25 * gradientNoise(2.0 * beam.dustScale * section);
|
|
100
|
+
cone *= 1.0 + beam.dust * noise;
|
|
101
|
+
}
|
|
102
|
+
float falloff = beam.reference * beam.reference / (beam.core * beam.core + dot(fromLight, fromLight));
|
|
103
|
+
float fade = beam.nearFade.y > beam.nearFade.x ? smoothstep(beam.nearFade.x, beam.nearFade.y, t) : 1.0;
|
|
104
|
+
scattered += transmittance * cone * falloff * fade * step;
|
|
105
|
+
transmittance *= exp(-beam.extinction * step);
|
|
106
|
+
}
|
|
107
|
+
return scattered * henyeyGreenstein(dot(ray, beam.forward), beam.anisotropy);
|
|
108
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// The clouds blurred over the neighboring texels at the march's resolution, as the precipitation's
|
|
2
|
+
// shafts are: an edge thinner than a texel would otherwise come out of the upscale as a square. A
|
|
3
|
+
// 3 x 3 binomial kernel here costs a 16th of the reads the same blur would take at the full
|
|
4
|
+
// resolution. Only the neighbors at about the texel's depth count, so a cloud over the sky does not
|
|
5
|
+
// bleed onto a ridge in front of it.
|
|
6
|
+
precision highp sampler2D;
|
|
7
|
+
uniform sampler2D cloudTexture;
|
|
8
|
+
// the farthest distance of the scene in each texel's block of pixels, from CloudsDepth.glsl
|
|
9
|
+
uniform sampler2D cloudDepth;
|
|
10
|
+
in vec2 v_textureCoordinates;
|
|
11
|
+
|
|
12
|
+
// texels are at the same depth within this share of it, CloudsComposite.glsl's
|
|
13
|
+
const float DEPTH_TOLERANCE = 0.1;
|
|
14
|
+
|
|
15
|
+
void main() {
|
|
16
|
+
// czm_viewport is this pass's texture, the size of the march's
|
|
17
|
+
vec2 texel = 1.0 / czm_viewport.zw;
|
|
18
|
+
float here = texture(cloudDepth, v_textureCoordinates).r;
|
|
19
|
+
vec4 sum = vec4(0.0);
|
|
20
|
+
float weights = 0.0;
|
|
21
|
+
for (int y = -1; y <= 1; y++) {
|
|
22
|
+
for (int x = -1; x <= 1; x++) {
|
|
23
|
+
vec2 uv = v_textureCoordinates + vec2(float(x), float(y)) * texel;
|
|
24
|
+
float weight = (x == 0 ? 2.0 : 1.0) * (y == 0 ? 2.0 : 1.0) * (abs(texture(cloudDepth, uv).r - here) <= DEPTH_TOLERANCE * here ? 1.0 : 0.0);
|
|
25
|
+
sum += weight * texture(cloudTexture, uv);
|
|
26
|
+
weights += weight;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
out_FragColor = sum / weights;
|
|
30
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The clouds over the scene: the march's samples at a fraction of the resolution, upscaled
|
|
2
|
+
// bilinearly from those whose depth, the farthest of their block of pixels, is about this pixel's,
|
|
3
|
+
// and from the one nearest in depth where none is, rather than weighting the bilinear weights by
|
|
4
|
+
// the depths, which "can select only one sample, but that sample is not similar to the surface
|
|
5
|
+
// depth you need at all" (Pesce 2016): a ridge in front of a cloud keeps a sharp outline rather
|
|
6
|
+
// than a halo of the march's resolution. The clouds' shadows darken the scene under them, from the
|
|
7
|
+
// shadow map. Needs EyeFromDepth, Height, CloudsSlab and CloudsShadow.
|
|
8
|
+
precision highp sampler2D;
|
|
9
|
+
uniform sampler2D colorTexture;
|
|
10
|
+
uniform sampler2D depthTexture;
|
|
11
|
+
// the light the clouds scatter toward the camera, and the share of the scene seen through them
|
|
12
|
+
uniform sampler2D cloudTexture;
|
|
13
|
+
// the farthest distance of the scene in each texel's block of pixels, from CloudsDepth.glsl
|
|
14
|
+
uniform sampler2D cloudDepth;
|
|
15
|
+
in vec2 v_textureCoordinates;
|
|
16
|
+
|
|
17
|
+
// the march's resolution, clouds.js's CLOUD_SCALE, and the sky's distance, past any terrain,
|
|
18
|
+
// CloudsDepth.glsl's
|
|
19
|
+
const float CLOUD_SCALE = 0.25;
|
|
20
|
+
const float SKY_DISTANCE = 1e9;
|
|
21
|
+
// texels are at this pixel's depth within this share of it, CloudsBlur.glsl's
|
|
22
|
+
const float DEPTH_TOLERANCE = 0.1;
|
|
23
|
+
// the clouds' shadow takes at most this share of the scene's light: the sunlit share of a lit
|
|
24
|
+
// scene, as precipitation.js's OVERCAST
|
|
25
|
+
const float SHADOW_STRENGTH = 0.5;
|
|
26
|
+
|
|
27
|
+
void main() {
|
|
28
|
+
vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
|
|
29
|
+
vec2 size = ceil(czm_viewport.zw * CLOUD_SCALE);
|
|
30
|
+
vec2 position = v_textureCoordinates * size - 0.5;
|
|
31
|
+
vec2 corner = floor(position);
|
|
32
|
+
vec2 f = position - corner;
|
|
33
|
+
float here = eyeDistance(depthTexture, v_textureCoordinates, SKY_DISTANCE);
|
|
34
|
+
vec4 sum = vec4(0.0);
|
|
35
|
+
float weights = 0.0;
|
|
36
|
+
vec4 nearest = vec4(0.0);
|
|
37
|
+
float nearestGap = 1e30;
|
|
38
|
+
for (int y = 0; y <= 1; y++) {
|
|
39
|
+
for (int x = 0; x <= 1; x++) {
|
|
40
|
+
vec2 uv = (corner + vec2(float(x), float(y)) + 0.5) / size;
|
|
41
|
+
vec4 sampled = texture(cloudTexture, uv);
|
|
42
|
+
float gap = abs(texture(cloudDepth, uv).r - here);
|
|
43
|
+
float weight = gap <= DEPTH_TOLERANCE * here ? (x == 0 ? 1.0 - f.x : f.x) * (y == 0 ? 1.0 - f.y : f.y) : 0.0;
|
|
44
|
+
sum += weight * sampled;
|
|
45
|
+
weights += weight;
|
|
46
|
+
if (gap < nearestGap) {
|
|
47
|
+
nearestGap = gap;
|
|
48
|
+
nearest = sampled;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
vec4 cloud = weights > 1e-4 ? sum / weights : nearest;
|
|
53
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
54
|
+
if (eye.w != 0.0) {
|
|
55
|
+
vec3 positionWC = (czm_inverseView * vec4(eye.xyz, 1.0)).xyz;
|
|
56
|
+
sceneColor.rgb *= mix(1.0 - SHADOW_STRENGTH, 1.0, exp(-shadowDepth(positionWC)));
|
|
57
|
+
}
|
|
58
|
+
out_FragColor = vec4(sceneColor.rgb * cloud.a + cloud.rgb, sceneColor.a);
|
|
59
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// The clouds' density at a point, which the march and the shadow map share: as tall and as solid
|
|
2
|
+
// as the rain under it is heavy, shaped by billows of noise that drift with the wind. Needs
|
|
3
|
+
// CloudsSlab and WeatherMap.
|
|
4
|
+
// the noise: the billows of the base shape in red, the details in green and blue
|
|
5
|
+
precision highp sampler2D;
|
|
6
|
+
uniform highp sampler3D cloudNoise;
|
|
7
|
+
// the noise over the clouds' map, a square that repeats, from cloud-noise.js
|
|
8
|
+
uniform sampler2D mapNoise;
|
|
9
|
+
// meters above the ellipsoid
|
|
10
|
+
uniform float cloudTop;
|
|
11
|
+
// the direction the wind blows toward, and how far it has carried the noise, in world coordinates
|
|
12
|
+
uniform vec3 windDirection;
|
|
13
|
+
uniform vec3 windOffset;
|
|
14
|
+
// scale of the opacity
|
|
15
|
+
uniform float density;
|
|
16
|
+
|
|
17
|
+
// the clouds over the lightest rain are this thick, in meters, clouds.js's THIN_DEPTH
|
|
18
|
+
const float THIN_DEPTH = 1500.0;
|
|
19
|
+
// the clouds' base is flat, reaching their full density over this share of their height,
|
|
20
|
+
// remap(h, 0, 0.05, 0, 1): the lifting condensation level is about the same across an air mass; the
|
|
21
|
+
// deck is full up to this share of its height, then thins out to its top; towers thin out all the
|
|
22
|
+
// way up, in the convective envelope pow(1 - h, 1.5) (Schneider 2022); and spread an anvil from
|
|
23
|
+
// this share of their height to this one, their coverage raised to a power from 1 to this one,
|
|
24
|
+
// pow(coverage, remap(h, 0.7, 0.8, 1, lerp(1, 0.5, anvil_bias))) (Schneider 2017). The report
|
|
25
|
+
// gives these as starting points, not from a source it could check
|
|
26
|
+
const float FLAT_BASE = 0.05;
|
|
27
|
+
const float DECK_TOP = 0.65;
|
|
28
|
+
const float TOWER_ENVELOPE = 1.5;
|
|
29
|
+
const vec3 ANVIL = vec3(0.7, 0.8, 0.5);
|
|
30
|
+
// the cloud shield over dry ground is broken: its coverage is this share of the clouds' over the
|
|
31
|
+
// rain, which the rain raises to the full
|
|
32
|
+
const float SHIELD_COVERAGE = 0.5;
|
|
33
|
+
// the map's cells are read jittered by up to this share of a cell, uv + 0.3 * perlin2(uv * k)
|
|
34
|
+
// cells, so that their squares do not show; and the coverage varies by up to this share around its
|
|
35
|
+
// mean, by noise over 8 cells, 8 km of the radar's 1 km cells, a pattern that is not the billows'
|
|
36
|
+
// noise, whose tile would show (Högfeldt 2016). Both from a square of noise made once
|
|
37
|
+
// (cloud-noise.js), read once rather than computed three times at each sample, which spans this
|
|
38
|
+
// many of the map's cells, cloud-noise.js's MAP_TILE_CELLS
|
|
39
|
+
const float MAP_JITTER = 0.3;
|
|
40
|
+
const float COVERAGE_NOISE = 0.4;
|
|
41
|
+
const float MAP_TILE_CELLS = 64.0;
|
|
42
|
+
|
|
43
|
+
// the clouds' map at a point in world coordinates, jittered, its coverage varied, 0 outside the map
|
|
44
|
+
vec4 cloudMapAt(vec3 positionWC) {
|
|
45
|
+
vec2 cells = vec2(textureSize(map, 0));
|
|
46
|
+
vec2 uv = mapUv(positionWC);
|
|
47
|
+
// the jitter in red and green, the coverage's variation in blue, -1 to 1
|
|
48
|
+
vec3 noise = texture(mapNoise, uv * cells / MAP_TILE_CELLS).rgb * 2.0 - 1.0;
|
|
49
|
+
uv += MAP_JITTER * noise.rg / cells;
|
|
50
|
+
if (any(lessThan(uv, vec2(0.0))) || any(greaterThan(uv, vec2(1.0)))) {
|
|
51
|
+
return vec4(0.0);
|
|
52
|
+
}
|
|
53
|
+
vec4 texel = mix(texture(map, uv), texture(nextMap, uv), mapBlend);
|
|
54
|
+
texel.g = clamp(texel.g * (1.0 + COVERAGE_NOISE * noise.b), 0.0, 1.0);
|
|
55
|
+
return texel;
|
|
56
|
+
}
|
|
57
|
+
// extinction inside a solid cloud, per meter: about 1.3 km of visibility
|
|
58
|
+
const float EXTINCTION = 0.003;
|
|
59
|
+
// the noise repeats every this many meters, in 4 billows across, with this many voxels, clouds.js's
|
|
60
|
+
// NOISE_SIZE, and its details are about this size
|
|
61
|
+
const float NOISE_TILE = 16000.0;
|
|
62
|
+
const float NOISE_VOXELS = 64.0;
|
|
63
|
+
const float DETAIL_SIZE = 1000.0;
|
|
64
|
+
// the scale of the larger lookup of the noise, not a fraction that would line its tiles up
|
|
65
|
+
const float LARGE_SCALE = 0.27;
|
|
66
|
+
// the noise is read this many mipmaps blurrier than a pixel's footprint: its features then span a
|
|
67
|
+
// few pixels of the pass, rather than one that the upscale would turn into a square
|
|
68
|
+
const float LOD_BIAS = 1.5;
|
|
69
|
+
// the clouds lean downwind by this many meters from the base to the top of the slab,
|
|
70
|
+
// p += height_fraction * wind_direction * 500 (Schneider 2017)
|
|
71
|
+
const float WIND_SKEW = 500.0;
|
|
72
|
+
// how much the details erode the thin edges of the clouds
|
|
73
|
+
const float EROSION = 0.6;
|
|
74
|
+
// the details are wisps at the base of a cloud, billows above this share of its height: inverted
|
|
75
|
+
// Worley noise at the base for "some nice whispy shapes" (Schneider 2015)
|
|
76
|
+
const float WISPY_BASE = 0.3;
|
|
77
|
+
|
|
78
|
+
// the cloud's density at a point, 0 to the density uniform, from the clouds' map (cloud-map.js):
|
|
79
|
+
// where its shield covers the ground, as tall as its type, a deck over drizzle to towers over heavy
|
|
80
|
+
// rain, and as solid as the rain under it is heavy, which it gives, with the share of the height of
|
|
81
|
+
// its column and its dimensional profile. The noise is read at the mipmap of the footprint of a
|
|
82
|
+
// pixel, in meters, and the details fade out as it grows: sampled once a pixel, finer noise would
|
|
83
|
+
// alias into speckles
|
|
84
|
+
float cloudDensity(vec3 positionWC, float h, float footprint, out float rain, out float column, out float dimensional) {
|
|
85
|
+
// the rain in red, the shield's coverage in green, the clouds' type in blue
|
|
86
|
+
vec4 cell = cloudMapAt(positionWC);
|
|
87
|
+
float m = cell.r;
|
|
88
|
+
float type = cell.b;
|
|
89
|
+
rain = m;
|
|
90
|
+
column = 0.0;
|
|
91
|
+
dimensional = 0.0;
|
|
92
|
+
if (cell.g <= 0.0) {
|
|
93
|
+
return 0.0;
|
|
94
|
+
}
|
|
95
|
+
float top = cloudBase + mix(THIN_DEPTH, cloudTop - cloudBase, type);
|
|
96
|
+
float y = (h - cloudBase) / (top - cloudBase);
|
|
97
|
+
column = y;
|
|
98
|
+
if (y <= 0.0 || y >= 1.0) {
|
|
99
|
+
return 0.0;
|
|
100
|
+
}
|
|
101
|
+
float base = clamp(y / FLAT_BASE, 0.0, 1.0);
|
|
102
|
+
float profile = base * mix(1.0 - smoothstep(DECK_TOP, 1.0, y), pow(1.0 - y, TOWER_ENVELOPE), type);
|
|
103
|
+
float lod = max(log2(footprint * NOISE_VOXELS / NOISE_TILE) + LOD_BIAS, 0.0);
|
|
104
|
+
// the noise drifts with the wind and the map does not, so the clouds stay where it rains and
|
|
105
|
+
// their billows pass through them (Schneider 2017)
|
|
106
|
+
float slabFraction = clamp((h - cloudBase) / (cloudTop - cloudBase), 0.0, 1.0);
|
|
107
|
+
vec3 q = (positionWC - windOffset - WIND_SKEW * slabFraction * windDirection) / NOISE_TILE;
|
|
108
|
+
vec4 noise = textureLod(cloudNoise, fract(q), lod);
|
|
109
|
+
// the same noise about four times larger, its axes swapped, breaks up the repetition of the tile,
|
|
110
|
+
// which far views would show as a grid
|
|
111
|
+
float large = textureLod(cloudNoise, fract(LARGE_SCALE * q.zxy + 0.5), max(lod + log2(LARGE_SCALE), 0.0)).r;
|
|
112
|
+
noise.r = clamp(noise.r + 0.6 * (large - 0.5), 0.0, 1.0);
|
|
113
|
+
float coverage = cell.g * mix(SHIELD_COVERAGE, 1.0, m);
|
|
114
|
+
coverage = pow(coverage, mix(1.0, mix(1.0, ANVIL.z, type), clamp((y - ANVIL.x) / (ANVIL.y - ANVIL.x), 0.0, 1.0)));
|
|
115
|
+
dimensional = profile * coverage;
|
|
116
|
+
// the profile times the coverage carves the noise rather than scaling it,
|
|
117
|
+
// saturate(noise - (1 - dimensional_profile)) (Schneider 2022): the core stays solid, and only
|
|
118
|
+
// the noise's highest billows reach the top and the base. Ramped up over a softness rather than
|
|
119
|
+
// sharpened by a power as in Nubis Cubed (Schneider 2023): with 250 m voxels, a sharp edge
|
|
120
|
+
// follows their interpolation in a grid. The edges soften as the pixels grow, which would
|
|
121
|
+
// otherwise cut them in steps of the pass's resolution
|
|
122
|
+
float soft = 0.15 + 0.35 * clamp(footprint / 2000.0, 0.0, 1.0);
|
|
123
|
+
float shape = smoothstep(0.0, soft, noise.r - (1.0 - profile * coverage));
|
|
124
|
+
// the details erode where the cloud is thin, its edges, and leave its core solid
|
|
125
|
+
float billows = mix(noise.g, noise.b, 0.4);
|
|
126
|
+
float detail = mix(1.0 - billows, billows, clamp(y / WISPY_BASE, 0.0, 1.0)) * (1.0 - smoothstep(0.25, 0.5, footprint / DETAIL_SIZE));
|
|
127
|
+
float erosion = EROSION * detail * (1.0 - shape);
|
|
128
|
+
return density * clamp((shape - erosion) / (1.0 - erosion), 0.0, 1.0);
|
|
129
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// The farthest distance of the scene in each block of pixels of the clouds' march, at its
|
|
2
|
+
// resolution: the march goes as far as it, and the blur and the upscale compare their texels by it,
|
|
3
|
+
// so a cloud over the sky does not stop at a ridge in its block. "There is absolutely no physical or
|
|
4
|
+
// theoretical basis for this. It just looks better than halos" (Cantlay, GPU Gems 3, ch. 23).
|
|
5
|
+
// Needs EyeFromDepth.
|
|
6
|
+
precision highp sampler2D;
|
|
7
|
+
uniform sampler2D depthTexture;
|
|
8
|
+
in vec2 v_textureCoordinates;
|
|
9
|
+
|
|
10
|
+
// the pixels of a block across, one over clouds.js's CLOUD_SCALE, and the sky's distance, past any
|
|
11
|
+
// terrain
|
|
12
|
+
const int BLOCK = 4;
|
|
13
|
+
const float SKY_DISTANCE = 1e9;
|
|
14
|
+
|
|
15
|
+
void main() {
|
|
16
|
+
// czm_viewport is this pass's texture, the march's size
|
|
17
|
+
vec2 pixel = 1.0 / (czm_viewport.zw * float(BLOCK));
|
|
18
|
+
float farthest = 0.0;
|
|
19
|
+
for (int y = 0; y < BLOCK; y++) {
|
|
20
|
+
for (int x = 0; x < BLOCK; x++) {
|
|
21
|
+
vec2 offset = (vec2(float(x), float(y)) - 0.5 * float(BLOCK - 1)) * pixel;
|
|
22
|
+
farthest = max(farthest, eyeDistance(depthTexture, v_textureCoordinates + offset, SKY_DISTANCE));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
out_FragColor = vec4(farthest, 0.0, 0.0, 1.0);
|
|
26
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Clouds from a map of the rain, raymarched at a fraction of the resolution: the light they scatter
|
|
2
|
+
// toward the camera, and the share of the scene still seen through them, along each view ray. They
|
|
3
|
+
// fill a slab above the cloud base where the map has rain: a flat layer over drizzle, towers up to
|
|
4
|
+
// the cloud top over the heaviest rain, with a rounded base and top, shaped by billows of noise
|
|
5
|
+
// that repeats in world coordinates, read from a texture made once (cloud-noise.js): wispy over
|
|
6
|
+
// light rain and solid over heavy rain, with details eroding their edges, not their cores. The sun lights them through a few
|
|
7
|
+
// samples toward it, with a silver lining toward it, its light scattered more than once brightening
|
|
8
|
+
// their cores, and the sky lights them, brighter at their top: thick clouds are dark gray from
|
|
9
|
+
// below and white from above. The steps are short near the camera and longer with the distance, so
|
|
10
|
+
// a camera inside a cloud is in its fog. Precipitation, activated after them, draws the rain's haze
|
|
11
|
+
// over them. Needs EyeFromDepth, Height, CloudsSlab, WeatherMap, CloudsDensity, Fog, Phase and
|
|
12
|
+
// RainHaze.
|
|
13
|
+
precision highp sampler2D;
|
|
14
|
+
uniform sampler2D depthTexture;
|
|
15
|
+
// the farthest distance of the scene in this texel's block of pixels, from CloudsDepth.glsl
|
|
16
|
+
uniform sampler2D cloudDepth;
|
|
17
|
+
// the highest rain around each block of the map's pixels, over both maps, from weather-map.js
|
|
18
|
+
uniform sampler2D maxMap;
|
|
19
|
+
// the frames drawn, for the jitter to change at each, and CloudsResolve.glsl to accumulate them
|
|
20
|
+
uniform float frame;
|
|
21
|
+
in vec2 v_textureCoordinates;
|
|
22
|
+
|
|
23
|
+
const int STEPS = 32;
|
|
24
|
+
// the ray is probed at this many points of the max map before its march, less than a block of it
|
|
25
|
+
// apart over MAX_DISTANCE, 5 km for the 4 km blocks of a 1 km map: the march starts where the ray
|
|
26
|
+
// drops below the tallest cloud they find, and is skipped where they find no rain, rather than
|
|
27
|
+
// spending its steps in the empty air above the clouds (the coverage early-out of Schneider 2015)
|
|
28
|
+
const int RAY_PROBES = 8;
|
|
29
|
+
// the sun's light through the cloud, sampled at these distances toward it, in meters
|
|
30
|
+
const vec2 LIGHT_DISTANCES = vec2(200.0, 700.0);
|
|
31
|
+
// the sky's light on the clouds at their base and at their top, by day, and the moon's share of it
|
|
32
|
+
// at night. By day, their tops see the sky overhead, in the color of Cesium's at its luminance, and
|
|
33
|
+
// their bases the sunlight the ground bounces (Hillaire 2016, sec. 5.5.1), less as the sun is lower
|
|
34
|
+
// than this sine of its height. Cesium's sky itself, and an albedo of 0.1 to 0.3 for the ground,
|
|
35
|
+
// would leave the tops gray: our two samples toward the sun let little of it through
|
|
36
|
+
const vec3 AMBIENT_BASE = vec3(0.32, 0.35, 0.40);
|
|
37
|
+
const vec3 AMBIENT_TOP = vec3(0.62, 0.66, 0.72);
|
|
38
|
+
const float HIGH_SUN = 0.5;
|
|
39
|
+
// the sky's color on the clouds' tops is desaturated toward its gray, keeping this share of it: in
|
|
40
|
+
// full, its hue turns the tops sky blue, where the sun's white light dominates them (Hillaire 2016,
|
|
41
|
+
// sec. 5.5.1, lets artists desaturate the sky's light)
|
|
42
|
+
const float SKY_SATURATION = 0.3;
|
|
43
|
+
// the sky's light inside a cloud is occluded by its dimensional profile, its height profile times
|
|
44
|
+
// its coverage, pow(1 - dimensional_profile, 0.5) (Schneider 2022): bright at its edges and top,
|
|
45
|
+
// dark in its core; and by the lack of light from below at its base, in the share of its column's height
|
|
46
|
+
// pow(remap(h, 0.07, 0.14, 0.1, 1.0), 0.8) (Schneider 2017): its bases are dark
|
|
47
|
+
const vec2 DARK_BASE = vec2(0.07, 0.14);
|
|
48
|
+
// the clouds over the heaviest rain absorb this share of the light they intercept, for the
|
|
49
|
+
// "foreboding dark clouds" of Horizon Zero Dawn (Schneider 2015)
|
|
50
|
+
const float RAIN_ALBEDO = 0.8;
|
|
51
|
+
const float SUN = 0.8;
|
|
52
|
+
// the sun's light scattered more than once, as octaves of the light scattered once (Wrenninge's,
|
|
53
|
+
// Hillaire 2016, sec. 5.8, eq. 19-20): octave n has a^n of the scattering, b^n of the extinction and
|
|
54
|
+
// c^n of the phase's eccentricity, so it reaches deeper into the cloud, more alike in all
|
|
55
|
+
// directions. a <= b keeps it from scattering more light than reaches it; 0.5 each, Unreal's
|
|
56
|
+
// defaults, and 2 octaves, as Unreal and RDR2
|
|
57
|
+
const int OCTAVES = 2;
|
|
58
|
+
const float OCTAVE_SCATTERING = 0.5;
|
|
59
|
+
const float OCTAVE_EXTINCTION = 0.5;
|
|
60
|
+
const float OCTAVE_ECCENTRICITY = 0.5;
|
|
61
|
+
const vec3 MOONLIGHT = vec3(0.60, 0.63, 0.70);
|
|
62
|
+
|
|
63
|
+
// Henyey-Greenstein's phase function, times 4 pi: 1 for light scattered alike in all directions
|
|
64
|
+
float phase(float cosTheta, float g) {
|
|
65
|
+
return 4.0 * czm_pi * henyeyGreenstein(cosTheta, g);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void main() {
|
|
69
|
+
vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
|
|
70
|
+
vec3 direction = normalize(eye.xyz);
|
|
71
|
+
// the farthest of the texel's pixels, the sky past the slab: the slab ends its rays
|
|
72
|
+
float sceneDistance = texture(cloudDepth, v_textureCoordinates).r;
|
|
73
|
+
vec2 segment = slab(dot(direction, up), sceneDistance, slabTop);
|
|
74
|
+
float span = segment.y - segment.x;
|
|
75
|
+
if (span <= 0.0) {
|
|
76
|
+
out_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
vec3 directionWC = czm_inverseViewRotation * direction;
|
|
80
|
+
// the clouds' map's coverage, and its tallest type
|
|
81
|
+
float covered = 0.0;
|
|
82
|
+
float highest = 0.0;
|
|
83
|
+
for (int k = 0; k < RAY_PROBES; k++) {
|
|
84
|
+
vec2 uv = mapUv(czm_viewerPositionWC + directionWC * (segment.x + span * (float(k) + 0.5) / float(RAY_PROBES)));
|
|
85
|
+
if (all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)))) {
|
|
86
|
+
vec4 cell = texture(maxMap, uv);
|
|
87
|
+
covered = max(covered, cell.g);
|
|
88
|
+
highest = max(highest, cell.b);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
segment = slab(dot(direction, up), sceneDistance, cloudBase + mix(THIN_DEPTH, cloudTop - cloudBase, highest));
|
|
92
|
+
span = segment.y - segment.x;
|
|
93
|
+
if (covered <= 0.0 || span <= 0.0) {
|
|
94
|
+
out_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
vec3 lightWC = czm_inverseViewRotation * czm_lightDirectionEC;
|
|
98
|
+
// a forward lobe for the silver lining, a weak backward one, for each octave: the sun is a
|
|
99
|
+
// direction, the angle is the same along the ray
|
|
100
|
+
float cosTheta = dot(direction, czm_lightDirectionEC);
|
|
101
|
+
float octaves[OCTAVES];
|
|
102
|
+
float contribution = 1.0;
|
|
103
|
+
float eccentricity = 1.0;
|
|
104
|
+
for (int n = 0; n < OCTAVES; n++) {
|
|
105
|
+
octaves[n] = contribution * mix(phase(cosTheta, -0.2 * eccentricity), phase(cosTheta, 0.6 * eccentricity), 0.7);
|
|
106
|
+
contribution *= OCTAVE_SCATTERING;
|
|
107
|
+
eccentricity *= OCTAVE_ECCENTRICITY;
|
|
108
|
+
}
|
|
109
|
+
float day = daylight();
|
|
110
|
+
// the far clouds fade into the sky behind them as Cesium's fog fades the terrain, by its factor at
|
|
111
|
+
// each step's distance: the same aerial perspective on the clouds as on the earth, without which
|
|
112
|
+
// "a visual discrepancy happens at the horizon between clouds and earth" (Hillaire 2016, sec.
|
|
113
|
+
// 5.9.1). The sky toward the view, at least SKY_ELEVATION above the horizon
|
|
114
|
+
vec3 fogColor = skyToward(direction, max(asin(clamp(dot(direction, up), -1.0, 1.0)), SKY_ELEVATION));
|
|
115
|
+
vec3 sunLight = SUN * czm_lightColor * day;
|
|
116
|
+
// the sky overhead, and the sunlight from the ground, by day; the moon's at night
|
|
117
|
+
vec3 zenith = clearSkyBelow(cloudBase, czm_inverseViewRotation * up, czm_lightDirectionWC);
|
|
118
|
+
vec3 skyHue = mix(vec3(1.0), zenith / max(czm_luminance(zenith), 1e-3), SKY_SATURATION);
|
|
119
|
+
vec3 skyAbove = mix(MOONLIGHT, skyHue, day) * czm_luminance(AMBIENT_TOP);
|
|
120
|
+
vec3 groundBelow = AMBIENT_BASE * mix(MOONLIGHT, czm_lightColor * clamp(dot(up, czm_lightDirectionEC) / HIGH_SUN, 0.0, 1.0), day);
|
|
121
|
+
// interleaved gradient noise, a different start along the ray for each pixel, and at each frame,
|
|
122
|
+
// by the golden ratio (Wolfe 2020)
|
|
123
|
+
// the angle a pixel of this pass covers
|
|
124
|
+
float pixelAngle = 2.0 / (czm_projection[1][1] * czm_viewport.w);
|
|
125
|
+
float jitter = fract(52.9829189 * fract(dot(gl_FragCoord.xy, vec2(0.06711056, 0.00583715))) + 0.618034 * frame);
|
|
126
|
+
vec3 light = vec3(0.0);
|
|
127
|
+
float transmittance = 1.0;
|
|
128
|
+
float rain;
|
|
129
|
+
float column;
|
|
130
|
+
float dimensional;
|
|
131
|
+
float unused;
|
|
132
|
+
for (int i = 0; i < STEPS; i++) {
|
|
133
|
+
float s = (float(i) + jitter) / float(STEPS);
|
|
134
|
+
float t = segment.x + span * s * s;
|
|
135
|
+
float dt = span * (2.0 * s + 1.0 / float(STEPS)) / float(STEPS);
|
|
136
|
+
vec3 pointEC = direction * t;
|
|
137
|
+
float h = heightAt(pointEC);
|
|
138
|
+
vec3 pointWC = czm_viewerPositionWC + directionWC * t;
|
|
139
|
+
float footprint = t * pixelAngle;
|
|
140
|
+
float sigma = EXTINCTION * cloudDensity(pointWC, h, footprint, rain, column, dimensional);
|
|
141
|
+
if (sigma <= 0.0) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
// the sun's light through the cloud toward it
|
|
145
|
+
float opticalDepth = 0.0;
|
|
146
|
+
float previous = 0.0;
|
|
147
|
+
for (int j = 0; j < 2; j++) {
|
|
148
|
+
// jittered as the step, for the samples of neighboring pixels not to band (Hillaire 2016,
|
|
149
|
+
// sec. 5.5.2)
|
|
150
|
+
float distanceToward = LIGHT_DISTANCES[j] * (0.75 + 0.5 * jitter);
|
|
151
|
+
opticalDepth += EXTINCTION * cloudDensity(pointWC + lightWC * distanceToward, heightAt(pointEC + czm_lightDirectionEC * distanceToward), footprint, unused, unused, unused) * (distanceToward - previous);
|
|
152
|
+
previous = distanceToward;
|
|
153
|
+
}
|
|
154
|
+
float sunThrough = 0.0;
|
|
155
|
+
float occlusion = 1.0;
|
|
156
|
+
for (int n = 0; n < OCTAVES; n++) {
|
|
157
|
+
sunThrough += octaves[n] * exp(-opticalDepth * occlusion);
|
|
158
|
+
occlusion *= OCTAVE_EXTINCTION;
|
|
159
|
+
}
|
|
160
|
+
float y = clamp((h - cloudBase) / (cloudTop - cloudBase), 0.0, 1.0);
|
|
161
|
+
float ambientOcclusion = sqrt(max(1.0 - dimensional, 0.0)) * pow(mix(0.1, 1.0, clamp((column - DARK_BASE.x) / (DARK_BASE.y - DARK_BASE.x), 0.0, 1.0)), 0.8);
|
|
162
|
+
vec3 scattered = sunLight * sunThrough + mix(groundBelow, skyAbove, y) * ambientOcclusion;
|
|
163
|
+
float stepTransmittance = exp(-sigma * dt);
|
|
164
|
+
// the light scattered over the step, the integral of the source over it, (S - S T) / sigma_t
|
|
165
|
+
// (Hillaire 2016, eq. 17): the albedo, sigma_s / sigma_t, of what the step intercepts
|
|
166
|
+
vec3 seen = czm_fog(t, scattered * mix(1.0, RAIN_ALBEDO, rain), fogColor, czm_fogVisualDensityScalar);
|
|
167
|
+
light += transmittance * seen * (1.0 - stepTransmittance);
|
|
168
|
+
transmittance *= stepTransmittance;
|
|
169
|
+
if (transmittance < 0.03) {
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
out_FragColor = vec4(min(light, vec3(1.0)), transmittance);
|
|
174
|
+
}
|