@cesium/engine 9.2.0 → 10.1.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 (301) hide show
  1. package/Build/Workers/{chunk-GOQEANLM.js → chunk-2GEAGYUY.js} +13 -13
  2. package/Build/Workers/{chunk-WOYQB5HM.js → chunk-2J3JKXCP.js} +5 -5
  3. package/Build/Workers/{chunk-IXYFH7DV.js → chunk-3WUV74WM.js} +2 -2
  4. package/Build/Workers/{chunk-WHDEZSAL.js → chunk-4MSUJ4I7.js} +8 -8
  5. package/Build/Workers/chunk-4RMIRG6T.js +1800 -0
  6. package/Build/Workers/{chunk-CVCVMOQA.js → chunk-4VFBBNQ3.js} +1 -1
  7. package/Build/Workers/{chunk-ZHJDE6JN.js → chunk-4YSNMHZ4.js} +6 -6
  8. package/Build/Workers/{chunk-YGNQJ4YI.js → chunk-5BLJ5ZM6.js} +5 -5
  9. package/Build/Workers/{chunk-4RG6WOXH.js → chunk-5KWHSZYL.js} +11 -11
  10. package/Build/Workers/{chunk-BBBTT36L.js → chunk-5O6JWQ4E.js} +14 -14
  11. package/Build/Workers/{chunk-GX2BWBN2.js → chunk-65MZOUNU.js} +14 -14
  12. package/Build/Workers/{chunk-K5F23SZO.js → chunk-6D66DPRV.js} +7 -7
  13. package/Build/Workers/{chunk-2TRB253J.js → chunk-6OFDHMHR.js} +7 -7
  14. package/Build/Workers/{chunk-U6MTSO6A.js → chunk-76BYYG7N.js} +424 -449
  15. package/Build/Workers/{chunk-3PV5HQ2R.js → chunk-A5CODJ4M.js} +6 -6
  16. package/Build/Workers/{chunk-IF2OX6R4.js → chunk-AA4GZKOT.js} +1 -1
  17. package/Build/Workers/{chunk-OYP23VAL.js → chunk-ACRTCBN5.js} +11 -11
  18. package/Build/Workers/chunk-B75IEX2S.js +390 -0
  19. package/Build/Workers/{chunk-EODIOQ35.js → chunk-BAVI3ZS2.js} +1 -1
  20. package/Build/Workers/{chunk-CFBGPZU6.js → chunk-BBDZYSZB.js} +10 -10
  21. package/Build/Workers/{chunk-LZFFO4KB.js → chunk-BGE4QVG7.js} +12 -12
  22. package/Build/Workers/chunk-BY3E4ONI.js +456 -0
  23. package/Build/Workers/{chunk-RDR4KVPA.js → chunk-C3Z23UUJ.js} +18 -18
  24. package/Build/Workers/{chunk-I6CW7ZE5.js → chunk-C45MU4GZ.js} +10 -8
  25. package/Build/Workers/chunk-CF7P7K7E.js +684 -0
  26. package/Build/Workers/{chunk-KTZK2UDR.js → chunk-D2U4RI64.js} +7 -7
  27. package/Build/Workers/{chunk-QZIWFSRM.js → chunk-D4K27X2M.js} +4 -4
  28. package/Build/Workers/{chunk-UYKG3UFK.js → chunk-DKVHRNFY.js} +5 -5
  29. package/Build/Workers/{chunk-5OK5JFDP.js → chunk-EB7PNZTK.js} +5 -5
  30. package/Build/Workers/{chunk-7PFZ4Z7C.js → chunk-ELI4BUOT.js} +11 -9
  31. package/Build/Workers/chunk-F3NDOSTZ.js +963 -0
  32. package/Build/Workers/{chunk-3VDHTBY5.js → chunk-FDCLACT5.js} +10 -10
  33. package/Build/Workers/{chunk-BNT2SNWU.js → chunk-FEVVHITK.js} +4 -4
  34. package/Build/Workers/{chunk-7HLZRYGD.js → chunk-FOZWUH4T.js} +7 -7
  35. package/Build/Workers/chunk-FQPSOOPH.js +258 -0
  36. package/Build/Workers/{chunk-A5CSB5ZE.js → chunk-G5V4GPZE.js} +9 -9
  37. package/Build/Workers/{chunk-TDIGL45B.js → chunk-GNHZH7HP.js} +1 -1
  38. package/Build/Workers/{chunk-26NE4LRW.js → chunk-GPJR7MPQ.js} +11 -8
  39. package/Build/Workers/chunk-GWT64LKY.js +171 -0
  40. package/Build/Workers/{chunk-PUQR43HZ.js → chunk-HGEEOMSC.js} +6 -6
  41. package/Build/Workers/{chunk-SC3TBKST.js → chunk-I2RC4XVN.js} +4 -4
  42. package/Build/Workers/chunk-IUROUBPA.js +300 -0
  43. package/Build/Workers/{chunk-G7IAO7CW.js → chunk-J7MQUQJY.js} +7 -7
  44. package/Build/Workers/chunk-JNLWLSTP.js +476 -0
  45. package/Build/Workers/{chunk-TP4FFUAH.js → chunk-JYQNWIQQ.js} +2 -2
  46. package/Build/Workers/{chunk-RRUO4QEK.js → chunk-KUN2ZA5X.js} +4 -4
  47. package/Build/Workers/chunk-KV4EQHK4.js +1477 -0
  48. package/Build/Workers/chunk-LSSWVB2X.js +138 -0
  49. package/Build/Workers/{chunk-EJZVBTX4.js → chunk-LXQ5QAEJ.js} +6 -6
  50. package/Build/Workers/chunk-MBZH7YZ7.js +945 -0
  51. package/Build/Workers/{chunk-WP3LCUOE.js → chunk-MKXWJTFQ.js} +13 -13
  52. package/Build/Workers/{chunk-AROLUUGS.js → chunk-MMV6TO3P.js} +2 -2
  53. package/Build/Workers/{chunk-ETC45PHH.js → chunk-MSKXMXJI.js} +4 -4
  54. package/Build/Workers/chunk-N4QEHO3U.js +75 -0
  55. package/Build/Workers/chunk-NVOABL76.js +100 -0
  56. package/Build/Workers/chunk-OAPA2RTG.js +239 -0
  57. package/Build/Workers/{chunk-PHT53MCH.js → chunk-OE4MCOC7.js} +13 -13
  58. package/Build/Workers/chunk-OJF4RTJG.js +634 -0
  59. package/Build/Workers/{chunk-UICVDDCQ.js → chunk-OOK53QUQ.js} +1 -1
  60. package/Build/Workers/{chunk-W4OS542B.js → chunk-OOMCT7OL.js} +13 -13
  61. package/Build/Workers/{chunk-YGTWKLFY.js → chunk-OWGTMVDB.js} +19 -19
  62. package/Build/Workers/{chunk-GUFV24F4.js → chunk-OXALEQPI.js} +61 -17
  63. package/Build/Workers/chunk-OXSI7N4C.js +768 -0
  64. package/Build/Workers/{chunk-26XJDV3D.js → chunk-PNFHVBSF.js} +15 -15
  65. package/Build/Workers/chunk-POSRARY7.js +834 -0
  66. package/Build/Workers/{chunk-GX5LMUGZ.js → chunk-PYHLO636.js} +42 -13
  67. package/Build/Workers/chunk-Q55ECN3Y.js +37 -0
  68. package/Build/Workers/chunk-QD4KM3GO.js +138 -0
  69. package/Build/Workers/chunk-QMLTCCYG.js +55 -0
  70. package/Build/Workers/chunk-QX5XS4LC.js +101 -0
  71. package/Build/Workers/{chunk-UKJCFXVV.js → chunk-QYQIVZBU.js} +6 -6
  72. package/Build/Workers/chunk-R3TKLC6E.js +1075 -0
  73. package/Build/Workers/chunk-R4OIEIPE.js +500 -0
  74. package/Build/Workers/chunk-R4ZEWO4I.js +122 -0
  75. package/Build/Workers/chunk-R6B7UCQB.js +44 -0
  76. package/Build/Workers/chunk-RCK55EDX.js +691 -0
  77. package/Build/Workers/chunk-RHBWXX7C.js +629 -0
  78. package/Build/Workers/chunk-RZLZWKFN.js +305 -0
  79. package/Build/Workers/{chunk-DIVFF6DK.js → chunk-S3PI2KFM.js} +2 -2
  80. package/Build/Workers/chunk-SAPFXU5X.js +102 -0
  81. package/Build/Workers/chunk-T6LPN7RI.js +2857 -0
  82. package/Build/Workers/{chunk-U2LSTOMA.js → chunk-T77JILCU.js} +2 -2
  83. package/Build/Workers/chunk-TBBFDFCS.js +368 -0
  84. package/Build/Workers/chunk-TF776XCO.js +1258 -0
  85. package/Build/Workers/chunk-TGY6H6N6.js +163 -0
  86. package/Build/Workers/{chunk-RTIT7UDN.js → chunk-TO2PVHKI.js} +2 -2
  87. package/Build/Workers/chunk-UCIPJSZX.js +398 -0
  88. package/Build/Workers/chunk-UOEUCKKU.js +59 -0
  89. package/Build/Workers/chunk-VE7BFUIX.js +39 -0
  90. package/Build/Workers/chunk-VFBNELXB.js +353 -0
  91. package/Build/Workers/chunk-VRZ46QZ5.js +781 -0
  92. package/Build/Workers/chunk-VYWUFRRR.js +1052 -0
  93. package/Build/Workers/chunk-WVSELU6O.js +2716 -0
  94. package/Build/Workers/chunk-X23FRWHJ.js +117 -0
  95. package/Build/Workers/chunk-X2ZQ7RJR.js +287 -0
  96. package/Build/Workers/chunk-X43SJLQL.js +10364 -0
  97. package/Build/Workers/chunk-XLTOBCDI.js +220 -0
  98. package/Build/Workers/chunk-XQI7XZHX.js +196 -0
  99. package/Build/Workers/chunk-XUOJCLOH.js +511 -0
  100. package/Build/Workers/chunk-XZZNKIEV.js +157 -0
  101. package/Build/Workers/chunk-YLYBLJ3Y.js +73 -0
  102. package/Build/Workers/chunk-ZEE2EIFD.js +430 -0
  103. package/Build/Workers/chunk-ZIKGV7EL.js +58 -0
  104. package/Build/Workers/chunk-ZU334IDQ.js +421 -0
  105. package/Build/Workers/combineGeometry.js +22 -22
  106. package/Build/Workers/createBoxGeometry.js +16 -16
  107. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  108. package/Build/Workers/createCircleGeometry.js +29 -25
  109. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  110. package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
  111. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  112. package/Build/Workers/createCorridorGeometry.js +29 -29
  113. package/Build/Workers/createCorridorOutlineGeometry.js +27 -27
  114. package/Build/Workers/createCylinderGeometry.js +18 -18
  115. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  116. package/Build/Workers/createEllipseGeometry.js +24 -24
  117. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  118. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  119. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  120. package/Build/Workers/createFrustumGeometry.js +16 -16
  121. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  122. package/Build/Workers/createGeometry.js +22 -22
  123. package/Build/Workers/createGroundPolylineGeometry.js +24 -24
  124. package/Build/Workers/createPlaneGeometry.js +14 -14
  125. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  126. package/Build/Workers/createPolygonGeometry.js +32 -32
  127. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  128. package/Build/Workers/createPolylineGeometry.js +24 -24
  129. package/Build/Workers/createPolylineVolumeGeometry.js +30 -30
  130. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +26 -26
  131. package/Build/Workers/createRectangleGeometry.js +27 -27
  132. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  133. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  134. package/Build/Workers/createSphereGeometry.js +17 -17
  135. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  136. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  137. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  138. package/Build/Workers/createVectorTileGeometries.js +22 -22
  139. package/Build/Workers/createVectorTilePoints.js +12 -12
  140. package/Build/Workers/createVectorTilePolygons.js +20 -20
  141. package/Build/Workers/createVectorTilePolylines.js +13 -13
  142. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  143. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  144. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  145. package/Build/Workers/createWallGeometry.js +23 -23
  146. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  147. package/Build/Workers/decodeDraco.js +11 -11
  148. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  149. package/Build/Workers/decodeI3S.js +10 -10
  150. package/Build/Workers/transcodeKTX2.js +8 -11
  151. package/Build/Workers/transferTypedArrayTest.js +1 -1
  152. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  153. package/Source/Core/ApproximateTerrainHeights.js +4 -4
  154. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +12 -8
  155. package/Source/Core/BoundingRectangle.js +2 -0
  156. package/Source/Core/BoundingSphere.js +4 -2
  157. package/Source/Core/Cartesian3.js +13 -10
  158. package/Source/Core/Cartographic.js +11 -8
  159. package/Source/Core/CesiumTerrainProvider.js +3 -2
  160. package/Source/Core/CircleGeometry.js +6 -2
  161. package/Source/Core/CircleOutlineGeometry.js +1 -1
  162. package/Source/Core/CoplanarPolygonGeometry.js +3 -3
  163. package/Source/Core/CorridorGeometry.js +4 -4
  164. package/Source/Core/CorridorOutlineGeometry.js +2 -2
  165. package/Source/Core/Credit.js +3 -2
  166. package/Source/Core/CustomHeightmapTerrainProvider.js +17 -3
  167. package/Source/Core/EllipseGeometry.js +4 -4
  168. package/Source/Core/EllipseOutlineGeometry.js +2 -2
  169. package/Source/Core/Ellipsoid.js +34 -0
  170. package/Source/Core/EllipsoidGeodesic.js +2 -2
  171. package/Source/Core/EllipsoidRhumbLine.js +4 -4
  172. package/Source/Core/EllipsoidTangentPlane.js +3 -3
  173. package/Source/Core/EllipsoidTerrainProvider.js +3 -3
  174. package/Source/Core/GeographicProjection.js +4 -3
  175. package/Source/Core/GeographicTilingScheme.js +3 -3
  176. package/Source/Core/GeometryPipeline.js +2 -2
  177. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
  178. package/Source/Core/GoogleMaps.js +1 -1
  179. package/Source/Core/GroundPolylineGeometry.js +1 -1
  180. package/Source/Core/HeightmapTessellator.js +2 -2
  181. package/Source/Core/Ion.js +1 -1
  182. package/Source/Core/Occluder.js +3 -3
  183. package/Source/Core/OrientedBoundingBox.js +2 -2
  184. package/Source/Core/PolygonGeometry.js +4 -4
  185. package/Source/Core/PolygonGeometryLibrary.js +1 -1
  186. package/Source/Core/PolygonOutlineGeometry.js +3 -3
  187. package/Source/Core/PolygonPipeline.js +2 -2
  188. package/Source/Core/PolylineGeometry.js +2 -2
  189. package/Source/Core/PolylinePipeline.js +6 -6
  190. package/Source/Core/PolylineVolumeGeometry.js +2 -2
  191. package/Source/Core/PolylineVolumeOutlineGeometry.js +2 -2
  192. package/Source/Core/Rectangle.js +6 -6
  193. package/Source/Core/RectangleGeometry.js +6 -6
  194. package/Source/Core/RectangleGeometryLibrary.js +3 -0
  195. package/Source/Core/RectangleOutlineGeometry.js +2 -2
  196. package/Source/Core/Simon1994PlanetaryPositions.js +4 -2
  197. package/Source/Core/SimplePolylineGeometry.js +2 -2
  198. package/Source/Core/Stereographic.js +2 -2
  199. package/Source/Core/Transforms.js +154 -19
  200. package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
  201. package/Source/Core/WallGeometry.js +3 -3
  202. package/Source/Core/WallOutlineGeometry.js +3 -3
  203. package/Source/Core/WebMercatorTilingScheme.js +3 -3
  204. package/Source/Core/createWorldTerrainAsync.js +2 -0
  205. package/Source/DataSources/BillboardGraphics.js +16 -0
  206. package/Source/DataSources/BillboardVisualizer.js +7 -0
  207. package/Source/DataSources/BoxGeometryUpdater.js +2 -2
  208. package/Source/DataSources/CylinderGeometryUpdater.js +2 -2
  209. package/Source/DataSources/CzmlDataSource.js +8 -8
  210. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -3
  211. package/Source/DataSources/EntityCluster.js +1 -1
  212. package/Source/DataSources/EntityView.js +2 -2
  213. package/Source/DataSources/KmlDataSource.js +4 -4
  214. package/Source/DataSources/ModelVisualizer.js +1 -2
  215. package/Source/DataSources/PathVisualizer.js +4 -4
  216. package/Source/DataSources/PointGraphics.js +17 -0
  217. package/Source/DataSources/PointVisualizer.js +12 -0
  218. package/Source/DataSources/PolygonGeometryUpdater.js +1 -1
  219. package/Source/DataSources/PolylineGeometryUpdater.js +3 -2
  220. package/Source/DataSources/PositionProperty.js +4 -7
  221. package/Source/DataSources/RectangleGeometryUpdater.js +1 -1
  222. package/Source/DataSources/ScaledPositionProperty.js +2 -2
  223. package/Source/DataSources/TerrainOffsetProperty.js +3 -7
  224. package/Source/DataSources/VelocityOrientationProperty.js +2 -2
  225. package/Source/DataSources/exportKml.js +2 -2
  226. package/Source/Renderer/AutomaticUniforms.js +1 -1
  227. package/Source/Renderer/UniformState.js +6 -12
  228. package/Source/Scene/ArcGisMapServerImageryProvider.js +2 -2
  229. package/Source/Scene/ArcGisMapService.js +1 -1
  230. package/Source/Scene/Billboard.js +35 -6
  231. package/Source/Scene/BillboardCollection.js +49 -0
  232. package/Source/Scene/BingMapsImageryProvider.js +11 -2
  233. package/Source/Scene/Camera.js +16 -10
  234. package/Source/Scene/Cesium3DTileset.js +1 -1
  235. package/Source/Scene/ClippingPolygon.js +2 -2
  236. package/Source/Scene/ClippingPolygonCollection.js +1 -1
  237. package/Source/Scene/CreditDisplay.js +94 -104
  238. package/Source/Scene/Globe.js +16 -13
  239. package/Source/Scene/GltfLoaderUtil.js +2 -4
  240. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -1
  241. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
  242. package/Source/Scene/GridImageryProvider.js +2 -2
  243. package/Source/Scene/ImageBasedLighting.js +2 -2
  244. package/Source/Scene/ImageryLayerCollection.js +2 -2
  245. package/Source/Scene/MapboxImageryProvider.js +1 -1
  246. package/Source/Scene/MapboxStyleImageryProvider.js +1 -1
  247. package/Source/Scene/MetadataSemantic.js +4 -4
  248. package/Source/Scene/Model/InstancingPipelineStage.js +3 -3
  249. package/Source/Scene/Model/MaterialPipelineStage.js +49 -0
  250. package/Source/Scene/Model/Model.js +8 -5
  251. package/Source/Scene/Model/ModelSceneGraph.js +1 -1
  252. package/Source/Scene/Model/SceneMode2DPipelineStage.js +3 -3
  253. package/Source/Scene/Model/pickModel.js +2 -2
  254. package/Source/Scene/ModelComponents.js +9 -0
  255. package/Source/Scene/OctahedralProjectedCubeMap.js +5 -6
  256. package/Source/Scene/Picking.js +4 -13
  257. package/Source/Scene/PointPrimitive.js +33 -4
  258. package/Source/Scene/PointPrimitiveCollection.js +22 -9
  259. package/Source/Scene/Scene.js +39 -31
  260. package/Source/Scene/SceneTransforms.js +78 -20
  261. package/Source/Scene/SceneTransitioner.js +2 -2
  262. package/Source/Scene/ScreenSpaceCameraController.js +29 -19
  263. package/Source/Scene/SkyBox.js +26 -0
  264. package/Source/Scene/Sun.js +1 -1
  265. package/Source/Shaders/BillboardCollectionFS.glsl +4 -0
  266. package/Source/Shaders/BillboardCollectionFS.js +4 -0
  267. package/Source/Shaders/BillboardCollectionVS.glsl +3 -1
  268. package/Source/Shaders/BillboardCollectionVS.js +3 -1
  269. package/Source/Shaders/BrdfLutGeneratorFS.glsl +30 -13
  270. package/Source/Shaders/BrdfLutGeneratorFS.js +30 -13
  271. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -2
  272. package/Source/Shaders/Builtin/Functions/ellipsoidTextureCoordinates.glsl +10 -0
  273. package/Source/Shaders/Builtin/Functions/{ellipsoidWgs84TextureCoordinates.js → ellipsoidTextureCoordinates.js} +3 -3
  274. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +40 -39
  275. package/Source/Shaders/Builtin/Functions/pbrLighting.js +40 -39
  276. package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +1 -1
  277. package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +1 -1
  278. package/Source/Shaders/Builtin/Structs/materialInput.glsl +1 -1
  279. package/Source/Shaders/Builtin/Structs/materialInput.js +1 -1
  280. package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +2 -0
  281. package/Source/Shaders/Builtin/Structs/modelMaterial.js +2 -0
  282. package/Source/Shaders/EllipsoidFS.glsl +1 -1
  283. package/Source/Shaders/EllipsoidFS.js +1 -1
  284. package/Source/Shaders/GlobeFS.glsl +2 -2
  285. package/Source/Shaders/GlobeFS.js +2 -2
  286. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +23 -23
  287. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +23 -23
  288. package/Source/Shaders/Model/LightingStageFS.glsl +6 -5
  289. package/Source/Shaders/Model/LightingStageFS.js +6 -5
  290. package/Source/Shaders/Model/MaterialStageFS.glsl +31 -26
  291. package/Source/Shaders/Model/MaterialStageFS.js +31 -26
  292. package/Source/Shaders/PointPrimitiveCollectionFS.glsl +4 -0
  293. package/Source/Shaders/PointPrimitiveCollectionFS.js +4 -0
  294. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +9 -7
  295. package/Source/Shaders/PointPrimitiveCollectionVS.js +9 -7
  296. package/Source/Widget/CesiumWidget.css +0 -5
  297. package/Source/Widget/CesiumWidget.js +29 -28
  298. package/index.d.ts +254 -117
  299. package/index.js +45 -45
  300. package/package.json +4 -4
  301. package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.glsl +0 -10
