@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
@@ -375,8 +375,8 @@ void main()\n\
375
375
  {\n\
376
376
  mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\n\
377
377
  \n\
378
- vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\n\
379
- vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\n\
378
+ vec2 ellipsoidTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC);\n\
379
+ vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidTextureCoordinates(normalMC.zyx);\n\
380
380
  \n\
381
381
  vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\n\
382
382
  \n\
@@ -16,10 +16,10 @@ vec3 getProceduralSkyMetrics(vec3 positionWC, vec3 reflectionWC)
16
16
  }
17
17
 
18
18
  /**
19
- * Compute the diffuse irradiance for a procedural sky lighting model
19
+ * Compute the diffuse irradiance for a procedural sky lighting model.
20
20
  *
21
21
  * @param {vec3} skyMetrics The dot products of the horizon and reflection directions with the nadir, and an atmosphere boundary distance.
22
- * @return {vec3} The computed diffuse irradiance
22
+ * @return {vec3} The computed diffuse irradiance.
23
23
  */
24
24
  vec3 getProceduralDiffuseIrradiance(vec3 skyMetrics)
25
25
  {
@@ -30,10 +30,12 @@ vec3 getProceduralDiffuseIrradiance(vec3 skyMetrics)
30
30
  }
31
31
 
32
32
  /**
33
- * Compute the specular irradiance for a procedural sky lighting model
33
+ * Compute the specular irradiance for a procedural sky lighting model.
34
34
  *
35
+ * @param {vec3} reflectionWC The reflection vector in world coordinates.
35
36
  * @param {vec3} skyMetrics The dot products of the horizon and reflection directions with the nadir, and an atmosphere boundary distance.
36
- * @return {vec3} The computed specular irradiance
37
+ * @param {float} roughness The roughness of the material.
38
+ * @return {vec3} The computed specular irradiance.
37
39
  */
38
40
  vec3 getProceduralSpecularIrradiance(vec3 reflectionWC, vec3 skyMetrics, float roughness)
39
41
  {
@@ -42,7 +44,7 @@ vec3 getProceduralSpecularIrradiance(vec3 reflectionWC, vec3 skyMetrics, float r
42
44
  reflectionWC = -normalize(czm_temeToPseudoFixed * reflectionWC);
43
45
  reflectionWC.x = -reflectionWC.x;
44
46
 
45
- float inverseRoughness = 1.04 - roughness;
47
+ float inverseRoughness = 1.0 - roughness;
46
48
  inverseRoughness *= inverseRoughness;
47
49
  vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, reflectionWC).rgb * inverseRoughness;
48
50
 
@@ -121,7 +123,7 @@ float getSunLuminance(vec3 positionWC, vec3 normalEC, vec3 lightDirectionEC)
121
123
  ) {
122
124
  vec3 viewDirectionEC = -normalize(positionEC);
123
125
  vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));
124
- vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirectionEC, normalEC)));
126
+ vec3 reflectionWC = normalize(czm_inverseViewRotation * reflect(viewDirectionEC, normalEC));
125
127
  vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);
126
128
 
127
129
  float roughness = material.roughness;
@@ -173,11 +175,12 @@ vec3 sampleSpecularEnvironment(vec3 cubeDir, float roughness)
173
175
  return czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, lod, maxLod);
174
176
  #endif
175
177
  }
176
- vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, float VdotH, vec3 f0, float roughness)
178
+ vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, vec3 f0, float roughness)
177
179
  {
178
- float reflectance = czm_maximumComponent(f0);
179
- vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
180
- vec3 F = fresnelSchlick2(f0, f90, VdotH);
180
+ // see https://bruop.github.io/ibl/ at Single Scattering Results
181
+ // Roughness dependent fresnel, from Fdez-Aguera
182
+ vec3 f90 = max(vec3(1.0 - roughness), f0);
183
+ vec3 F = fresnelSchlick2(f0, f90, NdotV);
181
184
 
182
185
  vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
183
186
  vec3 specularSample = sampleSpecularEnvironment(cubeDir, roughness);
@@ -202,34 +205,31 @@ vec3 textureIBL(
202
205
  vec3 lightDirectionEC,
203
206
  czm_modelMaterial material
204
207
  ) {
205
- // Find the direction in which to sample the environment map
206
- vec3 cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirectionEC, normalEC)));
207
-
208
208
  #ifdef DIFFUSE_IBL
