@geoblocks/cesium-post-process 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. package/README.md +6 -1
  2. package/dist/analog-video.d.ts +71 -0
  3. package/dist/analog-video.d.ts.map +1 -0
  4. package/dist/analog-video.js +128 -0
  5. package/dist/analog-video.js.map +1 -0
  6. package/dist/blur.d.ts +13 -0
  7. package/dist/blur.d.ts.map +1 -0
  8. package/dist/blur.js +36 -0
  9. package/dist/blur.js.map +1 -0
  10. package/dist/cesium-post-process.d.ts +30 -0
  11. package/dist/cesium-post-process.d.ts.map +1 -0
  12. package/dist/cesium-post-process.js +31 -0
  13. package/dist/cesium-post-process.js.map +1 -0
  14. package/dist/cloud-cover.d.ts +28 -0
  15. package/dist/cloud-cover.d.ts.map +1 -0
  16. package/dist/cloud-cover.js +45 -0
  17. package/dist/cloud-cover.js.map +1 -0
  18. package/dist/cloud-map.d.ts +7 -0
  19. package/dist/cloud-map.d.ts.map +1 -0
  20. package/dist/cloud-map.js +118 -0
  21. package/dist/cloud-map.js.map +1 -0
  22. package/dist/cloud-noise.d.ts +13 -0
  23. package/dist/cloud-noise.d.ts.map +1 -0
  24. package/dist/cloud-noise.js +222 -0
  25. package/dist/cloud-noise.js.map +1 -0
  26. package/dist/clouds.d.ts +275 -0
  27. package/dist/clouds.d.ts.map +1 -0
  28. package/dist/clouds.js +642 -0
  29. package/dist/clouds.js.map +1 -0
  30. package/dist/color-isolation.d.ts +38 -0
  31. package/dist/color-isolation.d.ts.map +1 -0
  32. package/dist/color-isolation.js +61 -0
  33. package/dist/color-isolation.js.map +1 -0
  34. package/dist/depth-test.d.ts +9 -0
  35. package/dist/depth-test.d.ts.map +1 -0
  36. package/dist/depth-test.js +35 -0
  37. package/dist/depth-test.js.map +1 -0
  38. package/dist/digital-video.d.ts +47 -0
  39. package/dist/digital-video.d.ts.map +1 -0
  40. package/dist/digital-video.js +102 -0
  41. package/dist/digital-video.js.map +1 -0
  42. package/dist/drone-display.d.ts +70 -0
  43. package/dist/drone-display.d.ts.map +1 -0
  44. package/dist/drone-display.js +158 -0
  45. package/dist/drone-display.js.map +1 -0
  46. package/dist/dufour.d.ts +108 -0
  47. package/dist/dufour.d.ts.map +1 -0
  48. package/dist/dufour.js +201 -0
  49. package/dist/dufour.js.map +1 -0
  50. package/dist/effect.d.ts +33 -0
  51. package/dist/effect.d.ts.map +1 -0
  52. package/dist/effect.js +60 -0
  53. package/dist/effect.js.map +1 -0
  54. package/dist/focus.d.ts +11 -0
  55. package/dist/focus.d.ts.map +1 -0
  56. package/dist/focus.js +23 -0
  57. package/dist/focus.js.map +1 -0
  58. package/dist/frame-clock.d.ts +11 -0
  59. package/dist/frame-clock.d.ts.map +1 -0
  60. package/dist/frame-clock.js +57 -0
  61. package/dist/frame-clock.js.map +1 -0
  62. package/dist/height.d.ts +12 -0
  63. package/dist/height.d.ts.map +1 -0
  64. package/dist/height.js +22 -0
  65. package/dist/height.js.map +1 -0
  66. package/dist/infrared.d.ts +23 -0
  67. package/dist/infrared.d.ts.map +1 -0
  68. package/dist/infrared.js +36 -0
  69. package/dist/infrared.js.map +1 -0
  70. package/dist/jello.d.ts +52 -0
  71. package/dist/jello.d.ts.map +1 -0
  72. package/dist/jello.js +136 -0
  73. package/dist/jello.js.map +1 -0
  74. package/dist/lens-distortion.d.ts +33 -0
  75. package/dist/lens-distortion.d.ts.map +1 -0
  76. package/dist/lens-distortion.js +61 -0
  77. package/dist/lens-distortion.js.map +1 -0
  78. package/dist/lightning.d.ts +124 -0
  79. package/dist/lightning.d.ts.map +1 -0
  80. package/dist/lightning.js +301 -0
  81. package/dist/lightning.js.map +1 -0
  82. package/dist/local-frame.d.ts +38 -0
  83. package/dist/local-frame.d.ts.map +1 -0
  84. package/dist/local-frame.js +52 -0
  85. package/dist/local-frame.js.map +1 -0
  86. package/dist/motion-blur.d.ts +50 -0
  87. package/dist/motion-blur.d.ts.map +1 -0
  88. package/dist/motion-blur.js +108 -0
  89. package/dist/motion-blur.js.map +1 -0
  90. package/dist/precipitation.d.ts +146 -0
  91. package/dist/precipitation.d.ts.map +1 -0
  92. package/dist/precipitation.js +454 -0
  93. package/dist/precipitation.js.map +1 -0
  94. package/dist/rain-rings.d.ts +100 -0
  95. package/dist/rain-rings.d.ts.map +1 -0
  96. package/dist/rain-rings.js +181 -0
  97. package/dist/rain-rings.js.map +1 -0
  98. package/dist/shaders/Alpenglow.d.ts +3 -0
  99. package/dist/shaders/Alpenglow.d.ts.map +1 -0
  100. package/dist/shaders/Alpenglow.js +3 -0
  101. package/dist/shaders/Alpenglow.js.map +1 -0
  102. package/dist/shaders/AnalogVideo.d.ts +3 -0
  103. package/dist/shaders/AnalogVideo.d.ts.map +1 -0
  104. package/dist/shaders/AnalogVideo.js +3 -0
  105. package/dist/shaders/AnalogVideo.js.map +1 -0
  106. package/dist/shaders/Beam.d.ts +3 -0
  107. package/dist/shaders/Beam.d.ts.map +1 -0
  108. package/dist/shaders/Beam.js +3 -0
  109. package/dist/shaders/Beam.js.map +1 -0
  110. package/dist/shaders/CloudsBlur.d.ts +3 -0
  111. package/dist/shaders/CloudsBlur.d.ts.map +1 -0
  112. package/dist/shaders/CloudsBlur.js +3 -0
  113. package/dist/shaders/CloudsBlur.js.map +1 -0
  114. package/dist/shaders/CloudsComposite.d.ts +3 -0
  115. package/dist/shaders/CloudsComposite.d.ts.map +1 -0
  116. package/dist/shaders/CloudsComposite.js +3 -0
  117. package/dist/shaders/CloudsComposite.js.map +1 -0
  118. package/dist/shaders/CloudsDensity.d.ts +3 -0
  119. package/dist/shaders/CloudsDensity.d.ts.map +1 -0
  120. package/dist/shaders/CloudsDensity.js +3 -0
  121. package/dist/shaders/CloudsDensity.js.map +1 -0
  122. package/dist/shaders/CloudsDepth.d.ts +3 -0
  123. package/dist/shaders/CloudsDepth.d.ts.map +1 -0
  124. package/dist/shaders/CloudsDepth.js +3 -0
  125. package/dist/shaders/CloudsDepth.js.map +1 -0
  126. package/dist/shaders/CloudsMarch.d.ts +3 -0
  127. package/dist/shaders/CloudsMarch.d.ts.map +1 -0
  128. package/dist/shaders/CloudsMarch.js +3 -0
  129. package/dist/shaders/CloudsMarch.js.map +1 -0
  130. package/dist/shaders/CloudsResolve.d.ts +3 -0
  131. package/dist/shaders/CloudsResolve.d.ts.map +1 -0
  132. package/dist/shaders/CloudsResolve.js +3 -0
  133. package/dist/shaders/CloudsResolve.js.map +1 -0
  134. package/dist/shaders/CloudsShadow.d.ts +3 -0
  135. package/dist/shaders/CloudsShadow.d.ts.map +1 -0
  136. package/dist/shaders/CloudsShadow.js +3 -0
  137. package/dist/shaders/CloudsShadow.js.map +1 -0
  138. package/dist/shaders/CloudsShadowMap.d.ts +3 -0
  139. package/dist/shaders/CloudsShadowMap.d.ts.map +1 -0
  140. package/dist/shaders/CloudsShadowMap.js +3 -0
  141. package/dist/shaders/CloudsShadowMap.js.map +1 -0
  142. package/dist/shaders/CloudsSlab.d.ts +3 -0
  143. package/dist/shaders/CloudsSlab.d.ts.map +1 -0
  144. package/dist/shaders/CloudsSlab.js +3 -0
  145. package/dist/shaders/CloudsSlab.js.map +1 -0
  146. package/dist/shaders/ColorIsolation.d.ts +3 -0
  147. package/dist/shaders/ColorIsolation.d.ts.map +1 -0
  148. package/dist/shaders/ColorIsolation.js +3 -0
  149. package/dist/shaders/ColorIsolation.js.map +1 -0
  150. package/dist/shaders/DepthEdges.d.ts +3 -0
  151. package/dist/shaders/DepthEdges.d.ts.map +1 -0
  152. package/dist/shaders/DepthEdges.js +3 -0
  153. package/dist/shaders/DepthEdges.js.map +1 -0
  154. package/dist/shaders/DigitalVideo.d.ts +3 -0
  155. package/dist/shaders/DigitalVideo.d.ts.map +1 -0
  156. package/dist/shaders/DigitalVideo.js +3 -0
  157. package/dist/shaders/DigitalVideo.js.map +1 -0
  158. package/dist/shaders/DroneDisplay.d.ts +3 -0
  159. package/dist/shaders/DroneDisplay.d.ts.map +1 -0
  160. package/dist/shaders/DroneDisplay.js +3 -0
  161. package/dist/shaders/DroneDisplay.js.map +1 -0
  162. package/dist/shaders/Dufour.d.ts +3 -0
  163. package/dist/shaders/Dufour.d.ts.map +1 -0
  164. package/dist/shaders/Dufour.js +3 -0
  165. package/dist/shaders/Dufour.js.map +1 -0
  166. package/dist/shaders/EyeFromDepth.d.ts +3 -0
  167. package/dist/shaders/EyeFromDepth.d.ts.map +1 -0
  168. package/dist/shaders/EyeFromDepth.js +3 -0
  169. package/dist/shaders/EyeFromDepth.js.map +1 -0
  170. package/dist/shaders/Filmic.d.ts +3 -0
  171. package/dist/shaders/Filmic.d.ts.map +1 -0
  172. package/dist/shaders/Filmic.js +3 -0
  173. package/dist/shaders/Filmic.js.map +1 -0
  174. package/dist/shaders/Flashlight.d.ts +3 -0
  175. package/dist/shaders/Flashlight.d.ts.map +1 -0
  176. package/dist/shaders/Flashlight.js +3 -0
  177. package/dist/shaders/Flashlight.js.map +1 -0
  178. package/dist/shaders/Fog.d.ts +3 -0
  179. package/dist/shaders/Fog.d.ts.map +1 -0
  180. package/dist/shaders/Fog.js +3 -0
  181. package/dist/shaders/Fog.js.map +1 -0
  182. package/dist/shaders/Frame.d.ts +3 -0
  183. package/dist/shaders/Frame.d.ts.map +1 -0
  184. package/dist/shaders/Frame.js +3 -0
  185. package/dist/shaders/Frame.js.map +1 -0
  186. package/dist/shaders/Hash.d.ts +3 -0
  187. package/dist/shaders/Hash.d.ts.map +1 -0
  188. package/dist/shaders/Hash.js +3 -0
  189. package/dist/shaders/Hash.js.map +1 -0
  190. package/dist/shaders/Height.d.ts +3 -0
  191. package/dist/shaders/Height.d.ts.map +1 -0
  192. package/dist/shaders/Height.js +3 -0
  193. package/dist/shaders/Height.js.map +1 -0
  194. package/dist/shaders/Infrared.d.ts +3 -0
  195. package/dist/shaders/Infrared.d.ts.map +1 -0
  196. package/dist/shaders/Infrared.js +3 -0
  197. package/dist/shaders/Infrared.js.map +1 -0
  198. package/dist/shaders/Jello.d.ts +3 -0
  199. package/dist/shaders/Jello.d.ts.map +1 -0
  200. package/dist/shaders/Jello.js +3 -0
  201. package/dist/shaders/Jello.js.map +1 -0
  202. package/dist/shaders/LensDistortion.d.ts +3 -0
  203. package/dist/shaders/LensDistortion.d.ts.map +1 -0
  204. package/dist/shaders/LensDistortion.js +3 -0
  205. package/dist/shaders/LensDistortion.js.map +1 -0
  206. package/dist/shaders/Lightning.d.ts +3 -0
  207. package/dist/shaders/Lightning.d.ts.map +1 -0
  208. package/dist/shaders/Lightning.js +3 -0
  209. package/dist/shaders/Lightning.js.map +1 -0
  210. package/dist/shaders/MotionBlur.d.ts +3 -0
  211. package/dist/shaders/MotionBlur.d.ts.map +1 -0
  212. package/dist/shaders/MotionBlur.js +3 -0
  213. package/dist/shaders/MotionBlur.js.map +1 -0
  214. package/dist/shaders/MotionBlurVelocity.d.ts +3 -0
  215. package/dist/shaders/MotionBlurVelocity.d.ts.map +1 -0
  216. package/dist/shaders/MotionBlurVelocity.js +3 -0
  217. package/dist/shaders/MotionBlurVelocity.js.map +1 -0
  218. package/dist/shaders/Noise.d.ts +3 -0
  219. package/dist/shaders/Noise.d.ts.map +1 -0
  220. package/dist/shaders/Noise.js +3 -0
  221. package/dist/shaders/Noise.js.map +1 -0
  222. package/dist/shaders/Normal.d.ts +3 -0
  223. package/dist/shaders/Normal.d.ts.map +1 -0
  224. package/dist/shaders/Normal.js +3 -0
  225. package/dist/shaders/Normal.js.map +1 -0
  226. package/dist/shaders/Phase.d.ts +3 -0
  227. package/dist/shaders/Phase.d.ts.map +1 -0
  228. package/dist/shaders/Phase.js +3 -0
  229. package/dist/shaders/Phase.js.map +1 -0
  230. package/dist/shaders/Precipitation.d.ts +3 -0
  231. package/dist/shaders/Precipitation.d.ts.map +1 -0
  232. package/dist/shaders/Precipitation.js +3 -0
  233. package/dist/shaders/Precipitation.js.map +1 -0
  234. package/dist/shaders/PrecipitationShaftBlur.d.ts +3 -0
  235. package/dist/shaders/PrecipitationShaftBlur.d.ts.map +1 -0
  236. package/dist/shaders/PrecipitationShaftBlur.js +3 -0
  237. package/dist/shaders/PrecipitationShaftBlur.js.map +1 -0
  238. package/dist/shaders/PrecipitationShafts.d.ts +3 -0
  239. package/dist/shaders/PrecipitationShafts.d.ts.map +1 -0
  240. package/dist/shaders/PrecipitationShafts.js +3 -0
  241. package/dist/shaders/PrecipitationShafts.js.map +1 -0
  242. package/dist/shaders/PrecipitationWind.d.ts +3 -0
  243. package/dist/shaders/PrecipitationWind.d.ts.map +1 -0
  244. package/dist/shaders/PrecipitationWind.js +3 -0
  245. package/dist/shaders/PrecipitationWind.js.map +1 -0
  246. package/dist/shaders/RainHaze.d.ts +3 -0
  247. package/dist/shaders/RainHaze.d.ts.map +1 -0
  248. package/dist/shaders/RainHaze.js +3 -0
  249. package/dist/shaders/RainHaze.js.map +1 -0
  250. package/dist/shaders/RainRings.d.ts +3 -0
  251. package/dist/shaders/RainRings.d.ts.map +1 -0
  252. package/dist/shaders/RainRings.js +3 -0
  253. package/dist/shaders/RainRings.js.map +1 -0
  254. package/dist/shaders/Shockwave.d.ts +3 -0
  255. package/dist/shaders/Shockwave.d.ts.map +1 -0
  256. package/dist/shaders/Shockwave.js +3 -0
  257. package/dist/shaders/Shockwave.js.map +1 -0
  258. package/dist/shaders/SkyTable.d.ts +3 -0
  259. package/dist/shaders/SkyTable.d.ts.map +1 -0
  260. package/dist/shaders/SkyTable.js +3 -0
  261. package/dist/shaders/SkyTable.js.map +1 -0
  262. package/dist/shaders/SnowLine.d.ts +3 -0
  263. package/dist/shaders/SnowLine.d.ts.map +1 -0
  264. package/dist/shaders/SnowLine.js +3 -0
  265. package/dist/shaders/SnowLine.js.map +1 -0
  266. package/dist/shaders/SpeedLines.d.ts +3 -0
  267. package/dist/shaders/SpeedLines.d.ts.map +1 -0
  268. package/dist/shaders/SpeedLines.js +3 -0
  269. package/dist/shaders/SpeedLines.js.map +1 -0
  270. package/dist/shaders/Spotlight.d.ts +3 -0
  271. package/dist/shaders/Spotlight.d.ts.map +1 -0
  272. package/dist/shaders/Spotlight.js +3 -0
  273. package/dist/shaders/Spotlight.js.map +1 -0
  274. package/dist/shaders/SpotlightBeam.d.ts +3 -0
  275. package/dist/shaders/SpotlightBeam.d.ts.map +1 -0
  276. package/dist/shaders/SpotlightBeam.js +3 -0
  277. package/dist/shaders/SpotlightBeam.js.map +1 -0
  278. package/dist/shaders/SpotlightBeamBlur.d.ts +3 -0
  279. package/dist/shaders/SpotlightBeamBlur.d.ts.map +1 -0
  280. package/dist/shaders/SpotlightBeamBlur.js +3 -0
  281. package/dist/shaders/SpotlightBeamBlur.js.map +1 -0
  282. package/dist/shaders/SpotlightCone.d.ts +3 -0
  283. package/dist/shaders/SpotlightCone.d.ts.map +1 -0
  284. package/dist/shaders/SpotlightCone.js +3 -0
  285. package/dist/shaders/SpotlightCone.js.map +1 -0
  286. package/dist/shaders/Super8.d.ts +3 -0
  287. package/dist/shaders/Super8.d.ts.map +1 -0
  288. package/dist/shaders/Super8.js +3 -0
  289. package/dist/shaders/Super8.js.map +1 -0
  290. package/dist/shaders/Technicolor.d.ts +3 -0
  291. package/dist/shaders/Technicolor.d.ts.map +1 -0
  292. package/dist/shaders/Technicolor.js +3 -0
  293. package/dist/shaders/Technicolor.js.map +1 -0
  294. package/dist/shaders/TiltShift.d.ts +3 -0
  295. package/dist/shaders/TiltShift.d.ts.map +1 -0
  296. package/dist/shaders/TiltShift.js +3 -0
  297. package/dist/shaders/TiltShift.js.map +1 -0
  298. package/dist/shaders/Toy.d.ts +3 -0
  299. package/dist/shaders/Toy.d.ts.map +1 -0
  300. package/dist/shaders/Toy.js +3 -0
  301. package/dist/shaders/Toy.js.map +1 -0
  302. package/dist/shaders/Trails.d.ts +3 -0
  303. package/dist/shaders/Trails.d.ts.map +1 -0
  304. package/dist/shaders/Trails.js +3 -0
  305. package/dist/shaders/Trails.js.map +1 -0
  306. package/dist/shaders/ValleyFog.d.ts +3 -0
  307. package/dist/shaders/ValleyFog.d.ts.map +1 -0
  308. package/dist/shaders/ValleyFog.js +3 -0
  309. package/dist/shaders/ValleyFog.js.map +1 -0
  310. package/dist/shaders/WeatherMap.d.ts +3 -0
  311. package/dist/shaders/WeatherMap.d.ts.map +1 -0
  312. package/dist/shaders/WeatherMap.js +3 -0
  313. package/dist/shaders/WeatherMap.js.map +1 -0
  314. package/dist/shaders/WhiteModel.d.ts +3 -0
  315. package/dist/shaders/WhiteModel.d.ts.map +1 -0
  316. package/dist/shaders/WhiteModel.js +3 -0
  317. package/dist/shaders/WhiteModel.js.map +1 -0
  318. package/dist/snow-line.d.ts +117 -0
  319. package/dist/snow-line.d.ts.map +1 -0
  320. package/dist/snow-line.js +201 -0
  321. package/dist/snow-line.js.map +1 -0
  322. package/dist/speed-lines.d.ts +36 -0
  323. package/dist/speed-lines.d.ts.map +1 -0
  324. package/dist/speed-lines.js +65 -0
  325. package/dist/speed-lines.js.map +1 -0
  326. package/dist/spotlight.d.ts +84 -0
  327. package/dist/spotlight.d.ts.map +1 -0
  328. package/dist/spotlight.js +175 -0
  329. package/dist/spotlight.js.map +1 -0
  330. package/dist/strikes.d.ts +17 -0
  331. package/dist/strikes.d.ts.map +1 -0
  332. package/dist/strikes.js +30 -0
  333. package/dist/strikes.js.map +1 -0
  334. package/dist/super8.d.ts +78 -0
  335. package/dist/super8.d.ts.map +1 -0
  336. package/dist/super8.js +146 -0
  337. package/dist/super8.js.map +1 -0
  338. package/dist/technicolor.d.ts +32 -0
  339. package/dist/technicolor.d.ts.map +1 -0
  340. package/dist/technicolor.js +51 -0
  341. package/dist/technicolor.js.map +1 -0
  342. package/dist/tilt-shift.d.ts +60 -0
  343. package/dist/tilt-shift.d.ts.map +1 -0
  344. package/dist/tilt-shift.js +112 -0
  345. package/dist/tilt-shift.js.map +1 -0
  346. package/dist/toy.d.ts +110 -0
  347. package/dist/toy.d.ts.map +1 -0
  348. package/dist/toy.js +173 -0
  349. package/dist/toy.js.map +1 -0
  350. package/dist/valley-fog.d.ts +56 -0
  351. package/dist/valley-fog.d.ts.map +1 -0
  352. package/dist/valley-fog.js +94 -0
  353. package/dist/valley-fog.js.map +1 -0
  354. package/dist/weather-map.d.ts +132 -0
  355. package/dist/weather-map.d.ts.map +1 -0
  356. package/dist/weather-map.js +266 -0
  357. package/dist/weather-map.js.map +1 -0
  358. package/dist/white-model.d.ts +70 -0
  359. package/dist/white-model.d.ts.map +1 -0
  360. package/dist/white-model.js +94 -0
  361. package/dist/white-model.js.map +1 -0
  362. package/package.json +19 -40
  363. package/{cesium-post-process.js → src/cesium-post-process.js} +2 -0
  364. package/src/local-frame.js +57 -0
  365. package/{rain-rings.js → src/rain-rings.js} +14 -28
  366. package/src/shaders/AnalogVideo.glsl +132 -0
  367. package/src/shaders/Beam.glsl +108 -0
  368. package/src/shaders/CloudsBlur.glsl +30 -0
  369. package/src/shaders/CloudsComposite.glsl +59 -0
  370. package/src/shaders/CloudsDensity.glsl +129 -0
  371. package/src/shaders/CloudsDepth.glsl +26 -0
  372. package/src/shaders/CloudsMarch.glsl +174 -0
  373. package/src/shaders/CloudsResolve.glsl +46 -0
  374. package/src/shaders/CloudsShadow.glsl +50 -0
  375. package/src/shaders/CloudsShadowMap.glsl +68 -0
  376. package/src/shaders/CloudsSlab.glsl +58 -0
  377. package/src/shaders/ColorIsolation.glsl +26 -0
  378. package/src/shaders/DepthEdges.glsl +81 -0
  379. package/src/shaders/DigitalVideo.glsl +65 -0
  380. package/src/shaders/DroneDisplay.glsl +337 -0
  381. package/src/shaders/Dufour.glsl +109 -0
  382. package/src/shaders/EyeFromDepth.glsl +36 -0
  383. package/src/shaders/Filmic.glsl +5 -0
  384. package/src/shaders/Fog.glsl +18 -0
  385. package/src/shaders/Frame.glsl +10 -0
  386. package/src/shaders/Hash.glsl +12 -0
  387. package/src/shaders/Height.glsl +25 -0
  388. package/src/shaders/Infrared.glsl +44 -0
  389. package/src/shaders/Jello.glsl +41 -0
  390. package/src/shaders/LensDistortion.glsl +24 -0
  391. package/src/shaders/Lightning.glsl +257 -0
  392. package/src/shaders/MotionBlur.glsl +71 -0
  393. package/src/shaders/MotionBlurVelocity.glsl +31 -0
  394. package/src/shaders/Noise.glsl +43 -0
  395. package/src/shaders/Normal.glsl +21 -0
  396. package/src/shaders/Phase.glsl +6 -0
  397. package/src/shaders/Precipitation.glsl +199 -0
  398. package/src/shaders/PrecipitationShaftBlur.glsl +21 -0
  399. package/src/shaders/PrecipitationShafts.glsl +84 -0
  400. package/src/shaders/PrecipitationWind.glsl +33 -0
  401. package/src/shaders/RainHaze.glsl +145 -0
  402. package/src/shaders/RainRings.glsl +64 -0
  403. package/src/shaders/SkyTable.glsl +23 -0
  404. package/src/shaders/SnowLine.glsl +97 -0
  405. package/src/shaders/SnowLine.js +2 -0
  406. package/src/shaders/SpeedLines.glsl +61 -0
  407. package/src/shaders/Spotlight.glsl +89 -0
  408. package/src/shaders/SpotlightBeam.glsl +49 -0
  409. package/src/shaders/SpotlightBeamBlur.glsl +27 -0
  410. package/src/shaders/SpotlightCone.glsl +37 -0
  411. package/src/shaders/Super8.glsl +90 -0
  412. package/src/shaders/Technicolor.glsl +30 -0
  413. package/src/shaders/TiltShift.glsl +34 -0
  414. package/src/shaders/Toy.glsl +46 -0
  415. package/src/shaders/ValleyFog.glsl +40 -0
  416. package/src/shaders/WeatherMap.glsl +33 -0
  417. package/src/shaders/WhiteModel.glsl +108 -0
  418. package/{snow-line.js → src/snow-line.js} +71 -3
  419. package/local-frame.js +0 -15
  420. package/shaders/SnowLine.js +0 -2
  421. /package/{analog-video.js → src/analog-video.js} +0 -0
  422. /package/{blur.js → src/blur.js} +0 -0
  423. /package/{cloud-cover.js → src/cloud-cover.js} +0 -0
  424. /package/{cloud-map.js → src/cloud-map.js} +0 -0
  425. /package/{cloud-noise.js → src/cloud-noise.js} +0 -0
  426. /package/{clouds.js → src/clouds.js} +0 -0
  427. /package/{color-isolation.js → src/color-isolation.js} +0 -0
  428. /package/{depth-test.js → src/depth-test.js} +0 -0
  429. /package/{digital-video.js → src/digital-video.js} +0 -0
  430. /package/{drone-display.js → src/drone-display.js} +0 -0
  431. /package/{dufour.js → src/dufour.js} +0 -0
  432. /package/{effect.js → src/effect.js} +0 -0
  433. /package/{focus.js → src/focus.js} +0 -0
  434. /package/{frame-clock.js → src/frame-clock.js} +0 -0
  435. /package/{height.js → src/height.js} +0 -0
  436. /package/{infrared.js → src/infrared.js} +0 -0
  437. /package/{jello.js → src/jello.js} +0 -0
  438. /package/{lens-distortion.js → src/lens-distortion.js} +0 -0
  439. /package/{lightning.js → src/lightning.js} +0 -0
  440. /package/{motion-blur.js → src/motion-blur.js} +0 -0
  441. /package/{precipitation.js → src/precipitation.js} +0 -0
  442. /package/{shaders → src/shaders}/Alpenglow.js +0 -0
  443. /package/{shaders → src/shaders}/AnalogVideo.js +0 -0
  444. /package/{shaders → src/shaders}/Beam.js +0 -0
  445. /package/{shaders → src/shaders}/CloudsBlur.js +0 -0
  446. /package/{shaders → src/shaders}/CloudsComposite.js +0 -0
  447. /package/{shaders → src/shaders}/CloudsDensity.js +0 -0
  448. /package/{shaders → src/shaders}/CloudsDepth.js +0 -0
  449. /package/{shaders → src/shaders}/CloudsMarch.js +0 -0
  450. /package/{shaders → src/shaders}/CloudsResolve.js +0 -0
  451. /package/{shaders → src/shaders}/CloudsShadow.js +0 -0
  452. /package/{shaders → src/shaders}/CloudsShadowMap.js +0 -0
  453. /package/{shaders → src/shaders}/CloudsSlab.js +0 -0
  454. /package/{shaders → src/shaders}/ColorIsolation.js +0 -0
  455. /package/{shaders → src/shaders}/DepthEdges.js +0 -0
  456. /package/{shaders → src/shaders}/DigitalVideo.js +0 -0
  457. /package/{shaders → src/shaders}/DroneDisplay.js +0 -0
  458. /package/{shaders → src/shaders}/Dufour.js +0 -0
  459. /package/{shaders → src/shaders}/EyeFromDepth.js +0 -0
  460. /package/{shaders → src/shaders}/Filmic.js +0 -0
  461. /package/{shaders → src/shaders}/Flashlight.js +0 -0
  462. /package/{shaders → src/shaders}/Fog.js +0 -0
  463. /package/{shaders → src/shaders}/Frame.js +0 -0
  464. /package/{shaders → src/shaders}/Hash.js +0 -0
  465. /package/{shaders → src/shaders}/Height.js +0 -0
  466. /package/{shaders → src/shaders}/Infrared.js +0 -0
  467. /package/{shaders → src/shaders}/Jello.js +0 -0
  468. /package/{shaders → src/shaders}/LensDistortion.js +0 -0
  469. /package/{shaders → src/shaders}/Lightning.js +0 -0
  470. /package/{shaders → src/shaders}/MotionBlur.js +0 -0
  471. /package/{shaders → src/shaders}/MotionBlurVelocity.js +0 -0
  472. /package/{shaders → src/shaders}/Noise.js +0 -0
  473. /package/{shaders → src/shaders}/Normal.js +0 -0
  474. /package/{shaders → src/shaders}/Phase.js +0 -0
  475. /package/{shaders → src/shaders}/Precipitation.js +0 -0
  476. /package/{shaders → src/shaders}/PrecipitationShaftBlur.js +0 -0
  477. /package/{shaders → src/shaders}/PrecipitationShafts.js +0 -0
  478. /package/{shaders → src/shaders}/PrecipitationWind.js +0 -0
  479. /package/{shaders → src/shaders}/RainHaze.js +0 -0
  480. /package/{shaders → src/shaders}/RainRings.js +0 -0
  481. /package/{shaders → src/shaders}/Shockwave.js +0 -0
  482. /package/{shaders → src/shaders}/SkyTable.js +0 -0
  483. /package/{shaders → src/shaders}/SpeedLines.js +0 -0
  484. /package/{shaders → src/shaders}/Spotlight.js +0 -0
  485. /package/{shaders → src/shaders}/SpotlightBeam.js +0 -0
  486. /package/{shaders → src/shaders}/SpotlightBeamBlur.js +0 -0
  487. /package/{shaders → src/shaders}/SpotlightCone.js +0 -0
  488. /package/{shaders → src/shaders}/Super8.js +0 -0
  489. /package/{shaders → src/shaders}/Technicolor.js +0 -0
  490. /package/{shaders → src/shaders}/TiltShift.js +0 -0
  491. /package/{shaders → src/shaders}/Toy.js +0 -0
  492. /package/{shaders → src/shaders}/Trails.js +0 -0
  493. /package/{shaders → src/shaders}/ValleyFog.js +0 -0
  494. /package/{shaders → src/shaders}/WeatherMap.js +0 -0
  495. /package/{shaders → src/shaders}/WhiteModel.js +0 -0
  496. /package/{speed-lines.js → src/speed-lines.js} +0 -0
  497. /package/{spotlight.js → src/spotlight.js} +0 -0
  498. /package/{strikes.js → src/strikes.js} +0 -0
  499. /package/{super8.js → src/super8.js} +0 -0
  500. /package/{technicolor.js → src/technicolor.js} +0 -0
  501. /package/{tilt-shift.js → src/tilt-shift.js} +0 -0
  502. /package/{toy.js → src/toy.js} +0 -0
  503. /package/{valley-fog.js → src/valley-fog.js} +0 -0
  504. /package/{weather-map.js → src/weather-map.js} +0 -0
  505. /package/{white-model.js → src/white-model.js} +0 -0