@@ -12,6 +12,7 @@ in vec4 scaleByDistance; // near, nearScale, far, far
12
12
  in vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale\n\
13
13
  in vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions\n\
14
14
  in vec2 sdf; // sdf outline color (rgb) and width (w)\n\
15
+ in float splitDirection; // splitDirection\n\
15
16
  #if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)\n\
16
17
  in vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates\n\
17
18
  #endif\n\
@@ -29,6 +30,7 @@ out mat2 v_rotationMatrix;\n\
29
30
  \n\
30
31
  out vec4 v_pickColor;\n\
31
32
  out vec4 v_color;\n\
33
+ out float v_splitDirection;\n\
32
34
  #ifdef SDF\n\
33
35
  out vec4 v_outlineColor;\n\
34
36
  out float v_outlineWidth;\n\
@@ -431,6 +433,6 @@ if (lengthSq < disableDepthTestDistance) {\n\
431
433
  \n\
432
434
  v_color = color;\n\
433
435
  v_color.a *= translucency;\n\
434
- \n\
436
+ v_splitDirection = splitDirection;\n\
435
437
  }\n\
436
438
  ";
@@ -27,11 +27,11 @@ vec2 hammersley2D(int i, int N)
27
27
  return vec2(float(i) / float(N), vdcRadicalInverse(i));