209
- vec3 diffuseContribution = computeDiffuseIBL(cubeDir) * material.diffuse;
209
+ vec3 normalMC = normalize(model_iblReferenceFrameMatrix * normalEC);
210
+ vec3 diffuseContribution = computeDiffuseIBL(normalMC) * material.diffuse;
210
211
  #else
211
212
  vec3 diffuseContribution = vec3(0.0);
212
213
  #endif
213
214
 
214
- float roughness = material.roughness;
215
-
216
215
  #ifdef USE_ANISOTROPY
217
- // Update environment map sampling direction to account for anisotropic distortion of specular reflection
216
+ // Bend normal to account for anisotropic distortion of specular reflection
218
217
  vec3 anisotropyDirection = material.anisotropicB;
219
218
  vec3 anisotropicTangent = cross(anisotropyDirection, viewDirectionEC);
220
219
  vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);
221
- float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - roughness);
220
+ float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - material.roughness);
222
221
  float bendFactorPow4 = bendFactor * bendFactor * bendFactor * bendFactor;
223
222
  vec3 bentNormal = normalize(mix(anisotropicNormal, normalEC, bendFactorPow4));
224
- cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirectionEC, bentNormal)));
223
+ vec3 reflectEC = reflect(-viewDirectionEC, bentNormal);
224
+ #else
225
+ vec3 reflectEC = reflect(-viewDirectionEC, normalEC);
225
226
  #endif
226
227
 
227
228
  #ifdef SPECULAR_IBL
228
- float NdotV = abs(dot(normalEC, viewDirectionEC)) + 0.001;
229
- vec3 halfwayDirectionEC = normalize(viewDirectionEC + lightDirectionEC);
230
- float VdotH = clamp(dot(viewDirectionEC, halfwayDirectionEC), 0.0, 1.0);
229
+ vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflectEC);
230
+ float NdotV = clamp(dot(normalEC, viewDirectionEC), 0.0, 1.0);
231
231
  vec3 f0 = material.specular;
232
- vec3 specularContribution = computeSpecularIBL(cubeDir, NdotV, VdotH, f0, roughness);
232
+ vec3 specularContribution = computeSpecularIBL(reflectMC, NdotV, f0, material.roughness);
233
233
  #else
234
234
  vec3 specularContribution = vec3(0.0);
235
235
  #endif
@@ -17,10 +17,10 @@ vec3 getProceduralSkyMetrics(vec3 positionWC, vec3 reflectionWC)\n\
17
17
  }\n\
18
18
  \n\
19
19
  /**\n\
20
- * Compute the diffuse irradiance for a procedural sky lighting model\n\
20
+ * Compute the diffuse irradiance for a procedural sky lighting model.\n\
21
21
  *\n\
22
22
  * @param {vec3} skyMetrics The dot products of the horizon and reflection directions with the nadir, and an atmosphere boundary distance.\n\
23
- * @return {vec3} The computed diffuse irradiance\n\
23
+ * @return {vec3} The computed diffuse irradiance.\n\
24
24
  */\n\
25
25
  vec3 getProceduralDiffuseIrradiance(vec3 skyMetrics)\n\
26
26
  {\n\
@@ -31,10 +31,12 @@ vec3 getProceduralDiffuseIrradiance(vec3 skyMetrics)\n\
31
31
  }\n\
32
32
  \n\
33
33
  /**\n\
34
- * Compute the specular irradiance for a procedural sky lighting model\n\
34
+ * Compute the specular irradiance for a procedural sky lighting model.\n\
35
35
  *\n\
36
+ * @param {vec3} reflectionWC The reflection vector in world coordinates.\n\
36
37
  * @param {vec3} skyMetrics The dot products of the horizon and reflection directions with the nadir, and an atmosphere boundary distance.\n\
37
- * @return {vec3} The computed specular irradiance\n\
38
+ * @param {float} roughness The roughness of the material.\n\
39
+ * @return {vec3} The computed specular irradiance.\n\
38
40
  */\n\
39
41
  vec3 getProceduralSpecularIrradiance(vec3 reflectionWC, vec3 skyMetrics, float roughness)\n\
40
42
  {\n\
@@ -43,7 +45,7 @@ vec3 getProceduralSpecularIrradiance(vec3 reflectionWC, vec3 skyMetrics, float r
43
45
  reflectionWC = -normalize(czm_temeToPseudoFixed * reflectionWC);\n\
44
46
  reflectionWC.x = -reflectionWC.x;\n\
45
47
  \n\
46
- float inverseRoughness = 1.04 - roughness;\n\
48
+ float inverseRoughness = 1.0 - roughness;\n\
47
49
  inverseRoughness *= inverseRoughness;\n\
48
50
  vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, reflectionWC).rgb * inverseRoughness;\n\
49
51
  \n\
@@ -122,7 +124,7 @@ float getSunLuminance(vec3 positionWC, vec3 normalEC, vec3 lightDirectionEC)\n\
122
124
  ) {\n\
123
125
  vec3 viewDirectionEC = -normalize(positionEC);\n\
124
126
  vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));\n\
