@cesium/engine 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
- package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
- package/Build/ThirdParty/Workers/z-worker-pako.js +54 -104
- package/Build/Workers/{chunk-7LPEGKOF.js → chunk-26NE4LRW.js} +7 -7
- package/Build/Workers/{chunk-PK7TEP3J.js → chunk-26XJDV3D.js} +15 -15
- package/Build/Workers/{chunk-G7CJQKKD.js → chunk-2TRB253J.js} +7 -7
- package/Build/Workers/{chunk-FOZQIHZK.js → chunk-3PV5HQ2R.js} +6 -6
- package/Build/Workers/{chunk-MWYZ64MH.js → chunk-3VDHTBY5.js} +10 -10
- package/Build/Workers/{chunk-XHLDDE65.js → chunk-4RG6WOXH.js} +10 -10
- package/Build/Workers/{chunk-WWP3I7R5.js → chunk-5OK5JFDP.js} +5 -5
- package/Build/Workers/{chunk-34DGOKCO.js → chunk-7HLZRYGD.js} +7 -7
- package/Build/Workers/{chunk-NI2R52QD.js → chunk-7PFZ4Z7C.js} +7 -7
- package/Build/Workers/{chunk-XWML5Y7N.js → chunk-A5CSB5ZE.js} +9 -9
- package/Build/Workers/{chunk-IBXGK4WV.js → chunk-AROLUUGS.js} +2 -2
- package/Build/Workers/{chunk-POLFRINT.js → chunk-BBBTT36L.js} +14 -14
- package/Build/Workers/{chunk-3RZK5NNV.js → chunk-BNT2SNWU.js} +4 -4
- package/Build/Workers/{chunk-CE6GTZ4I.js → chunk-CFBGPZU6.js} +9 -9
- package/Build/Workers/{chunk-YLZTCEBJ.js → chunk-CVCVMOQA.js} +1 -1
- package/Build/Workers/{chunk-U4IMCOF5.js → chunk-DIVFF6DK.js} +2 -2
- package/Build/Workers/{chunk-UAJEGIWA.js → chunk-EJZVBTX4.js} +6 -6
- package/Build/Workers/{chunk-UCPPWV64.js → chunk-EODIOQ35.js} +1 -1
- package/Build/Workers/{chunk-4PHPQRSH.js → chunk-ETC45PHH.js} +5 -6
- package/Build/Workers/{chunk-PS6AEMBR.js → chunk-G7IAO7CW.js} +7 -7
- package/Build/Workers/{chunk-LW7WGHEU.js → chunk-GOQEANLM.js} +13 -13
- package/Build/Workers/{chunk-I5TDPPC4.js → chunk-GUFV24F4.js} +7 -7
- package/Build/Workers/{chunk-4AJGCQFX.js → chunk-GX2BWBN2.js} +13 -13
- package/Build/Workers/{chunk-C5CE4OG6.js → chunk-GX5LMUGZ.js} +5 -5
- package/Build/Workers/{chunk-QKF7XXEQ.js → chunk-I6CW7ZE5.js} +7 -7
- package/Build/Workers/{chunk-BDUJXBVF.js → chunk-IF2OX6R4.js} +3 -5
- package/Build/Workers/{chunk-ZDP32RQI.js → chunk-IXYFH7DV.js} +95 -155
- package/Build/Workers/{chunk-2CSEEWHN.js → chunk-K5F23SZO.js} +6 -6
- package/Build/Workers/{chunk-7VZNXIKG.js → chunk-KTZK2UDR.js} +7 -7
- package/Build/Workers/{chunk-66E3H2KU.js → chunk-LZFFO4KB.js} +12 -12
- package/Build/Workers/{chunk-JI2445T5.js → chunk-OYP23VAL.js} +11 -11
- package/Build/Workers/{chunk-ZWPIM77Q.js → chunk-PHT53MCH.js} +11 -11
- package/Build/Workers/{chunk-6HCAQOVK.js → chunk-PUQR43HZ.js} +6 -6
- package/Build/Workers/{chunk-GIFJ77E4.js → chunk-QZIWFSRM.js} +4 -4
- package/Build/Workers/{chunk-LVJCR7DH.js → chunk-RDR4KVPA.js} +17 -17
- package/Build/Workers/{chunk-4KIUON73.js → chunk-RRUO4QEK.js} +4 -4
- package/Build/Workers/{chunk-ZC4AGBZK.js → chunk-RTIT7UDN.js} +2 -2
- package/Build/Workers/{chunk-AOFMPKUB.js → chunk-SC3TBKST.js} +4 -4
- package/Build/Workers/{chunk-S4XDCPKD.js → chunk-TDIGL45B.js} +1 -1
- package/Build/Workers/{chunk-RL73GOEF.js → chunk-TP4FFUAH.js} +2 -2
- package/Build/Workers/{chunk-WFICTTOE.js → chunk-U2LSTOMA.js} +2 -2
- package/Build/Workers/{chunk-RR7EOKGZ.js → chunk-U6MTSO6A.js} +47 -84
- package/Build/Workers/{chunk-PEABJLCK.js → chunk-UICVDDCQ.js} +1 -1
- package/Build/Workers/{chunk-WEGCQ5DY.js → chunk-UKJCFXVV.js} +6 -6
- package/Build/Workers/{chunk-V7JB576Q.js → chunk-UYKG3UFK.js} +5 -5
- package/Build/Workers/{chunk-3S2MFY4B.js → chunk-W4OS542B.js} +13 -13
- package/Build/Workers/{chunk-CYAJYEKW.js → chunk-WHDEZSAL.js} +6 -6
- package/Build/Workers/{chunk-TMMOULW3.js → chunk-WOYQB5HM.js} +5 -5
- package/Build/Workers/{chunk-PWF3YJJ5.js → chunk-WP3LCUOE.js} +13 -13
- package/Build/Workers/{chunk-AOIKO5Y7.js → chunk-YGNQJ4YI.js} +5 -5
- package/Build/Workers/{chunk-A6NCZSL3.js → chunk-YGTWKLFY.js} +17 -17
- package/Build/Workers/{chunk-KPY4F4BW.js → chunk-ZHJDE6JN.js} +6 -6
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +20 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +43 -79
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Math.js +0 -5
- package/Source/Core/TaskProcessor.js +19 -3
- package/Source/Core/sampleTerrain.js +3 -3
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -2
- package/Source/Scene/GltfLoader.js +458 -435
- package/Source/Scene/GltfLoaderUtil.js +3 -12
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
- package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
- package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
- package/Source/Scene/Model/LightingPipelineStage.js +2 -4
- package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
- package/Source/Scene/Model/Model.js +8 -3
- package/Source/Scene/Model/ModelUtility.js +3 -0
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
- package/Source/Scene/ModelComponents.js +169 -1
- package/Source/Scene/PickDepth.js +23 -15
- package/Source/Scene/ResourceCache.js +41 -50
- package/Source/Scene/ResourceCacheKey.js +41 -53
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -8
- package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
- package/Source/Shaders/GlobeFS.glsl +1 -1
- package/Source/Shaders/GlobeFS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
- package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
- package/Source/Shaders/Model/LightingStageFS.js +113 -48
- package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
- package/Source/Shaders/Model/MaterialStageFS.js +399 -137
- package/index.d.ts +3 -3
- package/index.js +203 -206
- package/package.json +1 -1
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
|
@@ -1,166 +1,245 @@
|
|
|
1
1
|
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
-
export default "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
export default "/**\n\
|
|
3
|
+
* Compute some metrics for a procedural sky lighting model\n\
|
|
4
|
+
*\n\
|
|
5
|
+
* @param {vec3} positionWC The position of the fragment in world coordinates.\n\
|
|
6
|
+
* @param {vec3} reflectionWC A unit vector in the direction of the reflection, in world coordinates.\n\
|
|
7
|
+
* @return {vec3} The dot products of the horizon and reflection directions with the nadir, and an atmosphere boundary distance.\n\
|
|
8
|
+
*/\n\
|
|
9
|
+
vec3 getProceduralSkyMetrics(vec3 positionWC, vec3 reflectionWC)\n\
|
|
10
|
+
{\n\
|
|
11
|
+
// Figure out if the reflection vector hits the ellipsoid\n\
|
|
12
|
+
float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / length(positionWC));\n\
|
|
13
|
+
float reflectionDotNadir = dot(reflectionWC, normalize(positionWC));\n\
|
|
14
|
+
float atmosphereHeight = 0.05;\n\
|
|
15
|
+
float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n\
|
|
16
|
+
return vec3(horizonDotNadir, reflectionDotNadir, smoothstepHeight);\n\
|
|
17
|
+
}\n\
|
|
15
18
|
\n\
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/**\n\
|
|
20
|
+
* Compute the diffuse irradiance for a procedural sky lighting model\n\
|
|
21
|
+
*\n\
|
|
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\
|
|
24
|
+
*/\n\
|
|
25
|
+
vec3 getProceduralDiffuseIrradiance(vec3 skyMetrics)\n\
|
|
26
|
+
{\n\
|
|
27
|
+
vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9); \n\
|
|
28
|
+
float diffuseIrradianceFromEarth = (1.0 - skyMetrics.x) * (skyMetrics.y * 0.25 + 0.75) * skyMetrics.z; \n\
|
|
29
|
+
float diffuseIrradianceFromSky = (1.0 - skyMetrics.z) * (1.0 - (skyMetrics.y * 0.25 + 0.25));\n\
|
|
30
|
+
return blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n\
|
|
31
|
+
}\n\
|
|
18
32
|
\n\
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
/**\n\
|
|
34
|
+
* Compute the specular irradiance for a procedural sky lighting model\n\
|
|
35
|
+
*\n\
|
|
36
|
+
* @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
|
+
*/\n\
|
|
39
|
+
vec3 getProceduralSpecularIrradiance(vec3 reflectionWC, vec3 skyMetrics, float roughness)\n\
|
|
40
|
+
{\n\
|
|
23
41
|
// Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.\n\
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
\n\
|
|
28
|
-
vec3 diffuseColor = pbrParameters.diffuseColor;\n\
|
|
29
|
-
float roughness = pbrParameters.roughness;\n\
|
|
30
|
-
vec3 specularColor = pbrParameters.f0;\n\
|
|
42
|
+
reflectionWC.x = -reflectionWC.x;\n\
|
|
43
|
+
reflectionWC = -normalize(czm_temeToPseudoFixed * reflectionWC);\n\
|
|
44
|
+
reflectionWC.x = -reflectionWC.x;\n\
|
|
31
45
|
\n\
|
|
32
46
|
float inverseRoughness = 1.04 - roughness;\n\
|
|
33
47
|
inverseRoughness *= inverseRoughness;\n\
|
|
34
|
-
vec3 sceneSkyBox = czm_textureCube(czm_environmentMap,
|
|
48
|
+
vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, reflectionWC).rgb * inverseRoughness;\n\
|
|
35
49
|
\n\
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
float blendRegionOffset = roughness * -1.0;\n\
|
|
39
|
-
float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
40
|
-
float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
41
|
-
float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
42
|
-
float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n\
|
|
43
|
-
vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n\
|
|
50
|
+
// Compute colors at different angles relative to the horizon\n\
|
|
51
|
+
vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), skyMetrics.z);\n\
|
|
44
52
|
vec3 nadirColor = belowHorizonColor * 0.5;\n\
|
|
45
53
|
vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n\
|
|
46
|
-
vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor,
|
|
47
|
-
vec3 zenithColor = mix(blueSkyColor, sceneSkyBox,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
float
|
|
51
|
-
|
|
52
|
-
float
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
\n\
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, skyMetrics.y * inverseRoughness * 0.5 + 0.75);\n\
|
|
55
|
+
vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, skyMetrics.z);\n\
|
|
56
|
+
\n\
|
|
57
|
+
// Compute blend zones\n\
|
|
58
|
+
float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - skyMetrics.x);\n\
|
|
59
|
+
float blendRegionOffset = roughness * -1.0;\n\
|
|
60
|
+
float farAboveHorizon = clamp(skyMetrics.x - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
61
|
+
float aroundHorizon = clamp(skyMetrics.x + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
62
|
+
float farBelowHorizon = clamp(skyMetrics.x + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n\
|
|
63
|
+
\n\
|
|
64
|
+
// Blend colors\n\
|
|
65
|
+
float notDistantRough = (1.0 - skyMetrics.x * roughness * 0.8);\n\
|
|
66
|
+
vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, skyMetrics.y) * notDistantRough);\n\
|
|
67
|
+
specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, skyMetrics.y) * inverseRoughness);\n\
|
|
68
|
+
specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, skyMetrics.y) * inverseRoughness);\n\
|
|
69
|
+
\n\
|
|
70
|
+
return specularIrradiance;\n\
|
|
71
|
+
}\n\
|
|
72
|
+
\n\
|
|
73
|
+
#ifdef USE_SUN_LUMINANCE\n\
|
|
74
|
+
float clampedDot(vec3 x, vec3 y)\n\
|
|
75
|
+
{\n\
|
|
76
|
+
return clamp(dot(x, y), 0.001, 1.0);\n\
|
|
77
|
+
}\n\
|
|
78
|
+
/**\n\
|
|
79
|
+
* Sun luminance following the \"CIE Clear Sky Model\"\n\
|
|
80
|
+
* See page 40 of https://3dvar.com/Green2003Spherical.pdf\n\
|
|
81
|
+
*\n\
|
|
82
|
+
* @param {vec3} positionWC The position of the fragment in world coordinates.\n\
|
|
83
|
+
* @param {vec3} normalEC The surface normal in eye coordinates.\n\
|
|
84
|
+
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\
|
|
85
|
+
* @return {float} The computed sun luminance.\n\
|
|
86
|
+
*/\n\
|
|
87
|
+
float getSunLuminance(vec3 positionWC, vec3 normalEC, vec3 lightDirectionEC)\n\
|
|
88
|
+
{\n\
|
|
89
|
+
vec3 normalWC = normalize(czm_inverseViewRotation * normalEC);\n\
|
|
90
|
+
vec3 lightDirectionWC = normalize(czm_inverseViewRotation * lightDirectionEC);\n\
|
|
91
|
+
vec3 vWC = -normalize(positionWC);\n\
|
|
92
|
+
\n\
|
|
93
|
+
// Angle between sun and zenith.\n\
|
|
94
|
+
float LdotZenith = clampedDot(lightDirectionWC, vWC);\n\
|
|
61
95
|
float S = acos(LdotZenith);\n\
|
|
62
96
|
// Angle between zenith and current pixel\n\
|
|
63
|
-
float NdotZenith =
|
|
97
|
+
float NdotZenith = clampedDot(normalWC, vWC);\n\
|
|
64
98
|
// Angle between sun and current pixel\n\
|
|
99
|
+
float NdotL = clampedDot(normalEC, lightDirectionEC);\n\
|
|
65
100
|
float gamma = acos(NdotL);\n\
|
|
66
|
-
float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n\
|
|
67
|
-
float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n\
|
|
68
|
-
float luminance = model_luminanceAtZenith * (numerator / denominator);\n\
|
|
69
|
-
#endif \n\
|
|
70
101
|
\n\
|
|
102
|
+
float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * NdotL * NdotL) * (1.0 - exp(-0.32 / NdotZenith)));\n\
|
|
103
|
+
float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * LdotZenith * LdotZenith) * (1.0 - exp(-0.32));\n\
|
|
104
|
+
return model_luminanceAtZenith * (numerator / denominator);\n\
|
|
105
|
+
}\n\
|
|
106
|
+
#endif\n\
|
|
107
|
+
\n\
|
|
108
|
+
/**\n\
|
|
109
|
+
* Compute the light contribution from a procedural sky model\n\
|
|
110
|
+
*\n\
|
|
111
|
+
* @param {vec3} positionEC The position of the fragment in eye coordinates.\n\
|
|
112
|
+
* @param {vec3} normalEC The surface normal in eye coordinates.\n\
|
|
113
|
+
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\
|
|
114
|
+
* @param {czm_modelMaterial} The material properties.\n\
|
|
115
|
+
* @return {vec3} The computed HDR color\n\
|
|
116
|
+
*/\n\
|
|
117
|
+
vec3 proceduralIBL(\n\
|
|
118
|
+
vec3 positionEC,\n\
|
|
119
|
+
vec3 normalEC,\n\
|
|
120
|
+
vec3 lightDirectionEC,\n\
|
|
121
|
+
czm_modelMaterial material\n\
|
|
122
|
+
) {\n\
|
|
123
|
+
vec3 viewDirectionEC = -normalize(positionEC);\n\
|
|
124
|
+
vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));\n\
|
|
125
|
+
vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirectionEC, normalEC)));\n\
|
|
126
|
+
vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);\n\
|
|
127
|
+
\n\
|
|
128
|
+
float roughness = material.roughness;\n\
|
|
129
|
+
vec3 f0 = material.specular;\n\
|
|
130
|
+
\n\
|
|
131
|
+
vec3 specularIrradiance = getProceduralSpecularIrradiance(reflectionWC, skyMetrics, roughness);\n\
|
|
132
|
+
float NdotV = abs(dot(normalEC, viewDirectionEC)) + 0.001;\n\
|
|
71
133
|
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n\
|
|
72
|
-
vec3
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
134
|
+
vec3 specularColor = czm_srgbToLinear(f0 * brdfLut.x + brdfLut.y);\n\
|
|
135
|
+
vec3 specularContribution = specularIrradiance * specularColor * model_iblFactor.y;\n\
|
|
136
|
+
#ifdef USE_SPECULAR\n\
|
|
137
|
+
specularContribution *= material.specularWeight;\n\
|
|
138
|
+
#endif\n\
|
|
139
|
+
\n\
|
|
140
|
+
vec3 diffuseIrradiance = getProceduralDiffuseIrradiance(skyMetrics);\n\
|
|
141
|
+
vec3 diffuseColor = material.diffuse;\n\
|
|
142
|
+
vec3 diffuseContribution = diffuseIrradiance * diffuseColor * model_iblFactor.x;\n\
|
|
76
143
|
\n\
|
|
77
|
-
|
|
78
|
-
|
|
144
|
+
vec3 iblColor = specularContribution + diffuseContribution;\n\
|
|
145
|
+
\n\
|
|
146
|
+
#ifdef USE_SUN_LUMINANCE\n\
|
|
147
|
+
iblColor *= getSunLuminance(positionWC, normalEC, lightDirectionEC);\n\
|
|
79
148
|
#endif\n\
|
|
80
149
|
\n\
|
|
81
150
|
return iblColor;\n\
|
|
82
151
|
}\n\
|
|
83
152
|
\n\
|
|
153
|
+
#ifdef DIFFUSE_IBL\n\
|
|
154
|
+
vec3 computeDiffuseIBL(vec3 cubeDir)\n\
|
|
155
|
+
{\n\
|
|
156
|
+
#ifdef CUSTOM_SPHERICAL_HARMONICS\n\
|
|
157
|
+
return czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); \n\
|
|
158
|
+
#else\n\
|
|
159
|
+
return czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n\
|
|
160
|
+
#endif\n\
|
|
161
|
+
}\n\
|
|
162
|
+
#endif\n\
|
|
163
|
+
\n\
|
|
164
|
+
#ifdef SPECULAR_IBL\n\
|
|
165
|
+
vec3 sampleSpecularEnvironment(vec3 cubeDir, float roughness)\n\
|
|
166
|
+
{\n\
|
|
167
|
+
#ifdef CUSTOM_SPECULAR_IBL\n\
|
|
168
|
+
float maxLod = model_specularEnvironmentMapsMaximumLOD;\n\
|
|
169
|
+
float lod = roughness * maxLod;\n\
|
|
170
|
+
return czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, lod, maxLod);\n\
|
|
171
|
+
#else\n\
|
|
172
|
+
float maxLod = czm_specularEnvironmentMapsMaximumLOD;\n\
|
|
173
|
+
float lod = roughness * maxLod;\n\
|
|
174
|
+
return czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, lod, maxLod);\n\
|
|
175
|
+
#endif\n\
|
|
176
|
+
}\n\
|
|
177
|
+
vec3 computeSpecularIBL(vec3 cubeDir, float NdotV, float VdotH, vec3 f0, float roughness)\n\
|
|
178
|
+
{\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\
|
|
182
|
+
\n\
|
|
183
|
+
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;\n\
|
|
184
|
+
vec3 specularSample = sampleSpecularEnvironment(cubeDir, roughness);\n\
|
|
185
|
+
\n\
|
|
186
|
+
return specularSample * (F * brdfLut.x + brdfLut.y);\n\
|
|
187
|
+
}\n\
|
|
188
|
+
#endif\n\
|
|
189
|
+
\n\
|
|
84
190
|
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\n\
|
|
191
|
+
/**\n\
|
|
192
|
+
* Compute the light contributions from environment maps and spherical harmonic coefficients\n\
|
|
193
|
+
*\n\
|
|
194
|
+
* @param {vec3} viewDirectionEC Unit vector pointing from the fragment to the eye position\n\
|
|
195
|
+
* @param {vec3} normalEC The surface normal in eye coordinates\n\
|
|
196
|
+
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\
|
|
197
|
+
* @param {czm_modelMaterial} The material properties.\n\
|
|
198
|
+
* @return {vec3} The computed HDR color\n\
|
|
199
|
+
*/\n\
|
|
85
200
|
vec3 textureIBL(\n\
|
|
86
|
-
vec3
|
|
201
|
+
vec3 viewDirectionEC,\n\
|
|
87
202
|
vec3 normalEC,\n\
|
|
88
203
|
vec3 lightDirectionEC,\n\
|
|
89
|
-
|
|
204
|
+
czm_modelMaterial material\n\
|
|
90
205
|
) {\n\
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
\n\
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
\n\
|
|
100
|
-
float
|
|
101
|
-
|
|
102
|
-
\n\
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); \n\
|
|
113
|
-
#else\n\
|
|
114
|
-
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n\
|
|
115
|
-
#endif \n\
|
|
116
|
-
#else \n\
|
|
117
|
-
vec3 diffuseIrradiance = vec3(0.0); \n\
|
|
118
|
-
#endif \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
|
+
#ifdef DIFFUSE_IBL\n\
|
|
210
|
+
vec3 diffuseContribution = computeDiffuseIBL(cubeDir) * material.diffuse;\n\
|
|
211
|
+
#else\n\
|
|
212
|
+
vec3 diffuseContribution = vec3(0.0); \n\
|
|
213
|
+
#endif\n\
|
|
214
|
+
\n\
|
|
215
|
+
float roughness = material.roughness;\n\
|
|
216
|
+
\n\
|
|
217
|
+
#ifdef USE_ANISOTROPY\n\
|
|
218
|
+
// Update environment map sampling direction to account for anisotropic distortion of specular reflection\n\
|
|
219
|
+
vec3 anisotropyDirection = material.anisotropicB;\n\
|
|
220
|
+
vec3 anisotropicTangent = cross(anisotropyDirection, viewDirectionEC);\n\
|
|
221
|
+
vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);\n\
|
|
222
|
+
float bendFactor = 1.0 - material.anisotropyStrength * (1.0 - roughness);\n\
|
|
223
|
+
float bendFactorPow4 = bendFactor * bendFactor * bendFactor * bendFactor;\n\
|
|
224
|
+
vec3 bentNormal = normalize(mix(anisotropicNormal, normalEC, bendFactorPow4));\n\
|
|
225
|
+
cubeDir = normalize(model_iblReferenceFrameMatrix * normalize(reflect(-viewDirectionEC, bentNormal)));\n\
|
|
226
|
+
#endif\n\
|
|
119
227
|
\n\
|
|
120
228
|
#ifdef SPECULAR_IBL\n\
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
specularIBL *= F * brdfLut.x + brdfLut.y;\n\
|
|
133
|
-
#else \n\
|
|
134
|
-
vec3 specularIBL = vec3(0.0); \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\
|
|
232
|
+
vec3 f0 = material.specular;\n\
|
|
233
|
+
vec3 specularContribution = computeSpecularIBL(cubeDir, NdotV, VdotH, f0, roughness);\n\
|
|
234
|
+
#else\n\
|
|
235
|
+
vec3 specularContribution = vec3(0.0); \n\
|
|
236
|
+
#endif\n\
|
|
237
|
+
\n\
|
|
238
|
+
#ifdef USE_SPECULAR\n\
|
|
239
|
+
specularContribution *= material.specularWeight;\n\
|
|
135
240
|
#endif\n\
|
|
136
241
|
\n\
|
|
137
|
-
return
|
|
242
|
+
return diffuseContribution + specularContribution;\n\
|
|
138
243
|
}\n\
|
|
139
244
|
#endif\n\
|
|
140
|
-
|
|
141
|
-
vec3 imageBasedLightingStage(\n\
|
|
142
|
-
vec3 positionEC,\n\
|
|
143
|
-
vec3 normalEC,\n\
|
|
144
|
-
vec3 lightDirectionEC,\n\
|
|
145
|
-
vec3 lightColorHdr,\n\
|
|
146
|
-
czm_pbrParameters pbrParameters\n\
|
|
147
|
-
) {\n\
|
|
148
|
-
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\n\
|
|
149
|
-
// Environment maps were provided, use them for IBL\n\
|
|
150
|
-
return textureIBL(\n\
|
|
151
|
-
positionEC,\n\
|
|
152
|
-
normalEC,\n\
|
|
153
|
-
lightDirectionEC,\n\
|
|
154
|
-
pbrParameters\n\
|
|
155
|
-
);\n\
|
|
156
|
-
#else\n\
|
|
157
|
-
// Use the procedural IBL if there are no environment maps\n\
|
|
158
|
-
return proceduralIBL(\n\
|
|
159
|
-
positionEC,\n\
|
|
160
|
-
normalEC,\n\
|
|
161
|
-
lightDirectionEC,\n\
|
|
162
|
-
lightColorHdr,\n\
|
|
163
|
-
pbrParameters\n\
|
|
164
|
-
);\n\
|
|
165
|
-
#endif\n\
|
|
166
|
-
}";
|
|
245
|
+
";
|
|
@@ -1,72 +1,137 @@
|
|
|
1
|
-
#ifdef
|
|
2
|
-
vec3
|
|
1
|
+
#ifdef USE_IBL_LIGHTING
|
|
2
|
+
vec3 computeIBL(vec3 position, vec3 normal, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
|
|
3
3
|
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#ifdef USE_CUSTOM_LIGHT_COLOR
|
|
10
|
-
vec3 lightColorHdr = model_lightColorHdr;
|
|
4
|
+
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
|
|
5
|
+
// Environment maps were provided, use them for IBL
|
|
6
|
+
vec3 viewDirection = -normalize(position);
|
|
7
|
+
vec3 iblColor = textureIBL(viewDirection, normal, lightDirection, material);
|
|
11
8
|
#else
|
|
12
|
-
|
|
9
|
+
// Use procedural IBL if there are no environment maps
|
|
10
|
+
vec3 imageBasedLighting = proceduralIBL(position, normal, lightDirection, material);
|
|
11
|
+
float maximumComponent = czm_maximumComponent(lightColorHdr);
|
|
12
|
+
vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);
|
|
13
|
+
vec3 iblColor = clampedLightColor * imageBasedLighting;
|
|
13
14
|
#endif
|
|
15
|
+
return iblColor * material.occlusion;
|
|
16
|
+
}
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#ifdef USE_CLEARCOAT
|
|
20
|
+
vec3 addClearcoatReflection(vec3 baseLayerColor, vec3 position, vec3 lightDirection, vec3 lightColorHdr, czm_modelMaterial material)
|
|
21
|
+
{
|
|
22
|
+
vec3 viewDirection = -normalize(position);
|
|
23
|
+
vec3 halfwayDirection = normalize(viewDirection + lightDirection);
|
|
24
|
+
vec3 normal = material.clearcoatNormal;
|
|
25
|
+
float NdotL = clamp(dot(normal, lightDirection), 0.001, 1.0);
|
|
26
|
+
|
|
27
|
+
// clearcoatF0 = vec3(pow((ior - 1.0) / (ior + 1.0), 2.0)), but without KHR_materials_ior, ior is a constant 1.5.
|
|
28
|
+
vec3 f0 = vec3(0.04);
|
|
29
|
+
vec3 f90 = vec3(1.0);
|
|
30
|
+
// Note: clearcoat Fresnel computed with dot(n, v) instead of dot(v, h).
|
|
31
|
+
// This is to make it energy conserving with a simple layering function.
|
|
32
|
+
float NdotV = clamp(dot(normal, viewDirection), 0.0, 1.0);
|
|
33
|
+
vec3 F = fresnelSchlick2(f0, f90, NdotV);
|
|
14
34
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
35
|
+
// compute specular reflection from direct lighting
|
|
36
|
+
float roughness = material.clearcoatRoughness;
|
|
37
|
+
float directStrength = computeDirectSpecularStrength(normal, lightDirection, viewDirection, halfwayDirection, roughness);
|
|
38
|
+
vec3 directReflection = F * directStrength * NdotL;
|
|
39
|
+
vec3 color = lightColorHdr * directReflection;
|
|
40
|
+
|
|
41
|
+
#ifdef SPECULAR_IBL
|
|
42
|
+
// 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);
|
|
45
|
+
color += iblColor * material.occlusion;
|
|
46
|
+
#elif defined(USE_IBL_LIGHTING)
|
|
47
|
+
vec3 positionWC = vec3(czm_inverseView * vec4(position, 1.0));
|
|
48
|
+
vec3 reflectionWC = normalize(czm_inverseViewRotation * normalize(reflect(viewDirection, normal)));
|
|
49
|
+
vec3 skyMetrics = getProceduralSkyMetrics(positionWC, reflectionWC);
|
|
50
|
+
|
|
51
|
+
vec3 specularIrradiance = getProceduralSpecularIrradiance(reflectionWC, skyMetrics, roughness);
|
|
52
|
+
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
|
|
53
|
+
vec3 specularColor = czm_srgbToLinear(f0 * brdfLut.x + brdfLut.y);
|
|
54
|
+
vec3 iblColor = specularIrradiance * specularColor * model_iblFactor.y;
|
|
55
|
+
#ifdef USE_SUN_LUMINANCE
|
|
56
|
+
iblColor *= getSunLuminance(positionWC, normal, lightDirection);
|
|
33
57
|
#endif
|
|
58
|
+
float maximumComponent = czm_maximumComponent(lightColorHdr);
|
|
59
|
+
vec3 clampedLightColor = lightColorHdr / max(maximumComponent, 1.0);
|
|
60
|
+
color += clampedLightColor* iblColor * material.occlusion;
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
float clearcoatFactor = material.clearcoatFactor;
|
|
64
|
+
vec3 clearcoatColor = color * clearcoatFactor;
|
|
65
|
+
|
|
66
|
+
// Dim base layer based on transmission loss through clearcoat
|
|
67
|
+
return baseLayerColor * (1.0 - clearcoatFactor * F) + clearcoatColor;
|
|
68
|
+
}
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
#if defined(LIGHTING_PBR) && defined(HAS_NORMALS)
|
|
72
|
+
vec3 computePbrLighting(in czm_modelMaterial material, in vec3 position)
|
|
73
|
+
{
|
|
74
|
+
#ifdef USE_CUSTOM_LIGHT_COLOR
|
|
75
|
+
vec3 lightColorHdr = model_lightColorHdr;
|
|
76
|
+
#else
|
|
77
|
+
vec3 lightColorHdr = czm_lightColorHdr;
|
|
34
78
|
#endif
|
|
35
79
|
|
|
36
|
-
|
|
37
|
-
|
|
80
|
+
vec3 viewDirection = -normalize(position);
|
|
81
|
+
vec3 normal = material.normalEC;
|
|
82
|
+
vec3 lightDirection = normalize(czm_lightDirectionEC);
|
|
83
|
+
|
|
84
|
+
vec3 directLighting = czm_pbrLighting(viewDirection, normal, lightDirection, material);
|
|
85
|
+
vec3 directColor = lightColorHdr * directLighting;
|
|
38
86
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
#
|
|
87
|
+
// Accumulate colors from base layer
|
|
88
|
+
vec3 color = directColor + material.emissive;
|
|
89
|
+
#ifdef USE_IBL_LIGHTING
|
|
90
|
+
color += computeIBL(position, normal, lightDirection, lightColorHdr, material);
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
#ifdef USE_CLEARCOAT
|
|
94
|
+
color = addClearcoatReflection(color, position, lightDirection, lightColorHdr, material);
|
|
95
|
+
#endif
|
|
46
96
|
|
|
47
97
|
return color;
|
|
48
98
|
}
|
|
49
99
|
#endif
|
|
50
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Compute the material color under the current lighting conditions.
|
|
103
|
+
* All other material properties are passed through so further stages
|
|
104
|
+
* have access to them.
|
|
105
|
+
*
|
|
106
|
+
* @param {czm_modelMaterial} material The material properties from {@MaterialStageFS}
|
|
107
|
+
* @param {ProcessedAttributes} attributes
|
|
108
|
+
*/
|
|
51
109
|
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
|
|
52
110
|
{
|
|
53
|
-
// Even though the lighting will only set the diffuse color,
|
|
54
|
-
// pass all other properties so further stages have access to them.
|
|
55
|
-
vec3 color = vec3(0.0);
|
|
56
|
-
|
|
57
111
|
#ifdef LIGHTING_PBR
|
|
58
|
-
|
|
112
|
+
#ifdef HAS_NORMALS
|
|
113
|
+
vec3 color = computePbrLighting(material, attributes.positionEC);
|
|
114
|
+
#else
|
|
115
|
+
vec3 color = material.diffuse * material.occlusion + material.emissive;
|
|
116
|
+
#endif
|
|
117
|
+
// In HDR mode, the frame buffer is in linear color space. The
|
|
118
|
+
// post-processing stages (see PostProcessStageCollection) will handle
|
|
119
|
+
// tonemapping. However, if HDR is not enabled, we must tonemap else large
|
|
120
|
+
// values may be clamped to 1.0
|
|
121
|
+
#ifndef HDR
|
|
122
|
+
color = czm_acesTonemapping(color);
|
|
123
|
+
#endif
|
|
59
124
|
#else // unlit
|
|
60
|
-
|
|
125
|
+
vec3 color = material.diffuse;
|
|
61
126
|
#endif
|
|
62
127
|
|
|
63
128
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
64
|
-
|
|
65
|
-
|
|
129
|
+
// The colors resulting from point cloud styles are adjusted differently.
|
|
130
|
+
color = czm_gammaCorrect(color);
|
|
66
131
|
#elif !defined(HDR)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
// If HDR is not enabled, the frame buffer stores sRGB colors rather than
|
|
133
|
+
// linear colors so the linear value must be converted.
|
|
134
|
+
color = czm_linearToSrgb(color);
|
|
70
135
|
#endif
|
|
71
136
|
|
|
72
137
|
material.diffuse = color;
|