28
28
  }
29
29
 
30
- vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)
30
+ vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)
31
31
  {
32
- float a = roughness * roughness;
32
+ float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
33
33
  float phi = 2.0 * M_PI * xi.x;
34
- float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));
34
+ float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));
35
35
  float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
36
36
  vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
37
37
  vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
@@ -40,15 +40,31 @@ vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)
40
40
  return tangentX * H.x + tangentY * H.y + N * H.z;
41
41
  }
42
42
 
43
- float G1_Smith(float NdotV, float k)
43
+ /**
44
+ * Estimate the geometric self-shadowing of the microfacets in a surface,
45
+ * using the Smith Joint GGX visibility function.
46
+ * Note: Vis = G / (4 * NdotL * NdotV)
47
+ * see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3
48
+ * see Real-Time Rendering. Page 331 to 336.
49
+ * see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)
50
+ *
51
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.
52
+ * @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.
53
+ * @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.
54
+ */
55
+ float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
44
56
  {
45
- return NdotV / (NdotV * (1.0 - k) + k);
46
- }
57
+ float alphaRoughnessSq = alphaRoughness * alphaRoughness;
47
58
 
48
- float G_Smith(float roughness, float NdotV, float NdotL)
49
- {
50
- float k = roughness * roughness / 2.0;
51
- return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);
59
+ float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
60
+ float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
61
+
62
+ float GGX = GGXV + GGXL; // 2.0 if NdotL = NdotV = 1.0
63
+ if (GGX > 0.0)
64
+ {
65
+ return 0.5 / GGX; // 1/4 if NdotL = NdotV = 1.0
66
+ }
67
+ return 0.0;
52
68
  }