125
- vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirectionEC, normalEC)));\n\
127
+ vec3 reflectionWC = normalize(czm_inverseViewRotation * reflect(viewDirectionEC, normalEC));\n\
126
128
  vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);\n\
127
129
  \n\
128
130
  float roughness = material.roughness;\n\
@@ -174,11 +176,12 @@ vec3 sampleSpecularEnvironment(vec3 cubeDir, float roughness)\n\
174
176
  return czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, lod, maxLod);\n\
175
177
  #endif\n\
176
178
  }\n\
177
- vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, float VdotH, vec3 f0, float roughness)\n\
179
+ vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, vec3 f0, float roughness)\n\
178
180
  {\n\
179
- float reflectance = czm_maximumComponent(f0);\n\
180
- vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n\
181
- vec3 F = fresnelSchlick2(f0, f90, VdotH);\n\
181
+ // see https://bruop.github.io/ibl/ at Single Scattering Results\n\
182
+ // Roughness dependent fresnel, from Fdez-Aguera\n\
183
+ vec3 f90 = max(vec3(1.0 - roughness), f0);\n\
184
+ vec3 F = fresnelSchlick2(f0, f90, NdotV);\n\
182
185
  \n\
183
186
  vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n\
184
187
  vec3 specularSample = sampleSpecularEnvironment(cubeDir, roughness);\n\
@@ -203,34 +206,31 @@ vec3 textureIBL(\n\
203
206
  vec3 lightDirectionEC,\n\
204
207
  czm_modelMaterial material\n\
205
208
  ) {\n\
206
- // Find the direction in which to sample the environment map\n\
207
- vec3 cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirectionEC, normalEC)));\n\
208
- \n\
209
209
  #ifdef DIFFUSE_IBL\n\
210
- vec3 diffuseContribution = computeDiffuseIBL(cubeDir) * material.diffuse;\n\
210
+ vec3 normalMC = normalize(model_iblReferenceFrameMatrix * normalEC);\n\
211
+ vec3 diffuseContribution = computeDiffuseIBL(normalMC) * material.diffuse;\n\
211
212
  #else\n\
212
213
  vec3 diffuseContribution = vec3(0.0); \n\
213
214
  #endif\n\
214
- \n\
215
- float roughness = material.roughness;\n\
216
215
  \n\
217
216
  #ifdef USE_ANISOTROPY\n\
218
- // Update environment map sampling direction to account for anisotropic distortion of specular reflection\n\
217
+ // Bend normal to account for anisotropic distortion of specular reflection\n\
219
218
  vec3 anisotropyDirection = material.anisotropicB;\n\
220
219
  vec3 anisotropicTangent = cross(anisotropyDirection, viewDirectionEC);\n\
221
220
  vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);\n\
222
- float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - roughness);\n\
221
+ float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - material.roughness);\n\
223
222
  float bendFactorPow4 = bendFactor * bendFactor * bendFactor * bendFactor;\n\
224
223
  vec3 bentNormal = normalize(mix(anisotropicNormal, normalEC, bendFactorPow4));\n\
225
- cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirectionEC, bentNormal)));\n\
224
+ vec3 reflectEC = reflect(-viewDirectionEC, bentNormal);\n\
225
+ #else\n\
226
+ vec3 reflectEC = reflect(-viewDirectionEC, normalEC);\n\
226
227
  #endif\n\
227
228
  \n\
228
229
  #ifdef SPECULAR_IBL\n\
229
- float NdotV = abs(dot(normalEC, viewDirectionEC)) + 0.001;\n\
230
- vec3 halfwayDirectionEC = normalize(viewDirectionEC + lightDirectionEC);\n\
231
- float VdotH = clamp(dot(viewDirectionEC, halfwayDirectionEC), 0.0, 1.0);\n\
230
+ vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflectEC);\n\
231
+ float NdotV = clamp(dot(normalEC, viewDirectionEC), 0.0, 1.0);\n\
232
232
  vec3 f0 = material.specular;\n\
