@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
@@ -1,10 +1,10 @@
1
- import {Cartesian3, Cartesian4, Color, FixedFrameTransforms, Matrix4, Math as CesiumMath} from '@cesium/core';
1
+ import {Cartesian3, Cartesian4, Color, Math as CesiumMath} from '@cesium/core';
2
2
  import {PostProcessStage} from '@cesium/engine';
3
3
  import {acquireTerrainDepth, releaseTerrainDepth} from './depth-test.js';
4
4
  import Effect from './effect.js';
5
5
  import {acquireFrames, releaseFrames} from './frame-clock.js';
6
6
  import {heightUniforms} from './height.js';
7
- import {localFromEye} from './local-frame.js';
7
+ import {LocalFrame} from './local-frame.js';
8
8
  import EyeFromDepth from './shaders/EyeFromDepth.js';
9
9
  import Hash from './shaders/Hash.js';
10
10
  import Height from './shaders/Height.js';
@@ -28,10 +28,11 @@ export default class RainRings extends Effect {
28
28
  /**
29
29
  * @param {import('@cesium/engine').CesiumWidget} viewer
30
30
  * @param {{intensity?: number, cell?: number, reach?: number, waterLevel?: number, maxSlope?: number, rate?: number,
31
- * color?: Color, origin?: Cartesian3}} [options] The share of the cells that have a drop, 0 to 1; the cell's size and the ring's growth
32
- * on the ground, in meters (the ring on water is clipped at 0.3 cell); the water's height above the ellipsoid, in meters, or undefined
33
- * for none; the steepest slope that takes a ring, in degrees; rings a second in a cell; the ring's color, its alpha how strongly it shows; the
34
- * point of the world the cells are laid about.
31
+ * color?: Color, origin?: Cartesian3, clock?: () => number}} [options] The share of the cells that have a drop, 0 to 1; the cell's size
32
+ * and the ring's growth on the ground, in meters (the ring on water is clipped at 0.3 cell); the water's height above the ellipsoid, in
33
+ * meters, or undefined for none; the steepest slope that takes a ring, in degrees; rings a second in a cell; the ring's color, its alpha how
34
+ * strongly it shows; the point of the world the cells are laid about; the time the rings run by, in seconds (the wall clock's by default;
35
+ * one that stands still keeps them still, for a viewer who asks for less motion).
35
36
  */
36
37
  constructor(viewer, options = {}) {
37
38
  super(viewer);
@@ -42,23 +43,9 @@ export default class RainRings extends Effect {
42
43
  this.maxSlope_ = options.maxSlope ?? 30;
43
44
  this.rate_ = options.rate ?? 1.6;
44
45
  this.color_ = options.color ?? new Color(0.31, 0.39, 0.5, 0.6);
45
- this.origin_ = options.origin && Cartesian3.clone(options.origin);
46
- /** @type {Matrix4 | undefined} */
47
- this.localFrame_ = undefined;
46
+ this.frame_ = new LocalFrame(options.origin);
47
+ this.clock_ = options.clock ?? (() => performance.now() / 1000);
48
48
  this.colorScratch_ = new Cartesian4();
49
- this.localScratch_ = new Matrix4();
50
- }
51
-
52
- /**
53
- * The local frame, east-north-up about the origin: the camera's position when the effect is activated, if none was given.
54
- * @private
55
- * @param {import('@cesium/engine').Scene} scene
56
- */
57
- frameAt_(scene) {
58
- this.origin_ ??= Cartesian3.clone(scene.camera.positionWC);
59
- const frame = this.localFrame_ ?? FixedFrameTransforms.eastNorthUpToFixedFrame(this.origin_, scene.ellipsoid, new Matrix4());
60
- this.localFrame_ = frame;
61
- return frame;
62
49
  }
63
50
 
64
51
  /**
@@ -70,14 +57,14 @@ export default class RainRings extends Effect {
70
57
  fragmentShader: EyeFromDepth + Height + Hash + Normal + RainRingsShader,
71
58
  uniforms: {
72
59
  ...heightUniforms(scene),
73
- localFromEye: () => localFromEye(this.frameAt_(scene), scene.camera.viewMatrix, this.localScratch_),
60
+ localFromEye: () => this.frame_.fromEye(scene),
74
61
  intensity: () => this.intensity_,
75
62
  cell: () => this.cell_,
76
63
  reach: () => this.reach_,
77
64
  waterLevel: () => this.waterLevel_ ?? NO_WATER,
78
65
  maxSlope: () => CesiumMath.toRadians(this.maxSlope_),
79
66
  rate: () => this.rate_,
80
- time: () => (performance.now() / 1000) % TIME_PERIOD,
67
+ time: () => this.clock_() % TIME_PERIOD,
81
68
  color: () => Cartesian4.fromColor(this.color_, this.colorScratch_),
82
69
  },
83
70
  });
@@ -91,7 +78,7 @@ export default class RainRings extends Effect {
91
78
  * @param {import('@cesium/engine').Scene} scene
92
79
  */
93
80
  activated_(scene) {
94
- this.frameAt_(scene);
81
+ this.frame_.anchor(scene);
95
82
  acquireTerrainDepth(scene);
96
83
  if (this.intensity_ > 0) {
97
84
  acquireFrames(scene, FRAME_RATE);
@@ -204,12 +191,11 @@ export default class RainRings extends Effect {
204
191
  * the effect is activated if none is given. Keep it within a few kilometers of what is looked at.
205
192
  */
206
193
  get origin() {
207
- return this.origin_;
194
+ return this.frame_.origin;
208
195
  }
209
196
 
210
197
  set origin(value) {
211
- this.origin_ = value && Cartesian3.clone(value);
212
- this.localFrame_ = undefined;
198
+ this.frame_.origin = value;
213
199
  this.viewer.scene.requestRender();
214
200
  }
215
201
  }
@@ -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
+ }