53
69
 
54
70
  vec2 integrateBrdf(float roughness, float NdotV)
@@ -57,18 +73,19 @@ vec2 integrateBrdf(float roughness, float NdotV)
57
73
  float A = 0.0;
58
74
  float B = 0.0;
59
75
  const int NumSamples = 1024;
76
+ float alphaRoughness = roughness * roughness;
60
77
  for (int i = 0; i < NumSamples; i++)
61
78
  {
62
79
  vec2 xi = hammersley2D(i, NumSamples);
63
- vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));
80
+ vec3 H = importanceSampleGGX(xi, alphaRoughness, vec3(0.0, 0.0, 1.0));
64
81
  vec3 L = 2.0 * dot(V, H) * H - V;
65
82
  float NdotL = clamp(L.z, 0.0, 1.0);
66
83
  float NdotH = clamp(H.z, 0.0, 1.0);
67
84
  float VdotH = clamp(dot(V, H), 0.0, 1.0);
68
85
  if (NdotL > 0.0)
69
86
  {
70
- float G = G_Smith(roughness, NdotV, NdotL);
71
- float G_Vis = G * VdotH / (NdotH * NdotV);
87
+ float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
88
+ float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;
72
89
  float Fc = pow(1.0 - VdotH, 5.0);
73
90
  A += (1.0 - Fc) * G_Vis;
74
91
  B += Fc * G_Vis;
@@ -28,11 +28,11 @@ vec2 hammersley2D(int i, int N)\n\
28
28
  return vec2(float(i) / float(N), vdcRadicalInverse(i));\n\
29
29
  }\n\
30
30
  \n\