233
- vec3 specularContribution = computeSpecularIBL(cubeDir, NdotV, VdotH, f0, roughness);\n\
233
+ vec3 specularContribution = computeSpecularIBL(reflectMC, NdotV, f0, material.roughness);\n\
234
234
  #else\n\
235
235
  vec3 specularContribution = vec3(0.0); \n\
236
236
  #endif\n\
@@ -34,18 +34,19 @@ vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirect
34
34
 
35
35
  // compute specular reflection from direct lighting
36
36
  float roughness = material.clearcoatRoughness;
37
- float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, roughness);
37
+ float alphaRoughness = roughness * roughness;
38
+ float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, alphaRoughness);
38
39
  vec3 directReflection = F * directStrength * NdotL;
39
40
  vec3 color = lightColorHdr * directReflection;
40
41
 
41
42
  #ifdef SPECULAR_IBL
42
43
  // Find the direction in which to sample the environment map
43
- vec3 cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirection, normal)));
44
- vec3 iblColor = computeSpecularIBL(cubeDir, NdotV, NdotV, f0, roughness);
44
+ vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflect(-viewDirection, normal));
45
+ vec3 iblColor = computeSpecularIBL(reflectMC, NdotV, f0, roughness);
45
46
  color += iblColor * material.occlusion;
46
47
  #elif defined(USE_IBL_LIGHTING)
47
48
  vec3 positionWC = vec3(czm_inverseView * vec4(position, 1.0));
48
- vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirection, normal)));
49
+ vec3 reflectionWC = normalize(czm_inverseViewRotation * reflect(viewDirection, normal));
49
50
  vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);
50
51
 
51
52
  vec3 specularIrradiance = getProceduralSpecularIrradiance(reflectionWC, skyMetrics, roughness);
@@ -57,7 +58,7 @@ vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirect
57
58
  #endif
58
59
  float maximumComponent = czm_maximumComponent(lightColorHdr);
59
60
  vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);
60
- color += clampedLightColor* iblColor * material.occlusion;
61
+ color += clampedLightColor * iblColor * material.occlusion;
61
62
  #endif
62
63
 
63
64
  float clearcoatFactor = material.clearcoatFactor;
@@ -35,18 +35,19 @@ vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirect
35
35
  \n\
36
36
  // compute specular reflection from direct lighting\n\
37
37
  float roughness = material.clearcoatRoughness;\n\
38
- float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, roughness);\n\
38
+ float alphaRoughness = roughness * roughness;\n\
39
+ float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, alphaRoughness);\n\
39
40
  vec3 directReflection = F * directStrength * NdotL;\n\
40
41
  vec3 color = lightColorHdr * directReflection;\n\
41
42
  \n\
42
43
  #ifdef SPECULAR_IBL\n\
43
44
  // Find the direction in which to sample the environment map\n\
44
- vec3 cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirection, normal)));\n\
45
- vec3 iblColor = computeSpecularIBL(cubeDir, NdotV, NdotV, f0, roughness);\n\
45
+ vec3 reflectMC = normalize(model_iblReferenceFrameMatrix * reflect(-viewDirection, normal));\n\
46
+ vec3 iblColor = computeSpecularIBL(reflectMC, NdotV, f0, roughness);\n\
46
47
  color += iblColor * material.occlusion;\n\
47
48
  #elif defined(USE_IBL_LIGHTING)\n\
48
49
  vec3 positionWC = vec3(czm_inverseView * vec4(position, 1.0));\n\
49
- vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirection, normal)));\n\
50
+ vec3 reflectionWC = normalize(czm_inverseViewRotation * reflect(viewDirection, normal));\n\
50
51
  vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);\n\
51
52
  \n\
52
53
  vec3 specularIrradiance = getProceduralSpecularIrradiance(reflectionWC, skyMetrics, roughness);\n\
@@ -58,7 +59,7 @@ vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirect
58
59
  #endif\n\
59
60
  float maximumComponent = czm_maximumComponent(lightColorHdr);\n\
60
61
  vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);\n\
61
- color += clampedLightColor* iblColor * material.occlusion;\n\
62
+ color += clampedLightColor * iblColor * material.occlusion;\n\
62
63
  #endif\n\
63
64
  \n\
64
65
  float clearcoatFactor = material.clearcoatFactor;\n\
@@ -65,7 +65,11 @@ NormalInfo getNormalInfo(ProcessedAttributes attributes)
65
65
  #ifdef HAS_NORMAL_TEXTURE
66
66
  mat3 tbn = mat3(tangent, bitangent, geometryNormal);
67
67
  vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