@@ -0,0 +1,24 @@
1
+ // The barrel distortion and dark corners of a wide-angle lens, like those of FPV cameras: straight
2
+ // lines bend outward away from the middle. The corners stay in place and the middle is
3
+ // magnified, so the picture keeps filling the screen.
4
+ precision highp sampler2D;
5
+ uniform sampler2D colorTexture;
6
+ // 0 to 1
7
+ uniform float distortion;
8
+ uniform float vignette;
9
+ in vec2 v_textureCoordinates;
10
+
11
+ // strongest distortion: the middle magnified by 1 + this, relative to the corners
12
+ const float MAX_DISTORTION = 0.5;
13
+
14
+ void main() {
15
+ vec2 aspect = vec2(czm_viewport.z / czm_viewport.w, 1.0);
16
+ // from the middle, 1 at the corners
17
+ vec2 fromMiddle = (v_textureCoordinates - 0.5) * aspect / (0.5 * length(aspect));
18
+ float r2 = dot(fromMiddle, fromMiddle);
19
+ float k = distortion * MAX_DISTORTION;
20
+ vec2 uv = 0.5 + (v_textureCoordinates - 0.5) * (1.0 + k * r2) / (1.0 + k);
21
+ vec4 sceneColor = texture(colorTexture, uv);
22
+ float dark = 1.0 - vignette * smoothstep(0.3, 1.0, r2);
23
+ out_FragColor = vec4(sceneColor.rgb * dark, sceneColor.a);
24
+ }
@@ -0,0 +1,257 @@
1
+ // Lightning, cloud-to-ground strikes: a branching channel from the cloud base to the ground, with 2 to 4
2
+ // return strokes tens of milliseconds apart, down one channel, and a flash that follows their flicker, as
3
+ // in the descriptions of the lightning flash (Rakov and Uman, "Lightning: Physics and Effects", 2003). The
4
+ // channel is drawn over the picture in screen space as a hot core in a halo, at least a pixel and a half
5
+ // wide: a channel is centimeters wide, and a thousand meters away it would not show at its true width. It
6
+ // is a line from the cloud to the ground that wanders to either side, by value noise of the position along
7
+ // it in four octaves, pinned at both ends, with branches that leave it downward at an angle and wander the
8
+ // same way, fading toward their ends. The distance to it is the pixel's across the line, less the wander,
9
+ // over the slope of the wander, so that the width stays the same where it zigzags: a function of the
10
+ // position along the line, a handful of noise lookups for each channel, not a polyline for each pixel.
11
+ // The channel is hidden behind nearer terrain. The flash lights each pixel in proportion to its own color,
12
+ // less with its distance to the strike, and the sky toward the cloud above it. Seen from above the cloud
13
+ // base, the channel is hidden in the cloud, and the flash lights the cloud over the strike from inside, as
14
+ // a glow. Needs EyeFromDepth and Hash.
15
+ precision highp sampler2D;
16
+ const int STRIKES = 4;
17
+ const int BRANCHES = 5;
18
+ uniform sampler2D colorTexture;
19
+ uniform sampler2D depthTexture;
20
+ // the top of each strike's channel, at the cloud base, in eye coordinates, and its seed; and its foot
21
+ // and its age in seconds, negative when there is no strike in the slot
22
+ uniform vec4 strikeTop[STRIKES];
23
+ uniform vec4 strikeBottom[STRIKES];
24
+ // the branches of each strike's channel, from the CPU: where along the channel they leave it, the cosine
25
+ // and the sine of their angle from it, and their length as a share of the channel's, 0 for none
26
+ uniform vec4 strikeBranches[STRIKES * BRANCHES];
27
+ // the glow of each strike in the clouds, in eye coordinates, and the map's intensity at the strike,
28
+ // 0 for none; and 0 below the cloud base to 1 above it, where the glow replaces the channel
29
+ uniform vec4 strikeGlow[STRIKES];
30
+ uniform float above;
31
+ in vec2 v_textureCoordinates;
32
+
33
+ const int MAX_STROKES = 4;
34
+ // how far the main channel and the branches wander to either side, as a fraction of their length
35
+ const float MAIN_WANDER = 0.7;
36
+ const float BRANCH_WANDER = 0.6;
37
+ // the brightness of the branches against the main channel's
38
+ const float BRANCH_BRIGHTNESS = 0.5;
39
+ // how far from the line between its ends a channel reaches, as a fraction of its length: the main one's
40
+ // wander, then its branches; and the widest halo in pixels. Pixels farther than that skip the channel
41
+ const float MAIN_REACH = 0.35;
42
+ const float BRANCH_REACH = 0.5;
43
+ const float MAX_HALO = 80.0;
44
+ const float MAX_SLOPE = 2.5;
45
+ // the channel's flicker under which it is not drawn
46
+ const float FAINT = 0.01;
47
+ // the width of the core and of the halo, in meters: scaled to pixels by the distance, the core to no
48
+ // less than a pixel and a half
49
+ const float CORE_WIDTH = 1.0;
50
+ const float HALO_WIDTH = 25.0;
51
+ // how bright the halo is against the core
52
+ const float HALO = 0.35;
53
+ // the channel is white at its core and blue around it, from the nitrogen lines of a 30000 K plasma, with a
54
+ // violet cast from the hydrogen line of the water in a storm's air (Kieu et al., 2021)
55
+ const vec3 HALO_COLOR = vec3(0.68, 0.66, 1.0);
56
+ const vec3 FLASH_COLOR = vec3(0.8, 0.82, 1.0);
57
+ // the extinction of the light of a strike per meter, in red, green and blue: the scattering of the air goes
58
+ // with the wavelength to the minus 4, so far strikes turn yellow, then red, as at sunset
59
+ const vec3 EXTINCTION = vec3(1.0, 1.9, 3.4) * 2e-5;
60
+ // the distance, in meters, at which the flash on the land has fallen to half
61
+ const float FLASH_REACH = 3000.0;
62
+ // the sky is a ray this long
63
+ const float SKY_DISTANCE = 20000.0;
64
+ // time constants of the channel's flicker and of the flash, in seconds
65
+ const float BOLT_DECAY = 0.05;
66
+ const float FLASH_DECAY = 0.15;
67
+ // the glow in the clouds above a strike, seen from above: as wide as this, in meters, and as bright
68
+ const float GLOW_RADIUS = 4000.0;
69
+ const float GLOW_BRIGHTNESS = 0.9;
70
+ // seen from above, most of the way to the glow is through thin air: its light is dimmed by at most
71
+ // this many meters of the air near the ground, about the height over which the air thins by e
72
+ const float GLOW_AIR = 8000.0;
73
+
74
+ // noise of one coordinate, in [-0.5, 0.5), and its slope: linear between the random values of the whole
75
+ // numbers, not smoothed, so that the path is made of straight segments with sharp turns, as a bolt is
76
+ vec2 valueNoise(float x, float seed) {
77
+ float cell = floor(x);
78
+ float low = hash(vec2(cell, seed));
79
+ float high = hash(vec2(cell + 1.0, seed));
80
+ return vec2(mix(low, high, fract(x)) - 0.5, high - low);
81
+ }
82
+
83
+ // four octaves of it along a channel, from 4 segments to 34: the wander at s and its slope
84
+ vec2 wander(float s, float seed) {
85
+ vec2 sum = vec2(0.0);
86
+ float amplitude = 1.0;
87
+ float frequency = 4.0;
88
+ for (int i = 0; i < 4; i++) {
89
+ sum += amplitude * valueNoise(s * frequency, seed + 7.0 * float(i)) * vec2(1.0, frequency);
90
+ amplitude *= 0.45;
91
+ frequency *= 2.1;
92
+ }
93
+ return sum;
94
+ }
95
+
96
+ // how far a channel is from its line at s, in its lengths, and the slope of that: the wander held to 0
97
+ // at the start, by a smoothstep over the first quarter of a branch, and at both ends of the main
98
+ // channel, by a sine, so that it leaves the cloud and reaches the ground upright
99
+ vec2 offsetAt(float s, float seed, bool main) {
100
+ vec2 w = wander(s, seed);
101
+ float envelope = sin(czm_pi * s);
102
+ float slope = czm_pi * cos(czm_pi * s);
103
+ if (!main) {
104
+ float u = clamp(4.0 * s, 0.0, 1.0);
105
+ envelope = u * u * (3.0 - 2.0 * u);
106
+ slope = 24.0 * u * (1.0 - u);
107
+ }
108
+ return vec2(w.x * envelope, w.y * envelope + w.x * slope);
109
+ }
110
+
111
+ // the distance in pixels from p to a channel that leaves a along dir, len pixels long, and the share s
112
+ // of the way along it where p is nearest
113
+ float channelDistance(vec2 p, vec2 a, vec2 dir, float len, float amplitude, float seed, bool main, out float s) {
114
+ vec2 r = p - a;
115
+ float along = dot(r, dir);
116
+ s = clamp(along / len, 0.0, 1.0);
117
+ vec2 offset = offsetAt(s, seed, main);
118
+ float across = dot(r, vec2(-dir.y, dir.x)) - amplitude * len * offset.x;
119
+ // the estimate holds near the channel only: past a slope of a few, the halo of a steep segment would
120
+ // stretch sideways
121
+ float slope = clamp(amplitude * offset.y, -MAX_SLOPE, MAX_SLOPE);
122
+ // past the ends, the distance to the end
123
+ return length(vec2(across / sqrt(1.0 + slope * slope), along - s * len));
124
+ }
125
+
126
+ // the core and the halo of the channel at a distance in pixels
127
+ vec2 channelProfile(float d, float core, float halo) {
128
+ return vec2(exp(-d * d / (core * core)), HALO * exp(-d / halo));
129
+ }
130
+
131
+ // the light of a strike seen from this far, in each color
132
+ vec3 transmittance(float d) {
133
+ return exp(-EXTINCTION * d);
134
+ }
135
+
136
+ // the flicker of the channel and the light of the flash, at an age in seconds: each stroke lights it up
137
+ // at once and fades, the first one the brightest, and a dimmer current keeps the channel lit between them
138
+ void strokes(float age, float seed, out float bolt, out float flash) {
139
+ bolt = 0.3 * exp(-age / 0.3);
140
+ flash = 0.0;
141
+ float count = 2.0 + floor(3.0 * hash(vec2(seed, 91.0)));
142
+ float start = 0.0;
143
+ for (int i = 0; i < MAX_STROKES; i++) {
144
+ if (float(i) >= count) {
145
+ break;
146
+ }
147
+ float strength = i == 0 ? 1.0 : 0.35 + 0.5 * hash(vec2(seed, 50.0 + float(i)));
148
+ float since = age - start;
149
+ if (since >= 0.0) {
150
+ bolt += strength * exp(-since / BOLT_DECAY);
151
+ flash += strength * exp(-since / FLASH_DECAY);
152
+ }
153
+ start += 0.04 + 0.08 * hash(vec2(seed, 70.0 + float(i)));
154
+ }
155
+ }
156
+
157
+ vec2 screenPoint(vec3 eye) {
158
+ vec4 clip = czm_projection * vec4(eye, 1.0);
159
+ return (0.5 * clip.xy / clip.w + 0.5) * czm_viewport.zw;
160
+ }
161
+
162
+ // the distance from p to the segment ab
163
+ float segmentDistance(vec2 p, vec2 a, vec2 b) {
164
+ vec2 ab = b - a;
165
+ return length(p - a - ab * clamp(dot(p - a, ab) / dot(ab, ab), 0.0, 1.0));
166
+ }
167
+
168
+ void main() {
169
+ vec2 uv = v_textureCoordinates;
170
+ vec4 sceneColor = texture(colorTexture, uv);
171
+ vec3 color = sceneColor.rgb;
172
+ vec4 eye = eyeAt(depthTexture, uv);
173
+ float sceneDistance = eye.w > 0.0 ? length(eye.xyz) : 1e9;
174
+ vec3 pixelEye = eye.w > 0.0 ? eye.xyz : eye.xyz * SKY_DISTANCE;
175
+ vec2 pixel = uv * czm_viewport.zw;
176
+ // the focal length in pixels
177
+ float focal = 0.5 * czm_projection[1][1] * czm_viewport.w;
178
+
179
+ vec3 light = vec3(0.0);
180
+ vec3 channel = vec3(0.0);
181
+ for (int k = 0; k < STRIKES; k++) {
182
+ float age = strikeBottom[k].w;
183
+ if (age < 0.0) {
184
+ continue;
185
+ }
186
+ vec3 top = strikeTop[k].xyz;
187
+ vec3 bottom = strikeBottom[k].xyz;
188
+ float seed = strikeTop[k].w;
189
+ float bolt;
190
+ float flash;
191
+ strokes(age, seed, bolt, flash);
192
+
193
+ // the land around the foot of the strike, and the sky toward the cloud above it
194
+ float reach = distance(pixelEye, bottom) / FLASH_REACH;
195
+ float sky = eye.w > 0.0 ? 0.0 : pow(max(dot(eye.xyz, normalize(top)), 0.0), 6.0);
196
+ vec3 seen = transmittance(length(bottom));
197
+ light += FLASH_COLOR * seen * flash * (color * 1.2 + 0.08) / (1.0 + reach * reach);
198
+ light += FLASH_COLOR * seen * flash * sky * 0.5;
199
+
200
+ // seen from above, the flash lights the cloud over the strike from inside: a glow around the
201
+ // point of the view ray nearest to it, hidden behind nearer terrain
202
+ vec4 glow = strikeGlow[k];
203
+ float along = dot(glow.xyz, normalize(eye.xyz));
204
+ if (above > 0.0 && glow.w > 0.0 && along > 0.0 && sceneDistance > along * 0.98) {
205
+ float across = length(glow.xyz - normalize(eye.xyz) * along);
206
+ light += FLASH_COLOR * transmittance(min(along, GLOW_AIR)) * flash * glow.w * above * GLOW_BRIGHTNESS * exp(-across * across / (GLOW_RADIUS * GLOW_RADIUS));
207
+ }
208
+
209
+ // the channel, when both its ends are in front of the camera, and the pixel is near it
210
+ if (top.z > -1.0 || bottom.z > -1.0) {
211
+ continue;
212
+ }
213
+ vec2 a = screenPoint(top);
214
+ vec2 b = screenPoint(bottom);
215
+ float len = distance(a, b);
216
+ // the halo's widest reach, around the middle of the channel: pixels farther than that skip the channel
217
+ float margin = 3.0 * clamp(HALO_WIDTH * focal / length(0.5 * (top + bottom)), 4.0, MAX_HALO);
218
+ // the branches reach further from the line than the main channel's wander does
219
+ float fromLine = segmentDistance(pixel, a, b);
220
+ if (bolt < FAINT || len < 2.0 || fromLine > BRANCH_REACH * len + margin) {
221
+ continue;
222
+ }
223
+ vec2 dir = (b - a) / len;
224
+ float s = clamp(dot(pixel - a, dir) / len, 0.0, 1.0);
225
+ float boltDistance = length(mix(top, bottom, s));
226
+ float core = max(1.5, CORE_WIDTH * focal / boltDistance);
227
+ float halo = clamp(HALO_WIDTH * focal / boltDistance, 4.0, MAX_HALO);
228
+ vec2 profile = vec2(0.0);
229
+ if (fromLine < MAIN_REACH * len + margin) {
230
+ profile = channelProfile(channelDistance(pixel, a, dir, len, MAIN_WANDER, seed, true, s), core, halo);
231
+ }
232
+ for (int j = 0; j < BRANCHES; j++) {
233
+ vec4 branch = strikeBranches[k * BRANCHES + j];
234
+ float branchLen = len * branch.w;
235
+ if (branchLen <= 0.0) {
236
+ continue;
237
+ }
238
+ float at = branch.x;
239
+ vec2 branchDir = vec2(branch.y * dir.x - branch.z * dir.y, branch.z * dir.x + branch.y * dir.y);
240
+ // nowhere near the branch, which stays within its length and wander of its middle, and the main
241
+ // channel's wander of its line
242
+ vec2 onLine = a + dir * len * at;
243
+ if (distance(pixel, onLine + branchDir * 0.5 * branchLen) > (0.5 + 0.5 * BRANCH_WANDER) * branchLen + MAIN_REACH * len + margin) {
244
+ continue;
245
+ }
246
+ vec2 base = onLine + vec2(-dir.y, dir.x) * MAIN_WANDER * len * offsetAt(at, seed, true).x;
247
+ float along;
248
+ float branchDistance = channelDistance(pixel, base, branchDir, branchLen, BRANCH_WANDER, seed + 5.0 * float(j + 1), false, along);
249
+ profile = max(profile, BRANCH_BRIGHTNESS * (1.0 - 0.7 * along) * channelProfile(branchDistance, core, halo));
250
+ }
251
+ // hidden behind terrain nearer than the channel at this height
252
+ if (sceneDistance > boltDistance * 0.98 - 30.0) {
253
+ channel += (1.0 - above) * bolt * transmittance(boltDistance) * (profile.x + profile.y * HALO_COLOR);
254
+ }
255
+ }
256
+ out_FragColor = vec4(color + light + channel, sceneColor.a);
257
+ }
@@ -0,0 +1,71 @@
1
+ // Camera motion blur, after "A Reconstruction Filter for Plausible Motion Blur" (McGuire et al.,
2
+ // I3D 2012). Only the camera moves, so each pixel's motion follows from its depth and the
3
+ // reprojection into the previous frame, computed once per pixel into the velocity buffer of
4
+ // MotionBlurVelocity.glsl. The blur gathers jittered samples along the pixel's motion, weighted
5
+ // by depth so that near terrain and far ridges or sky do not smear into each other.
6
+ precision highp sampler2D;
7
+ uniform sampler2D colorTexture;
8
+ // xy: half the blur, as a fraction of the viewport; z: the distance from the camera
9
+ uniform sampler2D velocityTexture;
10
+ in vec2 v_textureCoordinates;
11
+
12
+ const int SAMPLES = 16;
13
+ // depth difference, relative to the depth, over which a sample goes from in front to behind
14
+ const float SOFT_DEPTH = 0.1;
15
+
16
+
17
+ // xy: half the blur of the pixel at uv, in pixels; z: its distance from the camera
18
+ vec3 halfBlurAt(vec2 uv) {
19
+ vec3 velocity = texture(velocityTexture, uv).xyz;
20
+ return vec3(velocity.xy * czm_viewport.zw, velocity.z);
21
+ }
22
+
23
+ // 1 when b is in front of a, 0 when it is SOFT_DEPTH behind
24
+ float inFront(float a, float b) {
25
+ return clamp(1.0 - (b - a) / (SOFT_DEPTH * min(a, b)), 0.0, 1.0);
26
+ }
27
+
28
+ // the blur of a pixel with this half blur covers a sample this far away; the extents are kept
29
+ // above 0 for samples without blur
30
+ float cone(float gap, vec2 halfBlur) {
31
+ return clamp(1.0 - gap / max(length(halfBlur), 1e-3), 0.0, 1.0);
32
+ }
33
+
34
+ // both pixels are blurred over the gap between them
35
+ float cylinder(float gap, vec2 halfBlur) {
36
+ float extent = max(length(halfBlur), 1e-3);
37
+ return 1.0 - smoothstep(0.95 * extent, 1.05 * extent, gap);
38
+ }
39
+
40
+ void main() {
41
+ vec3 center = halfBlurAt(v_textureCoordinates);
42
+ vec2 halfBlur = center.xy;
43
+ vec4 centerColor = texture(colorTexture, v_textureCoordinates);
44
+ float extent = length(halfBlur);
45
+ if (extent < 0.5) {
46
+ out_FragColor = centerColor;
47
+ return;
48
+ }
49
+
50
+ float weight = 1.0 / extent;
51
+ vec4 color = centerColor * weight;
52
+ // the jitter turns the banding of few samples into fine noise
53
+ float jitter = pixelNoise(gl_FragCoord.xy) - 0.5;
54
+ for (int i = 0; i < SAMPLES; i++) {
55
+ float t = mix(-1.0, 1.0, (float(i) + jitter + 1.0) / float(SAMPLES + 1));
56
+ vec2 uv = v_textureCoordinates + t * halfBlur / czm_viewport.zw;
57
+ vec3 other = halfBlurAt(uv);
58
+ float gap = abs(t) * extent;
59
+ float front = inFront(center.z, other.z);
60
+ float behind = inFront(other.z, center.z);
61
+ // a sample in front counts when its own blur reaches this pixel, one behind when this
62
+ // pixel's blur reaches it, and both when they are blurred together
63
+ float alpha =
64
+ front * cone(gap, other.xy) +
65
+ behind * cone(gap, halfBlur) +
66
+ 2.0 * cylinder(gap, other.xy) * cylinder(gap, halfBlur);
67
+ weight += alpha;
68
+ color += alpha * texture(colorTexture, uv);
69
+ }
70
+ out_FragColor = color / weight;
71
+ }
@@ -0,0 +1,31 @@
1
+ // The velocity buffer of the motion blur, at a fraction of the resolution: each pixel's half
2
+ // blur, as a fraction of the viewport, and its distance from the camera. Computed once per
3
+ // pixel here rather than once per sample in the gather. Needs EyeFromDepth.
4
+ precision highp sampler2D;
5
+ uniform sampler2D depthTexture;
6
+ // current eye coordinates to the previous frame's clip coordinates, computed in double
7
+ // precision on the CPU
8
+ uniform mat4 reprojection;
9
+ // exposure time over the time since the previous frame: the blur spans the motion during the
10
+ // exposure, whatever the frame rate
11
+ uniform float exposureScale;
12
+ in vec2 v_textureCoordinates;
13
+
14
+ // longest blur, as a fraction of the viewport height
15
+ const float MAX_BLUR = 0.05;
16
+
17
+ void main() {
18
+ // the sky is a direction: only the camera rotation moves it
19
+ vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
20
+ vec4 previous = reprojection * eye;
21
+ vec2 motion = previous.w > 0.0 ? v_textureCoordinates - (previous.xy / previous.w * 0.5 + 0.5) : vec2(0.0);
22
+ motion *= exposureScale;
23
+ // the clamp is resolution independent: the ratio to the viewport height is the same at any scale
24
+ vec2 pixels = motion * czm_viewport.zw;
25
+ float extent = length(pixels);
26
+ float maxExtent = MAX_BLUR * czm_viewport.w;
27
+ if (extent > maxExtent) {
28
+ motion *= maxExtent / extent;
29
+ }
30
+ out_FragColor = vec4(0.5 * motion, eye.w == 0.0 ? 1e30 : length(eye.xyz), 1.0);
31
+ }
@@ -0,0 +1,43 @@
1
+ // random gradient in [-1, 1] at a lattice point
2
+ vec3 gradient(vec3 p) {
3
+ p = fract(p * vec3(0.1031, 0.1030, 0.0973));
4
+ p += dot(p, p.yxz + 33.33);
5
+ return fract((p.xxy + p.yxx) * p.zyx) * 2.0 - 1.0;
6
+ }
7
+
8
+ // gradient noise, about -0.7 to 0.7. After prod80's ReShade Film Grain (MIT), with gradients
9
+ // from a hash instead of a texture
10
+ float gradientNoise(vec3 p) {
11
+ vec3 i = floor(p);
12
+ vec3 f = fract(p);
13
+ vec3 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
14
+ return mix(
15
+ mix(
16
+ mix(dot(gradient(i), f), dot(gradient(i + vec3(1.0, 0.0, 0.0)), f - vec3(1.0, 0.0, 0.0)), u.x),
17
+ mix(dot(gradient(i + vec3(0.0, 1.0, 0.0)), f - vec3(0.0, 1.0, 0.0)), dot(gradient(i + vec3(1.0, 1.0, 0.0)), f - vec3(1.0, 1.0, 0.0)), u.x),
18
+ u.y),
19
+ mix(
20
+ mix(dot(gradient(i + vec3(0.0, 0.0, 1.0)), f - vec3(0.0, 0.0, 1.0)), dot(gradient(i + vec3(1.0, 0.0, 1.0)), f - vec3(1.0, 0.0, 1.0)), u.x),
21
+ mix(dot(gradient(i + vec3(0.0, 1.0, 1.0)), f - vec3(0.0, 1.0, 1.0)), dot(gradient(i + vec3(1.0, 1.0, 1.0)), f - vec3(1.0, 1.0, 1.0)), u.x),
22
+ u.y),
23
+ u.z);
24
+ }
25
+
26
+ // random gradient in [-1, 1] at a lattice point of the plane, for a seed
27
+ vec2 gradient(vec2 p, float seed) {
28
+ vec3 p3 = fract(vec3(p, seed) * vec3(0.1031, 0.1030, 0.0973));
29
+ p3 += dot(p3, p3.yxz + 33.33);
30
+ return fract((p3.xx + p3.yz) * p3.zy) * 2.0 - 1.0;
31
+ }
32
+
33
+ // gradient noise over the plane, about -0.7 to 0.7, a new pattern for each seed: half the
34
+ // hashes of the volume's, for a pattern that only has to change by whole frames
35
+ float gradientNoise(vec2 p, float seed) {
36
+ vec2 i = floor(p);
37
+ vec2 f = fract(p);
38
+ vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
39
+ return mix(
40
+ mix(dot(gradient(i, seed), f), dot(gradient(i + vec2(1.0, 0.0), seed), f - vec2(1.0, 0.0)), u.x),
41
+ mix(dot(gradient(i + vec2(0.0, 1.0), seed), f - vec2(0.0, 1.0)), dot(gradient(i + vec2(1.0, 1.0), seed), f - vec2(1.0, 1.0)), u.x),
42
+ u.y);
43
+ }
@@ -0,0 +1,21 @@
1
+ // normal at the pixel from its neighbors at this distance in pixels: on each axis the nearer
2
+ // side, so that the edges of the scene do not bend it
3
+ precision highp sampler2D;
4
+ vec3 normalAt(sampler2D depthTexture, vec2 uv, vec3 center, float distance) {
5
+ vec2 step = distance / czm_viewport.zw;
6
+ vec3 right = eyeAt(depthTexture, uv + vec2(step.x, 0.0)).xyz - center;
7
+ vec3 left = center - eyeAt(depthTexture, uv - vec2(step.x, 0.0)).xyz;
8
+ vec3 above = eyeAt(depthTexture, uv + vec2(0.0, step.y)).xyz - center;
9
+ vec3 below = center - eyeAt(depthTexture, uv - vec2(0.0, step.y)).xyz;
10
+ vec3 dx = dot(right, right) < dot(left, left) ? right : left;
11
+ vec3 dy = dot(above, above) < dot(below, below) ? above : below;
12
+ vec3 normal = normalize(cross(dx, dy));
13
+ // toward the camera
14
+ return normal * sign(dot(normal, -center));
15
+ }
16
+
17
+ // the terrain mesh is made of flat triangles, and so are the normals from the depth buffer:
18
+ // averaged over several distances, the facets blend into a smoother surface
19
+ vec3 smoothNormalAt(sampler2D depthTexture, vec2 uv, vec3 center) {
20
+ return normalize(normalAt(depthTexture, uv, center, 2.0 * czm_pixelRatio) + normalAt(depthTexture, uv, center, 6.0 * czm_pixelRatio));
21
+ }
@@ -0,0 +1,6 @@
1
+ // Henyey-Greenstein's phase function, normalized: 1 / (4 pi) for light scattered alike in all
2
+ // directions, which the haze and the clouds share.
3
+ float henyeyGreenstein(float cosTheta, float g) {
4
+ float g2 = g * g;
5
+ return (1.0 - g2) / (4.0 * czm_pi * pow(1.0 + g2 - 2.0 * g * cosTheta, 1.5));
6
+ }
@@ -0,0 +1,199 @@
1
+ // Precipitation, rain or snow: streaks of falling drops in four layers, nearer ones larger, faster
2
+ // and more opaque, in one pass over the scene, after the composite rainfall of ToyShop (Tatarchuk
3
+ // 2006). The drops are laid out on the sphere of view directions, around the direction they fall
4
+ // toward: drops falling along parallel lines appear on great circles through it, so in its Mercator
5
+ // coordinates (the angle around it, and log(tan(theta / 2)) of the angle theta from it) the drops
6
+ // of a layer, at one distance, are a regular grid scrolling at a constant rate: their size and
7
+ // speed on the sphere both go with sin(theta). The streaks fall down the screen at the horizon and
8
+ // radiate from below the camera when it looks down. The drops are hidden behind what is nearer than
9
+ // their layer, and the rain veils the distance in an overcast haze, whose light the drops refract,
10
+ // and in shafts of heavier rain hanging below the cloud base. The wind comes in gusts. The snow,
11
+ // from 0 to 1, turns the rain to snow in one population: the drops slow down from 9 m/s to 1 m/s,
12
+ // which shortens their streak, and grow from thin sharp lines into soft round flakes that flutter,
13
+ // the nearest layer out of focus as in Andrew Baldwin's "Just snow", in a thicker, whiter haze.
14
+ // Where it rains comes from the map: the shafts and the share of each ray in the rain from the
15
+ // shafts' pass, the drops from the map's intensity at the camera, read on the CPU. The haze's length
16
+ // below the cloud base is this pass's, from each pixel's depth, sharp at the ridges. Seen from
17
+ // above, where Clouds draws the clouds, they hide the rain under them: no shafts nor haze.
18
+ // Needs EyeFromDepth, Hash, Height, PrecipitationWind, Fog, Phase and RainHaze.
19
+ precision highp sampler2D;
20
+ const int LAYERS = 4;
21
+ uniform sampler2D colorTexture;
22
+ uniform sampler2D depthTexture;
23
+ // the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain
24
+ // in the sun, from PrecipitationShafts.glsl at a fraction of the resolution
25
+ uniform sampler2D shaftTexture;
26
+ // 1 when Clouds draws the clouds, 0 otherwise
27
+ uniform float clouds;
28
+ // 1 when their shadow map lights the haze, 0 otherwise
29
+ uniform float shadowed;
30
+ // the map's intensity at the camera, 0 to 1
31
+ uniform float localIntensity;
32
+ // from the CPU, as they change with the snow: the length of a drop's trail, its motion over the
33
+ // exposure, in cells, and the scroll of the grid along the fall, in cells, wrapped at PERIOD, which
34
+ // has to follow the speed without a jump
35
+ uniform float trail;
36
+ uniform float offset;
37
+ // what the layers share, from the CPU rather than computed for each pixel: the cells around and
38
+ // along the fall per radian, the number of cells around, and the distance in meters; and the
39
+ // brightness, how far the largest drop's shape reaches around its trail in pixels, the radius of a
40
+ // streak and the radius of the largest flake in pixels
41
+ uniform vec4 layerShape[LAYERS];
42
+ uniform vec4 layerLook[LAYERS];
43
+ in vec2 v_textureCoordinates;
44
+
45
+ // cells along the fall, for the random drops to repeat seamlessly as they scroll
46
+ const float PERIOD = 1000.0;
47
+ // the nearest layer is 2 m away, each further layer twice as far; at the horizon, a drop every
48
+ // 0.05 rad around
49
+ const float NEAREST = 2.0;
50
+ // share of the cells with a drop, at full intensity
51
+ const float DENSITY = 0.6;
52
+ // a drop is a capsule from a point in its cell, its trail within a cell: the cells are taller than
53
+ // wide in the rain, square in the snow
54
+ // how far a flake flutters across its cell, in cells, and a streak wavers in the gusts
55
+ const float FLUTTER = 0.12;
56
+ const float WAVER = 0.08;
57
+ // the drops refract the haze's light, whiter than they would, as the milk film crews add to the
58
+ // water, for rain that shows; the flakes scatter it, near white
59
+ const float RAIN_MILK = 0.25;
60
+ const float SNOW_MILK = 0.35;
61
+ // the shafts' shade of the haze: darker in the rain, lighter in the snow
62
+ const float RAIN_SHAFT_SHADE = 0.75;
63
+ const float SNOW_SHAFT_SHADE = 1.1;
64
+ // the shafts' resolution, precipitation.js's SHAFT_SCALE
65
+ const float SHAFT_SCALE = 0.125;
66
+
67
+ // the shafts' opacity, the ray's extinction, the share of it in the rain and the share of the rain
68
+ // in the sun, blurred by PrecipitationShaftBlur.glsl and upsampled bilinearly from their texture,
69
+ // which is read at its nearest texel
70
+ vec4 shafts() {
71
+ // the size Cesium gives the texture
72
+ vec2 size = ceil(czm_viewport.zw * SHAFT_SCALE);
73
+ vec2 p = v_textureCoordinates * size - 0.5;
74
+ vec2 i = floor(p);
75
+ vec2 f = p - i;
76
+ vec2 center = (i + 0.5) / size;
77
+ vec2 texel = 1.0 / size;
78
+ vec4 bottom = mix(texture(shaftTexture, center), texture(shaftTexture, center + vec2(texel.x, 0.0)), f.x);
79
+ vec4 top = mix(texture(shaftTexture, center + vec2(0.0, texel.y)), texture(shaftTexture, center + texel), f.x);
80
+ return mix(bottom, top, f.y);
81
+ }
82
+
83
+ // the opacity at the pixel of the drop with its head in the cell `back` cells above its own, if it
84
+ // has one: f is the pixel's place in its own cell. The drop morphs from a thin, sharp, long streak
85
+ // to a round, soft, short flake with the snow: its radius and softness, brightness and flutter.
86
+ float drop(vec4 look, float index, float count, float density, float streak, float amplitude, vec2 reach, vec2 pixelCells, vec2 cell, vec2 f, float back) {
87
+ vec2 id = vec2(mod(cell.x, count), mod(cell.y - back, PERIOD) + PERIOD * index);
88
+ float h = hash(id);
89
+ if (h >= density) {
90
+ return 0.0;
91
+ }
92
+ // the drop's random values, from the one hash: uniform in [0, 1) for the cells with a drop; its
93
+ // head somewhere in the middle of its cell, and the pixel's place around its trail
94
+ h /= density;
95
+ vec2 head = vec2(0.25 + 0.5 * fract(h * 13.7), 0.25 + 0.5 * fract(h * 71.3));
96
+ vec2 toHead = vec2(f.x, f.y + back) - head;
97
+ // most drops are nowhere near the pixel: the rest of the shape is for the few that are
98
+ if (abs(toHead.x) > amplitude + reach.x || toHead.y < -reach.y || toHead.y > streak + reach.y) {
99
+ return 0.0;
100
+ }
101
+ // wavering in the gusts or fluttering across the cell at its own rate
102
+ float rate = mix(1.7, 1.0 + 2.0 * fract(h * 5.1), snow);
103
+ toHead.x -= amplitude * sin(rate * time + czm_twoPi * fract(h * 7.3));
104
+ float t = streak > 0.0 ? clamp(toHead.y / streak, 0.0, 1.0) : 0.0;
105
+ // the distance to the trail, in pixels
106
+ float distanceToTrail = length(vec2(toHead.x, toHead.y - t * streak) / pixelCells);
107
+ float radius = mix(look.z, look.w * (0.6 + 0.8 * fract(h * 3.7)), snow);
108
+ // the nearest layer's flakes out of focus, soft and wide; the others sharp
109
+ float soft = mix(0.5, index == 0.0 ? 0.8 * radius : 0.5, snow);
110
+ float coverage = 1.0 - smoothstep(radius - soft, radius + soft, distanceToTrail);
111
+ // fading out along a streak, not along a flake
112
+ float taper = mix(1.0, 4.0 * t * (1.0 - t), streak);
113
+ return look.x * (0.55 + 0.45 * fract(h * 37.1)) * coverage * taper;
114
+ }
115
+
116
+ void main() {
117
+ vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
118
+ // the pixel's view direction and distance, the sky far away, and the angle a pixel covers
119
+ vec4 eye = eyeAt(depthTexture, v_textureCoordinates);
120
+ vec3 view = normalize(eye.xyz);
121
+ float sceneDistance = eye.w == 0.0 ? SKY_DISTANCE : length(eye.xyz);
122
+ float pixel = 2.0 / (czm_projection[1][1] * czm_viewport.w);
123
+
124
+ // the local frame at the camera, in world coordinates
125
+ vec3 upWorld = upWC();
126
+ vec3 eastWorld = eastWC();
127
+ vec3 northWorld = cross(upWorld, eastWorld);
128
+ float tilt = gustingTilt();
129
+
130
+ // none above the cloud base; as hard as it rains at the camera
131
+ float raining = 1.0 - smoothstep(cloudBase - 50.0, cloudBase + 50.0, cameraHeight);
132
+
133
+ // the haze over the part of the ray below the cloud base, as rainy as the shafts' pass found it,
134
+ // from the rain's to the snow's color; from above, hidden by the clouds where Clouds draws them
135
+ vec2 below = belowHeight(view * sceneDistance, cloudBase);
136
+ vec4 sampled = shafts();
137
+ vec3 shaft = sampled.xyz * (1.0 - clouds * (1.0 - raining));
138
+ // the rain's, in its bands, and the clear air's and the mist's over the share of the ray in the
139
+ // rain, thinning out with the height, summed in optical depth
140
+ float rainLength = (below.y - below.x) * sceneDistance;
141
+ float h0 = heightAt(view * sceneDistance * below.x);
142
+ float h1 = heightAt(view * sceneDistance * below.y);
143
+ float layers = layerDepth(CLEAR_AIR, h0, h1, rainLength) + layerDepth(MIST, h0, h1, rainLength);
144
+ float haze = rainHaze(rainLength * shaft.y * (1.0 + RAIN_BANDS) * rainExtinction(intensity, snow) + shaft.z * layers);
145
+ // a rain cell seen from a dry spot is still under its own clouds
146
+ float overcast = max(localIntensity, min(shaft.y * (1.0 + RAIN_BANDS), 1.0));
147
+ // the sun through the gaps of the clouds, from their shadow map, or as much as the overcast lets
148
+ float sunlit = shadowed > 0.0 ? sampled.w : 1.0 - overcast;
149
+ vec3 hazeColor = rainHazeColor(view, daylight(), snow, overcast, sunlit);
150
+ vec3 color = mix(sceneColor.rgb, hazeColor, haze);
151
+
152
+ color = mix(color, min(mix(RAIN_SHAFT_SHADE, SNOW_SHAFT_SHADE, snow) * hazeColor, vec3(1.0)), shaft.x);
153
+ float local = intensity * localIntensity;
154
+ // in eye coordinates: the direction the drops fall toward, tilted toward the east by the wind,
155
+ // and north across it
156
+ vec3 fall = czm_viewRotation * (sin(tilt) * eastWorld - cos(tilt) * upWorld);
157
+ vec3 north = czm_viewRotation * northWorld;
158
+ vec3 across = normalize(north - dot(north, fall) * fall);
159
+ vec3 dropColor = min(hazeColor + mix(RAIN_MILK, SNOW_MILK, snow), vec3(1.0));
160
+
161
+ float cosTheta = dot(view, fall);
162
+ float sinTheta = sqrt(max(1.0 - cosTheta * cosTheta, 0.0));
163
+ // none toward the poles, where the cells shrink below a pixel
164
+ if (raining > 0.0 && local > 0.0 && sinTheta > 0.01) {
165
+ float around = atan(dot(view, cross(fall, across)), dot(view, across));
166
+ float along = log(sinTheta / max(1.0 + cosTheta, 1e-6));
167
+ float density = DENSITY * local;
168
+ float streak = trail;
169
+ float amplitude = mix(WAVER, FLUTTER, snow);
170
+ // a pixel in radians, around the pole of the fall, where cells shrink
171
+ float pixelOverSin = pixel / sinTheta;
172
+ float brightness = raining * (0.5 + 0.5 * local);
173
+ for (int i = 0; i < LAYERS; i++) {
174
+ vec4 shape = layerShape[i];
175
+ // hidden behind what is nearer than the layer
176
+ float depthFade = smoothstep(0.5, 1.0, sceneDistance / shape.w);
177
+ // a pixel in cells; the layer fades out as its cells get a few pixels wide
178
+ vec2 pixelCells = pixelOverSin * shape.xy;
179
+ float fade = brightness * depthFade * (1.0 - smoothstep(0.15, 0.4, pixelCells.x));
180
+ if (fade <= 0.0) {
181
+ continue;
182
+ }
183
+ float index = float(i);
184
+ vec2 p = vec2(around * shape.x, along * shape.y + offset + 0.37 * index);
185
+ vec2 cell = floor(p);
186
+ vec2 f = p - cell;
187
+ vec4 look = layerLook[i];
188
+ vec2 reach = look.y * pixelCells;
189
+ // the drops with their head in the pixel's cell, and in the cell above, whose trail or soft
190
+ // edge may reach into it
191
+ float alpha = drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 0.0);
192
+ if (f.y <= streak) {
193
+ alpha = 1.0 - (1.0 - alpha) * (1.0 - drop(look, index, shape.z, density, streak, amplitude, reach, pixelCells, cell, f, 1.0));
194
+ }
195
+ color = mix(color, dropColor, alpha * fade);
196
+ }
197
+ }
198
+ out_FragColor = vec4(color, sceneColor.a);
199
+ }