31
- vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n\
31
+ vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)\n\
32
32
  {\n\
33
- float a = roughness * roughness;\n\
33
+ float alphaRoughnessSquared = alphaRoughness * alphaRoughness;\n\
34
34
  float phi = 2.0 * M_PI * xi.x;\n\
35
- float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\n\
35
+ float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));\n\
36
36
  float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n\
37
37
  vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\n\
38
38
  vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\
@@ -41,15 +41,31 @@ vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n\
41
41
  return tangentX * H.x + tangentY * H.y + N * H.z;\n\
42
42
  }\n\
43
43
  \n\
44
- float G1_Smith(float NdotV, float k)\n\
44
+ /**\n\
45
+ * Estimate the geometric self-shadowing of the microfacets in a surface,\n\
46
+ * using the Smith Joint GGX visibility function.\n\
47
+ * Note: Vis = G / (4 * NdotL * NdotV)\n\
48
+ * see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3\n\
49
+ * see Real-Time Rendering. Page 331 to 336.\n\
50
+ * see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)\n\
51
+ *\n\
52
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.\n\
53
+ * @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.\n\
54
+ * @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.\n\
55
+ */\n\
56
+ float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)\n\
45
57
  {\n\
46
- return NdotV / (NdotV * (1.0 - k) + k);\n\
47
- }\n\
58
+ float alphaRoughnessSq = alphaRoughness * alphaRoughness;\n\
48
59
  \n\
49
- float G_Smith(float roughness, float NdotV, float NdotL)\n\
50
- {\n\
51
- float k = roughness * roughness / 2.0;\n\
52
- return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n\
60
+ float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
61
+ float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
62
+ \n\
63
+ float GGX = GGXV + GGXL; // 2.0 if NdotL = NdotV = 1.0\n\
64
+ if (GGX > 0.0)\n\
65
+ {\n\
66
+ return 0.5 / GGX; // 1/4 if NdotL = NdotV = 1.0\n\
67
+ }\n\
68
+ return 0.0;\n\
53
69
  }\n\
54
70
  \n\
55
71
  vec2 integrateBrdf(float roughness, float NdotV)\n\
@@ -58,18 +74,19 @@ vec2 integrateBrdf(float roughness, float NdotV)\n\
58
74
  float A = 0.0;\n\
59
75
  float B = 0.0;\n\
60
76
  const int NumSamples = 1024;\n\
77
+ float alphaRoughness = roughness * roughness;\n\
61
78
  for (int i = 0; i < NumSamples; i++)\n\