68
- vec3 normal = normalize(tbn * (2.0 * normalSample - 1.0));
68
+ normalSample = 2.0 * normalSample - 1.0;
69
+ #ifdef HAS_NORMAL_TEXTURE_SCALE
70
+ normalSample.xy *= u_normalTextureScale;
71
+ #endif
72
+ vec3 normal = normalize(tbn * normalSample);
69
73
  #else
70
74
  vec3 normal = geometryNormal;
71
75
  #endif
@@ -105,10 +109,12 @@ vec3 getNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)
105
109
  #endif
106
110
 
107
111
  mat3 tbn = mat3(t, b, geometryNormal);
108
- vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
109
- vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));
110
-
111
- return textureNormal;
112
+ vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;
113
+ normalSample = 2.0 * normalSample - 1.0;
114
+ #ifdef HAS_NORMAL_TEXTURE_SCALE
115
+ normalSample.xy *= u_normalTextureScale;
116
+ #endif
117
+ return normalize(tbn * normalSample);
112
118
  }
113
119
  #endif
114
120
 
@@ -131,10 +137,12 @@ vec3 getClearcoatNormalFromTexture(ProcessedAttributes attributes, vec3 geometry
131
137
  #endif
132
138
 
133
139
  mat3 tbn = mat3(t, b, geometryNormal);
134
- vec3 n = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;
135
- vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));
136
-
137
- return textureNormal;
140
+ vec3 normalSample = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;
141
+ normalSample = 2.0 * normalSample - 1.0;
142
+ #ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_SCALE
143
+ normalSample.xy *= u_clearcoatNormalTextureScale;
144
+ #endif
145
+ return normalize(tbn * normalSample);
138
146
  }
139
147
  #endif
140
148
 
@@ -250,8 +258,7 @@ void setSpecularGlossiness(inout czm_modelMaterial material)
250
258
  material.specular = specular;
251
259
 
252
260
  // glossiness is the opposite of roughness, but easier for artists to use.
253
- float roughness = 1.0 - glossiness;
254
- material.roughness = roughness * roughness;
261
+ material.roughness = 1.0 - glossiness;
255
262
  }
256
263
  #elif defined(LIGHTING_PBR)
257
264
  float setMetallicRoughness(inout czm_modelMaterial material)
@@ -264,7 +271,7 @@ float setMetallicRoughness(inout czm_modelMaterial material)
264
271
 
265
272
  vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
266
273
  float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
267
- float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
274
+ float roughness = clamp(metallicRoughness.g, 0.0, 1.0);
268
275
  #ifdef HAS_METALLIC_FACTOR
269
276
  metalness = clamp(metalness * u_metallicFactor, 0.0, 1.0);
270
277
  #endif
@@ -280,7 +287,7 @@ float setMetallicRoughness(inout czm_modelMaterial material)
280
287
  #endif
281
288
 
282
289
  #ifdef HAS_ROUGHNESS_FACTOR
283
- float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
290
+ float roughness = clamp(u_roughnessFactor, 0.0, 1.0);
284
291
  #else
285
292
  float roughness = 1.0;
286
293
  #endif
@@ -288,16 +295,15 @@ float setMetallicRoughness(inout czm_modelMaterial material)
288
295
 
289
296
  // dielectrics use f0 = 0.04, metals use albedo as f0
290
297
  const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
291
- vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.diffuse, metalness);
298
+ vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.baseColor.rgb, metalness);
292
299
 
293
300
  material.specular = f0;
294
301
 
295
302
  // diffuse only applies to dielectrics.
296
- material.diffuse = material.diffuse * (1.0 - f0) * (1.0 - metalness);
303
+ material.diffuse = mix(material.baseColor.rgb, vec3(0.0), metalness);
297
304
 
298
- // roughness is authored as perceptual roughness
299
- // square it to get material roughness
300
- material.roughness = roughness * roughness;
305
+ // This is perceptual roughness. The square of this value is used for direct lighting
306
+ material.roughness = roughness;
301
307
 
302
308
  return metalness;
303
309
  }
@@ -341,7 +347,7 @@ void setSpecular(inout czm_modelMaterial material, in float metalness)
341
347
  material.specularWeight = specularWeight;
342
348
  vec3 f0 = material.specular;
343
349
  vec3 dielectricSpecularF0 = min(f0 * specularColorFactor, vec3(1.0));
344
- material.specular = mix(dielectricSpecularF0, material.diffuse, metalness);
350
+ material.specular = mix(dielectricSpecularF0, material.baseColor.rgb, metalness);
345
351
  }