62
79
  {\n\
63
80
  vec2 xi = hammersley2D(i, NumSamples);\n\
64
- vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\n\
81
+ vec3 H = importanceSampleGGX(xi, alphaRoughness, vec3(0.0, 0.0, 1.0));\n\
65
82
  vec3 L = 2.0 * dot(V, H) * H - V;\n\
66
83
  float NdotL = clamp(L.z, 0.0, 1.0);\n\
67
84
  float NdotH = clamp(H.z, 0.0, 1.0);\n\
68
85
  float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\
69
86
  if (NdotL > 0.0)\n\
70
87
  {\n\
71
- float G = G_Smith(roughness, NdotV, NdotL);\n\
72
- float G_Vis = G * VdotH / (NdotH * NdotV);\n\
88
+ float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);\n\
89
+ float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;\n\
73
90
  float Fc = pow(1.0 - VdotH, 5.0);\n\
74
91
  A += (1.0 - Fc) * G_Vis;\n\
75
92
  B += Fc * G_Vis;\n\
@@ -74,7 +74,7 @@ import czm_decompressTextureCoordinates from './Functions/decompressTextureCoord
74
74
  import czm_depthClamp from './Functions/depthClamp.js'
75
75
  import czm_eastNorthUpToEyeCoordinates from './Functions/eastNorthUpToEyeCoordinates.js'
76
76
  import czm_ellipsoidContainsPoint from './Functions/ellipsoidContainsPoint.js'
77
- import czm_ellipsoidWgs84TextureCoordinates from './Functions/ellipsoidWgs84TextureCoordinates.js'
77
+ import czm_ellipsoidTextureCoordinates from './Functions/ellipsoidTextureCoordinates.js'
78
78
  import czm_equalsEpsilon from './Functions/equalsEpsilon.js'
79
79
  import czm_eyeOffset from './Functions/eyeOffset.js'
80
80
  import czm_eyeToWindowCoordinates from './Functions/eyeToWindowCoordinates.js'
@@ -212,7 +212,7 @@ export default {
212
212
  czm_depthClamp : czm_depthClamp,
213
213
  czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates,
214
214
  czm_ellipsoidContainsPoint : czm_ellipsoidContainsPoint,
215
- czm_ellipsoidWgs84TextureCoordinates : czm_ellipsoidWgs84TextureCoordinates,
215
+ czm_ellipsoidTextureCoordinates : czm_ellipsoidTextureCoordinates,
216
216
  czm_equalsEpsilon : czm_equalsEpsilon,
217
217
  czm_eyeOffset : czm_eyeOffset,
218
218
  czm_eyeToWindowCoordinates : czm_eyeToWindowCoordinates,
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Approximate uv coordinates based on the ellipsoid normal.
3
+ *
4
+ * @name czm_ellipsoidTextureCoordinates
5
+ * @glslFunction
6
+ */
7
+ vec2 czm_ellipsoidTextureCoordinates(vec3 normal)
8
+ {
9
+ return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
10
+ }
@@ -1,11 +1,11 @@
1
1
  //This file is automatically rebuilt by the Cesium build process.
2
2
  export default "/**\n\
3
- * DOC_TBA\n\
3
+ * Approximate uv coordinates based on the ellipsoid normal.\n\
4
4
  *\n\
5
- * @name czm_ellipsoidWgs84TextureCoordinates\n\
5
+ * @name czm_ellipsoidTextureCoordinates\n\
6
6
  * @glslFunction\n\
7
7
  */\n\
8
- vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n\
8
+ vec2 czm_ellipsoidTextureCoordinates(vec3 normal)\n\
9
9
  {\n\
10
10
  return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\
11
11
  }\n\
@@ -13,14 +13,14 @@ vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
13
13
 
14
14
  #ifdef USE_ANISOTROPY
15
15
  /**
16
- * @param {float} roughness Material roughness (along the anisotropy bitangent)
16
+ * @param {float} bitangentRoughness Material roughness (along the anisotropy bitangent)
17
17
  * @param {float} tangentialRoughness Anisotropic roughness (along the anisotropy tangent)
18
18
  * @param {vec3} lightDirection The direction from the fragment to the light source, transformed to tangent-bitangent-normal coordinates
19
19
  * @param {vec3} viewDirection The direction from the fragment to the camera, transformed to tangent-bitangent-normal coordinates
20
20
  */
21
- float smithVisibilityGGX_anisotropic(float roughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)
21
+ float smithVisibilityGGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)
22
22
  {
23
- vec3 roughnessScale = vec3(tangentialRoughness, roughness, 1.0);
23
+ vec3 roughnessScale = vec3(tangentialRoughness, bitangentRoughness, 1.0);
24
24
  float GGXV = lightDirection.z * length(roughnessScale * viewDirection);
25
25
  float GGXL = viewDirection.z * length(roughnessScale * lightDirection);
26
26
  float v = 0.5 / (GGXV + GGXL);
@@ -28,44 +28,44 @@ float smithVisibilityGGX_anisotropic(float roughness, float tangentialRoughness,
28
28
  }
29
29
 
30
30
  /**
31
- * @param {float} roughness Material roughness (along the anisotropy bitangent)
31
+ * @param {float} bitangentRoughness Material roughness (along the anisotropy bitangent)
32
32
  * @param {float} tangentialRoughness Anisotropic roughness (along the anisotropy tangent)
33
33
  * @param {vec3} halfwayDirection The unit vector halfway between light and view directions, transformed to tangent-bitangent-normal coordinates
34
34
  */
35
- float GGX_anisotropic(float roughness, float tangentialRoughness, vec3 halfwayDirection)
35
+ float GGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 halfwayDirection)
36
36
  {
37
- float roughnessSquared = roughness * tangentialRoughness;
38
- vec3 f = halfwayDirection * vec3(roughness, tangentialRoughness, roughnessSquared);
37
+ float roughnessSquared = bitangentRoughness * tangentialRoughness;
38
+ vec3 f = halfwayDirection * vec3(bitangentRoughness, tangentialRoughness, roughnessSquared);
39
39
  float w2 = roughnessSquared / dot(f, f);
40
40
  return roughnessSquared * w2 * w2 / czm_pi;
41
41
  }
42
42
  #endif
43
43
 
44
- float smithVisibilityG1(float NdotV, float roughness)
45
- {
46
- // this is the k value for direct lighting.
47
- // for image based lighting it will be roughness^2 / 2
48
- float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
49
- return NdotV / (NdotV * (1.0 - k) + k);
50
- }
51
-
52
44
  /**
53
45
  * Estimate the geometric self-shadowing of the microfacets in a surface,
54
- * using the Schlick GGX approximation of a Smith visibility function.
46
+ * using the Smith Joint GGX visibility function.
47
+ * Note: Vis = G / (4 * NdotL * NdotV)
48
+ * see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3
49
+ * see Real-Time Rendering. Page 331 to 336.
50
+ * see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)
55
51
  *
56
- * @param {float} roughness The roughness of the material.
52
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.
57
53
  * @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.
58
54
  * @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.
59
55
  */
60
- float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
56
+ float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
61
57
  {
62
- // Avoid divide-by-zero errors
63
- NdotL = clamp(NdotL, 0.001, 1.0);
64
- NdotV += 0.001;
65
- return (
66
- smithVisibilityG1(NdotL, roughness) *
67
- smithVisibilityG1(NdotV, roughness)
68
- ) / (4.0 * NdotL * NdotV);
58
+ float alphaRoughnessSq = alphaRoughness * alphaRoughness;
59
+
60
+ float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
61
+ float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
62
+
63
+ float GGX = GGXV + GGXL;
64
+ if (GGX > 0.0)
65
+ {
66
+ return 0.5 / GGX;
67
+ }
68
+ return 0.0;
69
69
  }
70
70
 
71
71
  /**
@@ -73,15 +73,15 @@ float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
73
73
  * the halfway vector, which is aligned halfway between the directions from
74
74
  * the fragment to the camera and from the fragment to the light source.
75
75
  *
76
- * @param {float} roughness The roughness of the material.
76
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.
77
77
  * @param {float} NdotH The cosine of the angle between the surface normal and the halfway vector.
78
78
  * @return {float} The fraction of microfacets aligned to the halfway vector.
79
79
  */
80
- float GGX(float roughness, float NdotH)
80
+ float GGX(float alphaRoughness, float NdotH)
81
81
  {
82
- float roughnessSquared = roughness * roughness;
83
- float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
84
- return roughnessSquared / (czm_pi * f * f);
82
+ float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
83
+ float f = (NdotH * alphaRoughnessSquared - NdotH) * NdotH + 1.0;
84
+ return alphaRoughnessSquared / (czm_pi * f * f);
85
85
  }
86
86
 
87
87
  /**
@@ -91,16 +91,16 @@ float GGX(float roughness, float NdotH)
91
91
  * @param {vec3} lightDirection The unit vector pointing from the fragment to the light source.
92
92
  * @param {vec3} viewDirection The unit vector pointing from the fragment to the camera.
93
93
  * @param {vec3} halfwayDirection The unit vector pointing from the fragment to halfway between the light source and the camera.
94
- * @param {float} roughness The roughness of the material.
94
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.
95
95
  * @return {float} The strength of the specular reflection.
96
96
  */
97
- float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float roughness)
97
+ float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float alphaRoughness)
98
98
  {
99
99
  float NdotL = dot(normal, lightDirection);
100
100
  float NdotV = abs(dot(normal, viewDirection));
101
- float G = smithVisibilityGGX(roughness, NdotL, NdotV);
101
+ float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
102
102
  float NdotH = clamp(dot(normal, halfwayDirection), 0.0, 1.0);
103
- float D = GGX(roughness, NdotH);
103
+ float D = GGX(alphaRoughness, NdotH);
104
104
  return G * D;
105
105
  }
106
106
 
@@ -138,19 +138,20 @@ vec3 czm_pbrLighting(vec3 viewDirectionEC, vec3 normalEC, vec3 lightDirectionEC,
138
138
  F *= material.specularWeight;
139
139
  #endif
140
140
 
141
- float alpha = material.roughness;
141
+ float alphaRoughness = material.roughness * material.roughness;
142
142
  #ifdef USE_ANISOTROPY
143
143
  mat3 tbn = mat3(material.anisotropicT, material.anisotropicB, normalEC);
144
144
  vec3 lightDirection = lightDirectionEC * tbn;
145
145
  vec3 viewDirection = viewDirectionEC * tbn;
146
146
  vec3 halfwayDirection = halfwayDirectionEC * tbn;
147
147
  float anisotropyStrength = material.anisotropyStrength;
148
- float tangentialRoughness = mix(alpha, 1.0, anisotropyStrength * anisotropyStrength);
149
- float G = smithVisibilityGGX_anisotropic(alpha, tangentialRoughness, lightDirection, viewDirection);
150
- float D = GGX_anisotropic(alpha, tangentialRoughness, halfwayDirection);
148
+ float tangentialRoughness = mix(alphaRoughness, 1.0, anisotropyStrength * anisotropyStrength);
149
+ float bitangentRoughness = clamp(alphaRoughness, 0.001, 1.0);
150
+ float G = smithVisibilityGGX_anisotropic(bitangentRoughness, tangentialRoughness, lightDirection, viewDirection);
151
+ float D = GGX_anisotropic(bitangentRoughness, tangentialRoughness, halfwayDirection);
151
152
  vec3 specularContribution = F * G * D;
152
153
  #else
153
- float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alpha);
154
+ float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alphaRoughness);
154
155
  vec3 specularContribution = F * specularStrength;
155
156
  #endif
156
157
 
@@ -14,14 +14,14 @@ vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)\n\
14
14
  \n\
15
15
  #ifdef USE_ANISOTROPY\n\
16
16
  /**\n\
17
- * @param {float} roughness Material roughness (along the anisotropy bitangent)\n\
17
+ * @param {float} bitangentRoughness Material roughness (along the anisotropy bitangent)\n\
18
18
  * @param {float} tangentialRoughness Anisotropic roughness (along the anisotropy tangent)\n\
19
19
  * @param {vec3} lightDirection The direction from the fragment to the light source, transformed to tangent-bitangent-normal coordinates\n\
20
20
  * @param {vec3} viewDirection The direction from the fragment to the camera, transformed to tangent-bitangent-normal coordinates\n\
21
21
  */\n\
22
- float smithVisibilityGGX_anisotropic(float roughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)\n\
22
+ float smithVisibilityGGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 lightDirection, vec3 viewDirection)\n\
23
23
  {\n\
24
- vec3 roughnessScale = vec3(tangentialRoughness, roughness, 1.0);\n\
24
+ vec3 roughnessScale = vec3(tangentialRoughness, bitangentRoughness, 1.0);\n\
25
25
  float GGXV = lightDirection.z * length(roughnessScale * viewDirection);\n\
26
26
  float GGXL = viewDirection.z * length(roughnessScale * lightDirection);\n\
27
27
  float v = 0.5 / (GGXV + GGXL);\n\
@@ -29,44 +29,44 @@ float smithVisibilityGGX_anisotropic(float roughness, float tangentialRoughness,
29
29
  }\n\
30
30
  \n\
31
31
  /**\n\
32
- * @param {float} roughness Material roughness (along the anisotropy bitangent)\n\
32
+ * @param {float} bitangentRoughness Material roughness (along the anisotropy bitangent)\n\
33
33
  * @param {float} tangentialRoughness Anisotropic roughness (along the anisotropy tangent)\n\
34
34
  * @param {vec3} halfwayDirection The unit vector halfway between light and view directions, transformed to tangent-bitangent-normal coordinates\n\
35
35
  */\n\
36
- float GGX_anisotropic(float roughness, float tangentialRoughness, vec3 halfwayDirection)\n\
36
+ float GGX_anisotropic(float bitangentRoughness, float tangentialRoughness, vec3 halfwayDirection)\n\
37
37
  {\n\
38
- float roughnessSquared = roughness * tangentialRoughness;\n\
39
- vec3 f = halfwayDirection * vec3(roughness, tangentialRoughness, roughnessSquared);\n\
38
+ float roughnessSquared = bitangentRoughness * tangentialRoughness;\n\
39
+ vec3 f = halfwayDirection * vec3(bitangentRoughness, tangentialRoughness, roughnessSquared);\n\
40
40
  float w2 = roughnessSquared / dot(f, f);\n\
41
41
  return roughnessSquared * w2 * w2 / czm_pi;\n\
42
42
  }\n\
43
43
  #endif\n\
44
44
  \n\
45
- float smithVisibilityG1(float NdotV, float roughness)\n\
46
- {\n\
47
- // this is the k value for direct lighting.\n\
48
- // for image based lighting it will be roughness^2 / 2\n\
49
- float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n\
50
- return NdotV / (NdotV * (1.0 - k) + k);\n\
51
- }\n\
52
- \n\
53
45
  /**\n\
54
46
  * Estimate the geometric self-shadowing of the microfacets in a surface,\n\
55
- * using the Schlick GGX approximation of a Smith visibility function.\n\
47
+ * using the Smith Joint GGX visibility function.\n\
48
+ * Note: Vis = G / (4 * NdotL * NdotV)\n\
49
+ * see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3\n\
50
+ * see Real-Time Rendering. Page 331 to 336.\n\
51
+ * see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)\n\
56
52
  *\n\
57
- * @param {float} roughness The roughness of the material.\n\
53
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.\n\
58
54
  * @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.\n\
59
55
  * @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.\n\
60
56
  */\n\
61
- float smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n\
57
+ float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)\n\
62
58
  {\n\
63
- // Avoid divide-by-zero errors\n\
64
- NdotL = clamp(NdotL, 0.001, 1.0);\n\
65
- NdotV += 0.001;\n\
66
- return (\n\
67
- smithVisibilityG1(NdotL, roughness) *\n\
68
- smithVisibilityG1(NdotV, roughness)\n\
69
- ) / (4.0 * NdotL * NdotV);\n\
59
+ float alphaRoughnessSq = alphaRoughness * alphaRoughness;\n\
60
+ \n\
61
+ float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
62
+ float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
63
+ \n\
64
+ float GGX = GGXV + GGXL;\n\
65
+ if (GGX > 0.0)\n\
66
+ {\n\
67
+ return 0.5 / GGX;\n\
68
+ }\n\
69
+ return 0.0;\n\
70
70
  }\n\
71
71
  \n\
72
72
  /**\n\
@@ -74,15 +74,15 @@ float smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n\
74
74
  * the halfway vector, which is aligned halfway between the directions from\n\
75
75
  * the fragment to the camera and from the fragment to the light source.\n\
76
76
  *\n\
77
- * @param {float} roughness The roughness of the material.\n\
77
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.\n\
78
78
  * @param {float} NdotH The cosine of the angle between the surface normal and the halfway vector.\n\
79
79
  * @return {float} The fraction of microfacets aligned to the halfway vector.\n\
80
80
  */\n\
81
- float GGX(float roughness, float NdotH)\n\
81
+ float GGX(float alphaRoughness, float NdotH)\n\
82
82
  {\n\
83
- float roughnessSquared = roughness * roughness;\n\
84
- float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n\
85
- return roughnessSquared / (czm_pi * f * f);\n\
83
+ float alphaRoughnessSquared = alphaRoughness * alphaRoughness;\n\
84
+ float f = (NdotH * alphaRoughnessSquared - NdotH) * NdotH + 1.0;\n\
85
+ return alphaRoughnessSquared / (czm_pi * f * f);\n\
86
86
  }\n\
87
87
  \n\