346
352
  #endif
347
353
  #ifdef USE_ANISOTROPY
@@ -410,9 +416,8 @@ void setClearcoat(inout czm_modelMaterial material, in ProcessedAttributes attri
410
416
  #endif
411
417
 
412
418
  material.clearcoatFactor = clearcoatFactor;
413
- // roughness is authored as perceptual roughness
414
- // square it to get material roughness
415
- material.clearcoatRoughness = clearcoatRoughness * clearcoatRoughness;
419
+ // This is perceptual roughness. The square of this value is used for direct lighting
420
+ material.clearcoatRoughness = clearcoatRoughness;
416
421
  #ifdef HAS_CLEARCOAT_NORMAL_TEXTURE
417
422
  material.clearcoatNormal = getClearcoatNormalFromTexture(attributes, attributes.normalEC);
418
423
  #else
@@ -450,12 +455,12 @@ void materialStage(inout czm_modelMaterial material, ProcessedAttributes attribu
450
455
  baseColorWithAlpha *= color;
451
456
  #endif
452
457
 
453
- material.diffuse = baseColorWithAlpha.rgb;
454
- material.alpha = baseColorWithAlpha.a;
455
-
456
458
  #ifdef USE_CPU_STYLING
457
- material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
459
+ baseColorWithAlpha.rgb = blend(baseColorWithAlpha.rgb, feature.color.rgb, model_colorBlend);
458
460
  #endif
461
+ material.baseColor = baseColorWithAlpha;
462
+ material.diffuse = baseColorWithAlpha.rgb;
463
+ material.alpha = baseColorWithAlpha.a;
459
464
 
460
465
  #ifdef HAS_OCCLUSION_TEXTURE
461
466
  vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
@@ -66,7 +66,11 @@ NormalInfo getNormalInfo(ProcessedAttributes attributes)\n\
66
66
  #ifdef HAS_NORMAL_TEXTURE\n\
67
67
  mat3 tbn = mat3(tangent, bitangent, geometryNormal);\n\
68
68
  vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;\n\
69
- vec3 normal = normalize(tbn * (2.0 * normalSample - 1.0));\n\
69
+ normalSample = 2.0 * normalSample - 1.0;\n\
70
+ #ifdef HAS_NORMAL_TEXTURE_SCALE\n\
71
+ normalSample.xy *= u_normalTextureScale;\n\
72
+ #endif\n\
73
+ vec3 normal = normalize(tbn * normalSample);\n\
70
74
  #else\n\
71
75
  vec3 normal = geometryNormal;\n\
72
76
  #endif\n\
@@ -106,10 +110,12 @@ vec3 getNormalFromTexture(ProcessedAttributes attributes, vec3 geometryNormal)\n
106
110
  #endif\n\
107
111
  \n\
108
112
  mat3 tbn = mat3(t, b, geometryNormal);\n\
109
- vec3 n = texture(u_normalTexture, normalTexCoords).rgb;\n\
110
- vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));\n\
111
- \n\
112
- return textureNormal;\n\
113
+ vec3 normalSample = texture(u_normalTexture, normalTexCoords).rgb;\n\
114
+ normalSample = 2.0 * normalSample - 1.0;\n\
115
+ #ifdef HAS_NORMAL_TEXTURE_SCALE\n\
116
+ normalSample.xy *= u_normalTextureScale;\n\
117
+ #endif\n\
118
+ return normalize(tbn * normalSample);\n\
113
119
  }\n\
114
120
  #endif\n\
115
121
  \n\
@@ -132,10 +138,12 @@ vec3 getClearcoatNormalFromTexture(ProcessedAttributes attributes, vec3 geometry
132
138
  #endif\n\
133
139
  \n\
134
140
  mat3 tbn = mat3(t, b, geometryNormal);\n\
135
- vec3 n = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;\n\
136
- vec3 textureNormal = normalize(tbn * (2.0 * n - 1.0));\n\
137
- \n\
138
- return textureNormal;\n\
141
+ vec3 normalSample = texture(u_clearcoatNormalTexture, normalTexCoords).rgb;\n\
142
+ normalSample = 2.0 * normalSample - 1.0;\n\
143
+ #ifdef HAS_CLEARCOAT_NORMAL_TEXTURE_SCALE\n\
144
+ normalSample.xy *= u_clearcoatNormalTextureScale;\n\
145
+ #endif\n\
146
+ return normalize(tbn * normalSample);\n\
139
147
  }\n\
140
148
  #endif\n\
141
149
  \n\