88
88
  /**\n\
@@ -92,16 +92,16 @@ float GGX(float roughness, float NdotH)\n\
92
92
  * @param {vec3} lightDirection The unit vector pointing from the fragment to the light source.\n\
93
93
  * @param {vec3} viewDirection The unit vector pointing from the fragment to the camera.\n\
94
94
  * @param {vec3} halfwayDirection The unit vector pointing from the fragment to halfway between the light source and the camera.\n\
95
- * @param {float} roughness The roughness of the material.\n\
95
+ * @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.\n\
96
96
  * @return {float} The strength of the specular reflection.\n\
97
97
  */\n\
98
- float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float roughness)\n\
98
+ float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float alphaRoughness)\n\
99
99
  {\n\
100
100
  float NdotL = dot(normal, lightDirection);\n\
101
101
  float NdotV = abs(dot(normal, viewDirection));\n\
102
- float G = smithVisibilityGGX(roughness, NdotL, NdotV);\n\
102
+ float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);\n\
103
103
  float NdotH = clamp(dot(normal, halfwayDirection), 0.0, 1.0);\n\
104
- float D = GGX(roughness, NdotH);\n\
104
+ float D = GGX(alphaRoughness, NdotH);\n\
105
105
  return G * D;\n\
106
106
  }\n\
107
107
  \n\
@@ -139,19 +139,20 @@ vec3 czm_pbrLighting(vec3 viewDirectionEC, vec3 normalEC, vec3 lightDirectionEC,
139
139
  F *= material.specularWeight;\n\
140
140
  #endif\n\
141
141
  \n\
142
- float alpha = material.roughness;\n\
142
+ float alphaRoughness = material.roughness * material.roughness;\n\
143
143
  #ifdef USE_ANISOTROPY\n\
144
144
  mat3 tbn = mat3(material.anisotropicT, material.anisotropicB, normalEC);\n\
145
145
  vec3 lightDirection = lightDirectionEC * tbn;\n\
146
146
  vec3 viewDirection = viewDirectionEC * tbn;\n\
147
147
  vec3 halfwayDirection = halfwayDirectionEC * tbn;\n\
148
148
  float anisotropyStrength = material.anisotropyStrength;\n\
149
- float tangentialRoughness = mix(alpha, 1.0, anisotropyStrength * anisotropyStrength);\n\
150
- float G = smithVisibilityGGX_anisotropic(alpha, tangentialRoughness, lightDirection, viewDirection);\n\
151
- float D = GGX_anisotropic(alpha, tangentialRoughness, halfwayDirection);\n\
149
+ float tangentialRoughness = mix(alphaRoughness, 1.0, anisotropyStrength * anisotropyStrength);\n\
150
+ float bitangentRoughness = clamp(alphaRoughness, 0.001, 1.0);\n\
151
+ float G = smithVisibilityGGX_anisotropic(bitangentRoughness, tangentialRoughness, lightDirection, viewDirection);\n\
152
+ float D = GGX_anisotropic(bitangentRoughness, tangentialRoughness, halfwayDirection);\n\
152
153
  vec3 specularContribution = F * G * D;\n\
153
154
  #else\n\
154
- float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alpha);\n\
155
+ float specularStrength = computeDirectSpecularStrength(normalEC, lightDirectionEC, viewDirectionEC, halfwayDirectionEC, alphaRoughness);\n\
155
156
  vec3 specularContribution = F * specularStrength;\n\
156
157
  #endif\n\
157
158
  \n\
@@ -68,7 +68,7 @@ vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 te
68
68
  * @returns {vec3} The color of the cube map at the direction.
69
69
  */
70
70
  vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {
71
- float currentLod = floor(lod + 0.5);
71
+ float currentLod = floor(lod);
72
72
  float nextLod = min(currentLod + 1.0, maxLod);
73
73
 
74
74
  vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);
@@ -69,7 +69,7 @@ vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 te
69
69
  * @returns {vec3} The color of the cube map at the direction.\n\
70
70
  */\n\
71
71
  vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\n\
72
- float currentLod = floor(lod + 0.5);\n\
72
+ float currentLod = floor(lod);\n\
73
73
  float nextLod = min(currentLod + 1.0, maxLod);\n\
74
74
  \n\
75
75
  vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\n\
@@ -10,7 +10,7 @@
10
10
  * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.
11
11
  * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.
12
12
  * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.
13
- * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.
13
+ * @property {float} height The height of the terrain in meters above or below the ellipsoid. Only available for globe materials.
14
14
  * @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.
15
15
  * @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.
16
16
  */
@@ -11,7 +11,7 @@ export default "/**\n\
11
11
  * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n\
12
12
  * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n\
13
13
  * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n\
14
- * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.\n\
14
+ * @property {float} height The height of the terrain in meters above or below the ellipsoid. Only available for globe materials.\n\
15
15
  * @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.\n\
16
16
  * @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.\n\
17
17
  */\n\
@@ -10,6 +10,7 @@
10
10
  * @name czm_modelMaterial
11
11
  * @glslStruct
12
12
  *
13
+ * @property {vec4} baseColor The base color of the material.
13
14
  * @property {vec3} diffuse Incoming light that scatters evenly in all directions.
14
15
  * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
15
16
  * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.
@@ -19,6 +20,7 @@
19
20
  * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
20
21
  */
21
22
  struct czm_modelMaterial {
23
+ vec4 baseColor;
22
24
  vec3 diffuse;
23
25
  float alpha;
24
26
  vec3 specular;
@@ -11,6 +11,7 @@ export default "/**\n\
11
11
  * @name czm_modelMaterial\n\
12
12
  * @glslStruct\n\
13
13
  *\n\
14
+ * @property {vec4} baseColor The base color of the material.\n\
14
15
  * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n\
15
16
  * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n\
16
17
  * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.\n\
@@ -20,6 +21,7 @@ export default "/**\n\
20
21
  * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n\
21
22
  */\n\
22
23
  struct czm_modelMaterial {\n\
24
+ vec4 baseColor;\n\
23
25
  vec3 diffuse;\n\
24
26
  float alpha;\n\
25
27
  vec3 specular;\n\
@@ -12,7 +12,7 @@ vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)
12
12
  vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates
13
13
  vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordinates
14
14
 
15
- vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);
15
+ vec2 st = czm_ellipsoidTextureCoordinates(sphericalNormal);
16
16
  vec3 positionToEyeEC = -positionEC;
17
17
 
18
18
  czm_materialInput materialInput;
@@ -13,7 +13,7 @@ vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n\
13
13
  vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates\n\
14
14
  vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordinates\n\
15
15
  \n\
16
- vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\n\
16
+ vec2 st = czm_ellipsoidTextureCoordinates(sphericalNormal);\n\
17
17
  vec3 positionToEyeEC = -positionEC;\n\
18
18
  \n\
19
19
  czm_materialInput materialInput;\n\
@@ -374,8 +374,8 @@ void main()
374
374
  {
375
375
  mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
376
376
 
377
- vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
378
- vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);
377
+ vec2 ellipsoidTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC);
378
+ vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC.zyx);
379
379
 
380
380
  vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
381
381