@@ -251,8 +259,7 @@ void setSpecularGlossiness(inout czm_modelMaterial material)\n\
251
259
  material.specular = specular;\n\
252
260
  \n\
253
261
  // glossiness is the opposite of roughness, but easier for artists to use.\n\
254
- float roughness = 1.0 - glossiness;\n\
255
- material.roughness = roughness * roughness;\n\
262
+ material.roughness = 1.0 - glossiness;\n\
256
263
  }\n\
257
264
  #elif defined(LIGHTING_PBR)\n\
258
265
  float setMetallicRoughness(inout czm_modelMaterial material)\n\
@@ -265,7 +272,7 @@ float setMetallicRoughness(inout czm_modelMaterial material)\n\
265
272
  \n\
266
273
  vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\n\
267
274
  float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n\
268
- float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n\
275
+ float roughness = clamp(metallicRoughness.g, 0.0, 1.0);\n\
269
276
  #ifdef HAS_METALLIC_FACTOR\n\
270
277
  metalness = clamp(metalness * u_metallicFactor, 0.0, 1.0);\n\
271
278
  #endif\n\
@@ -281,7 +288,7 @@ float setMetallicRoughness(inout czm_modelMaterial material)\n\
281
288
  #endif\n\
282
289
  \n\
283
290
  #ifdef HAS_ROUGHNESS_FACTOR\n\
284
- float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n\
291
+ float roughness = clamp(u_roughnessFactor, 0.0, 1.0);\n\
285
292
  #else\n\
286
293
  float roughness = 1.0;\n\
287
294
  #endif\n\
@@ -289,16 +296,15 @@ float setMetallicRoughness(inout czm_modelMaterial material)\n\
289
296
  \n\
290
297
  // dielectrics use f0 = 0.04, metals use albedo as f0\n\
291
298
  const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\n\
292
- vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.diffuse, metalness);\n\
299
+ vec3 f0 = mix(REFLECTANCE_DIELECTRIC, material.baseColor.rgb, metalness);\n\
293
300
  \n\
294
301
  material.specular = f0;\n\
295
302
  \n\
296
303
  // diffuse only applies to dielectrics.\n\
297
- material.diffuse = material.diffuse * (1.0 - f0) * (1.0 - metalness);\n\
304
+ material.diffuse = mix(material.baseColor.rgb, vec3(0.0), metalness);\n\
298
305
  \n\
299
- // roughness is authored as perceptual roughness\n\
300
- // square it to get material roughness\n\
301
- material.roughness = roughness * roughness;\n\
306
+ // This is perceptual roughness. The square of this value is used for direct lighting\n\
307
+ material.roughness = roughness;\n\
302
308
  \n\
303
309
  return metalness;\n\
304
310
  }\n\
@@ -342,7 +348,7 @@ void setSpecular(inout czm_modelMaterial material, in float metalness)\n\
342
348
  material.specularWeight = specularWeight;\n\
343
349
  vec3 f0 = material.specular;\n\
344
350
  vec3 dielectricSpecularF0 = min(f0 * specularColorFactor, vec3(1.0));\n\
345
- material.specular = mix(dielectricSpecularF0, material.diffuse, metalness);\n\
351
+ material.specular = mix(dielectricSpecularF0, material.baseColor.rgb, metalness);\n\
346
352
  }\n\
347
353
  #endif\n\
348
354
  #ifdef USE_ANISOTROPY\n\
@@ -411,9 +417,8 @@ void setClearcoat(inout czm_modelMaterial material, in ProcessedAttributes attri
411
417
  #endif\n\
412
418
  \n\
413
419
  material.clearcoatFactor = clearcoatFactor;\n\
414
- // roughness is authored as perceptual roughness\n\
415
- // square it to get material roughness\n\
416
- material.clearcoatRoughness = clearcoatRoughness * clearcoatRoughness;\n\
420
+ // This is perceptual roughness. The square of this value is used for direct lighting\n\
421
+ material.clearcoatRoughness = clearcoatRoughness;\n\
417
422
  #ifdef HAS_CLEARCOAT_NORMAL_TEXTURE\n\
418
423
  material.clearcoatNormal = getClearcoatNormalFromTexture(attributes, attributes.normalEC);\n\
419
424
  #else\n\
@@ -450,13 +455,13 @@ void materialStage(inout czm_modelMaterial material, ProcessedAttributes attribu
450
455
  #endif\n\
451
456
  baseColorWithAlpha *= color;\n\
452
457
  #endif\n\
453
- \n\
454
- material.diffuse = baseColorWithAlpha.rgb;\n\
455
- material.alpha = baseColorWithAlpha.a;\n\
456
458
  \n\
457
459
  #ifdef USE_CPU_STYLING\n\
458
- material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n\
460
+ baseColorWithAlpha.rgb = blend(baseColorWithAlpha.rgb, feature.color.rgb, model_colorBlend);\n\
459
461
  #endif\n\
462
+ material.baseColor = baseColorWithAlpha;\n\
463
+ material.diffuse = baseColorWithAlpha.rgb;\n\
464
+ material.alpha = baseColorWithAlpha.a;\n\
460
465
  \n\
461
466
  #ifdef HAS_OCCLUSION_TEXTURE\n\
462
467
  vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n\
@@ -3,9 +3,13 @@ in vec4 v_outlineColor;
3
3
  in float v_innerPercent;
4
4
  in float v_pixelDistance;
5
5
  in vec4 v_pickColor;
6
+ in float v_splitDirection;
6
7
 
7
8
  void main()
8
9
  {
10
+ if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
11
+ if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
12
+
9
13
  // The distance in UV space from this fragment to the center of the point, at most 0.5.
10
14
  float distanceToCenter = length(gl_PointCoord - vec2(0.5));
11
15
  // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.
@@ -4,9 +4,13 @@ in vec4 v_outlineColor;\n\
4
4
  in float v_innerPercent;\n\
5
5
  in float v_pixelDistance;\n\
6
6
  in vec4 v_pickColor;\n\
7
+ in float v_splitDirection;\n\
7
8
  \n\
8
9
  void main()\n\
9
10
  {\n\
11
+ if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;\n\
12
+ if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;\n\
13
+ \n\
10
14
  // The distance in UV space from this fragment to the center of the point, at most 0.5.\n\
11
15
  float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n\
12
16
  // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n\
@@ -2,16 +2,17 @@ uniform float u_maxTotalPointSize;
2
2
 
3
3
  in vec4 positionHighAndSize;
4
4
  in vec4 positionLowAndOutline;
5
- in vec4 compressedAttribute0; // color, outlineColor, pick color
6
- in vec4 compressedAttribute1; // show, translucency by distance, some free space
7
- in vec4 scaleByDistance; // near, nearScale, far, farScale
8
- in vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance
5
+ in vec4 compressedAttribute0; // color, outlineColor, pick color
6
+ in vec4 compressedAttribute1; // show, translucency by distance, some free space
7
+ in vec4 scaleByDistance; // near, nearScale, far, farScale
8
+ in vec4 distanceDisplayConditionAndDisableDepthAndSplitDirection; // near, far, disableDepthTestDistance, splitDirection
9
9
 
10
10
  out vec4 v_color;
11
11
  out vec4 v_outlineColor;
12
12
  out float v_innerPercent;
13
13
  out float v_pixelDistance;
14
14
  out vec4 v_pickColor;
15
+ out float v_splitDirection;
15
16
 
16
17
  const float SHIFT_LEFT8 = 256.0;
17
18
  const float SHIFT_RIGHT8 = 1.0 / 256.0;
@@ -135,8 +136,8 @@ void main()
135
136
  #endif
136
137
 
137
138
  #ifdef DISTANCE_DISPLAY_CONDITION
138
- float nearSq = distanceDisplayConditionAndDisableDepth.x;
139
- float farSq = distanceDisplayConditionAndDisableDepth.y;
139
+ float nearSq = distanceDisplayConditionAndDisableDepthAndSplitDirection.x;
140
+ float farSq = distanceDisplayConditionAndDisableDepthAndSplitDirection.y;
140
141
  if (lengthSq < nearSq || lengthSq > farSq) {
141
142
  // push vertex behind camera to force it to be clipped
142
143
  positionEC.xyz = vec3(0.0, 0.0, 1.0);
@@ -147,7 +148,7 @@ void main()
147
148
  czm_vertexLogDepth();
148
149
 
149
150
  #ifdef DISABLE_DEPTH_DISTANCE
150
- float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
151
+ float disableDepthTestDistance = distanceDisplayConditionAndDisableDepthAndSplitDirection.z;
151
152
  if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
152
153
  {
153
154
  disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
@@ -180,4 +181,5 @@ void main()
180
181
  gl_Position *= show;
181
182
 
182
183
  v_pickColor = pickColor;
184
+ v_splitDirection = distanceDisplayConditionAndDisableDepthAndSplitDirection.w;
183
185
  }