@arcgis/core 5.2.0-next.64 → 5.2.0-next.65
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{bb95922cd4631d6f17fb.js → 04ac5ac6f592d8c34bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{0977f4d77c36175c2895.js → 3ddd717ea12d9823eee2.js} +1 -1
- package/assets/esri/core/workers/chunks/5adf16c034a590b5e9f5.js +1 -0
- package/assets/esri/core/workers/chunks/{57824ecc10b25e3ad794.js → 903e1cd8b76eff19ebdf.js} +1 -1
- package/assets/esri/core/workers/chunks/93c0a620a147cbf4a0ba.js +1 -0
- package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +1 -0
- package/assets/esri/core/workers/chunks/a52c88e2d837b525ff6c.js +1 -0
- package/assets/esri/core/workers/chunks/{771ead806efbe9c91fdc.js → a5fdb02b1714e93fa69e.js} +1 -1
- package/assets/esri/core/workers/chunks/b4e5ee81b9eb171499a6.js +1 -0
- package/assets/esri/core/workers/chunks/bece22668622a9a6bfe2.js +1 -0
- package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +1 -0
- package/assets/esri/core/workers/chunks/d51c41c1944df0cbab3e.js +1 -0
- package/assets/esri/core/workers/chunks/d583bcea4d1a21da9147.js +1 -0
- package/assets/esri/core/workers/chunks/{ef27bf1d7941ae265ca4.js → d7267f429a051943187b.js} +1 -1
- package/assets/esri/core/workers/chunks/d9c78c2db04a06ee83ed.js +1 -0
- package/assets/esri/core/workers/chunks/{c1e45e24f5ef719a714c.js → dc7e4f7879debf557e46.js} +143 -95
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/Component.glsl.js +60 -62
- package/chunks/DefaultMaterial.glsl.js +27 -28
- package/chunks/GaussianSplat.glsl.js +7 -7
- package/chunks/GaussianSplatShadow.glsl.js +9 -9
- package/chunks/GlobalIllumination.glsl.js +35 -15
- package/chunks/Path.glsl.js +7 -6
- package/chunks/RealisticTree.glsl.js +22 -24
- package/chunks/SSAO.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +3 -2
- package/chunks/Water.glsl.js +20 -11
- package/chunks/_commonjsHelpers.js +1 -1
- package/chunks/bundle2.js +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/parquet/ParquetFileInfo.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/raster/datasets/EphemeralBlockCache.js +1 -1
- package/layers/raster/datasets/RawBlockCache.js +1 -1
- package/layers/support/KMLSublayer.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +1 -1
- package/rest/support/Query.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/MeshSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/PolygonSymbol3D.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +24 -16
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +25 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +2 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPassParameters.js +2 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/TableList/ListItem.js +1 -1
- package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +0 -1
- package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +0 -1
- package/assets/esri/core/workers/chunks/6123894e2ae9233cdf89.js +0 -1
- package/assets/esri/core/workers/chunks/6b536d03b4bef408035b.js +0 -1
- package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +0 -1
- package/assets/esri/core/workers/chunks/78b80da3bbc1b608fe83.js +0 -1
- package/assets/esri/core/workers/chunks/7d85048c6cd6ad84faf9.js +0 -1
- package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +0 -1
- package/assets/esri/core/workers/chunks/a2d8bc0efddd2e13b1ad.js +0 -1
- package/assets/esri/core/workers/chunks/c97451f75c23be979476.js +0 -1
|
Binary file
|
package/chunks/Component.glsl.js
CHANGED
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js";import{ForwardLinearDepthToWriteShadowMap as
|
|
2
|
+
import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js";import{ForwardLinearDepthToWriteShadowMap as o}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import{isColor as r,isShadow as a}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SlicePass as l}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{TextureCoordinateAttribute as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{VertexNormal as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VertexPosition as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js";import{outputDepth as d}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as c}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{OutputHighlightOverlay as v}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js";import{ReadDepth as g}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{computeFragmentNormals as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import{ComputeMaterialColor as u}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import{ComputeNormalTextureDraw as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateSceneLighting as h,addLightingGlobalFactor as w}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as f,addMainLightDirection as y}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{PhysicallyBasedRenderingParameters as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadBaseColorTexture as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import{ReadShadowMapPassFragment as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayIM as O}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{DiscardOrAdjustAlphaDraw as L}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import{BooleanDrawUniform as S}from"../views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js";import{FloatDrawUniform as M}from"../views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js";import{If as U,glsl as j}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as N}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{SnowCover as V}from"../views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js";import{alphaCutoff as T}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{outputColorHighlightOLID as W}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getPlanetRadius as $,sphereDepthInterpolate as D}from"../views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js";import{ShaderBuilder as P}from"../views/webgl/ShaderBuilder.js";function R(R){const A=new P,{vertex:F,fragment:z}=A;A.include(s,R),A.include(n,R),A.include(i,R),A.include(t,R),A.include(e,R),A.include(L,R),z.include(l,R),A.include(b,R);const{output:B,pbrMode:E,hasNormalTexture:I,snowCover:_,receiveShadows:H,shadeNormals:G,spherical:k,sphericalSR:q,overlayEnabled:J,componentDataType:K,vertexDiscardMode:Q,renderOccluded:X,isGroundSlice:Y}=R,Z=r(B),ee=1===E||2===E;ee&&(A.include(C,R),I&&A.include(p,R));const oe=a(B),re=11===B,ae=10===B,le=4===B,te=oe&&1===K,ie=$(R),ne=J&&k,se=1===q;(Z||le)&&(A.include(u,R),z.include(T)),J&&(z.include(h,R),A.include(O,R),ne?(A.varyings.add("vPositionForDraping","vec3"),z.uniforms.add(new S("useENUForGlobalOverlayUV",e=>e.useENUForGlobalOverlayUV),new M("overlayMapScaleU",e=>e.toMapSpace[2]),new M("overlayReferenceU",e=>e.toMapSpace[0])),z.constants.add("overlayWorldWidth","float",se?2*Math.PI*ie:360),se?(z.constants.add("pRadius","float",ie),z.constants.add("halfSemiMajorAxis","float",.5*ie)):z.constants.add("rad2deg1","float",180/Math.PI),z.constants.add("invRadius","float",1/ie).code.add(j`
|
|
3
3
|
vec2 projectOverlay(vec3 pos) { return pos.xy / (1.0 + invRadius * pos.z); }
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
float
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return valid0 ? overlayU0Norm : overlayU1 * scaleU + offsetU;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
vec2 selectOverlayUV(vec2 overlayUV0, float scaleU, float offsetU, float wrapOffsetU) {
|
|
13
|
-
float overlayU = selectOverlayU(overlayUV0.x, overlayUV0.x + wrapOffsetU, scaleU, offsetU);
|
|
14
|
-
return vec2(overlayU, overlayUV0.y);
|
|
5
|
+
vec2 selectOverlayUVNorm(vec2 normUV, float offsetUNorm) {
|
|
6
|
+
float offsetU = normUV.x < 0.0 ? offsetUNorm : normUV.x > 1.0 ? -offsetUNorm : 0.0;
|
|
7
|
+
return normUV + vec2(offsetU, 0.0);
|
|
15
8
|
}
|
|
16
9
|
|
|
17
10
|
vec4 selectOverlayUVs(vec2 overlayUV0, float wrapOffsetU) {
|
|
18
|
-
|
|
19
|
-
vec2 overlayUVOuter = selectOverlayUV(overlayUV0, overlayTexScale.z, overlayTexOffset.z, wrapOffsetU);
|
|
11
|
+
vec4 overlayUVNorm = overlayUV0.xyxy * overlayTexScale + overlayTexOffset;
|
|
20
12
|
return vec4(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
overlayUVOuter.x,
|
|
24
|
-
overlayUVOuter.y * overlayTexScale.w + overlayTexOffset.w
|
|
13
|
+
selectOverlayUVNorm(overlayUVNorm.xy, wrapOffsetU * overlayTexScale.x),
|
|
14
|
+
selectOverlayUVNorm(overlayUVNorm.zw, wrapOffsetU * overlayTexScale.z)
|
|
25
15
|
);
|
|
26
16
|
}
|
|
27
17
|
|
|
28
|
-
float overlayMapWrapOffsetU(float overlayU) {
|
|
29
|
-
return overlayU < 0.0 ? overlayWorldWidth : -overlayWorldWidth;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
18
|
vec4 selectLocalOverlayUVs(vec2 overlayUV0) {
|
|
33
|
-
|
|
34
|
-
return selectOverlayUVs(overlayUV0, overlayMapWrapOffsetU(overlayMapU) / overlayMapScaleU);
|
|
19
|
+
return selectOverlayUVs(overlayUV0, overlayWorldWidth / overlayMapScaleU);
|
|
35
20
|
}
|
|
36
21
|
|
|
37
22
|
vec4 selectMapOverlayUVs(vec2 overlayUV0) {
|
|
38
|
-
return selectOverlayUVs(overlayUV0,
|
|
23
|
+
return selectOverlayUVs(overlayUV0, overlayWorldWidth);
|
|
39
24
|
}
|
|
40
25
|
|
|
41
26
|
vec2 overlayMapUVFromWorldPosition() {
|
|
@@ -46,12 +31,12 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
46
31
|
float sinLat = wPos.z / oRadius;
|
|
47
32
|
vec2 posMap;
|
|
48
33
|
|
|
49
|
-
${
|
|
34
|
+
${U(se,j`
|
|
50
35
|
posMap = vec2(
|
|
51
36
|
oLonRad * pRadius,
|
|
52
37
|
halfSemiMajorAxis * log((1.0 + sinLat) / (1.0 - sinLat))
|
|
53
38
|
);
|
|
54
|
-
`,
|
|
39
|
+
`,j`
|
|
55
40
|
float oLatRad = asin(clamp(sinLat,-1.0,1.0));
|
|
56
41
|
posMap = vec2(rad2deg1 * oLonRad, rad2deg1 * oLatRad);
|
|
57
42
|
`)}
|
|
@@ -64,12 +49,12 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
64
49
|
? selectLocalOverlayUVs(projectOverlay(vPositionForDraping))
|
|
65
50
|
: selectMapOverlayUVs(overlayMapUVFromWorldPosition());
|
|
66
51
|
}
|
|
67
|
-
`)):F.code.add("vec2 projectOverlay(vec3 pos) { return pos.xy; }"));const
|
|
52
|
+
`)):F.code.add("vec2 projectOverlay(vec3 pos) { return pos.xy; }"));const de=J&&Z&&4===E;de&&(A.varyings.add("tbnTangent","vec3"),A.varyings.add("tbnBiTangent","vec3"),A.varyings.add("groundNormal","vec3"));const ce=0===Q,ve=2===Q;if(A.include(x,R),A.include(o,R),F.include(T),F.main.add(j`
|
|
68
53
|
bool castShadows;
|
|
69
54
|
vec4 externalColor = forwardExternalColor(castShadows);
|
|
70
|
-
${
|
|
71
|
-
${
|
|
72
|
-
${
|
|
55
|
+
${U(te,"if(!castShadows) { gl_Position = vec4(vec3(1e38), 1.0); return; }")}
|
|
56
|
+
${U(!ce,`if (externalColor.a ${ve?">":"<="} opacityCutoff) {\n gl_Position = vec4(vec3(1e38), 1.0); return;\n }`)}
|
|
57
|
+
${U(re,"externalColor.a = 1.0;")}
|
|
73
58
|
|
|
74
59
|
forwardPosition(readElevationOffset());
|
|
75
60
|
forwardNormal();
|
|
@@ -79,26 +64,26 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
79
64
|
forwardLinearDepthToWriteShadowMap();
|
|
80
65
|
forwardEmissiveStrength();
|
|
81
66
|
forwardObjectAndLayerIdColor();
|
|
82
|
-
${
|
|
67
|
+
${U(de,k?j`
|
|
83
68
|
groundNormal = normalize(positionWorld());
|
|
84
69
|
tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), groundNormal));
|
|
85
|
-
tbnBiTangent = normalize(cross(groundNormal, tbnTangent));`:
|
|
70
|
+
tbnBiTangent = normalize(cross(groundNormal, tbnTangent));`:j`
|
|
86
71
|
groundNormal = vec3(0.0, 0.0, 1.0);
|
|
87
72
|
tbnTangent = vec3(1.0, 0.0, 0.0);
|
|
88
73
|
tbnBiTangent = vec3(0.0, 1.0, 0.0);`)}
|
|
89
|
-
${
|
|
74
|
+
${U(J,U(k,"vPositionForDraping = positionForDraping();\n vtcOverlay = vec4(0.0);","setOverlayVTC(projectOverlay(positionForDraping()));"))}
|
|
90
75
|
|
|
91
76
|
if (externalColor.a < alphaCutoff) {
|
|
92
77
|
// Discard this vertex
|
|
93
78
|
gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
|
|
94
79
|
return;
|
|
95
80
|
}
|
|
96
|
-
`),Z)return A.include(
|
|
81
|
+
`),Z)return A.include(m,R),A.include(W,R),z.include(h,R),z.include(V,R),z.code.add(j`
|
|
97
82
|
float evaluateShadow() {
|
|
98
83
|
return ${H?"readShadowMap(vPositionWorldCameraRelative, linearDepth)":"0.0"};
|
|
99
84
|
}
|
|
100
|
-
`).main.add(
|
|
101
|
-
${
|
|
85
|
+
`).main.add(j`
|
|
86
|
+
${U(!Y,"discardBySlice(vPositionWorldCameraRelative);")}
|
|
102
87
|
|
|
103
88
|
vec4 textureColor = readBaseColorTexture();
|
|
104
89
|
discardOrAdjustAlpha(textureColor);
|
|
@@ -106,15 +91,15 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
106
91
|
// When rendering the occluded overlay, we still need to read the base color texture because we need to use the
|
|
107
92
|
// same discard logic. However after that to render only the draped overlay, we simply set the base texture color
|
|
108
93
|
// to zero.
|
|
109
|
-
${
|
|
94
|
+
${U(X,j`textureColor = vec4(0);`)}
|
|
110
95
|
|
|
111
|
-
${
|
|
112
|
-
vec4 overlayUVs = ${
|
|
96
|
+
${U(J,j`
|
|
97
|
+
vec4 overlayUVs = ${ne?"componentOverlayUVs()":"vtcOverlay"};
|
|
113
98
|
|
|
114
99
|
vec4 overlayColor = getOverlayColor(ovColorTex, overlayUVs);
|
|
115
100
|
|
|
116
101
|
/* Early discard to only emit when we have overlay */
|
|
117
|
-
${
|
|
102
|
+
${U(X,j`if (overlayColor.a < alphaCutoff) { discard; }`)}
|
|
118
103
|
`)}
|
|
119
104
|
|
|
120
105
|
vec4 externalColor;
|
|
@@ -122,47 +107,47 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
122
107
|
readExternalColor(externalColor, externalColorMixMode);
|
|
123
108
|
|
|
124
109
|
vec4 materialColor = computeMaterialColor(textureColor, externalColor, externalColorMixMode);
|
|
125
|
-
`),ee?(f(z),k&&
|
|
110
|
+
`),ee?(f(z),k&&w(z),z.main.add(j`
|
|
126
111
|
applyPBRFactors();
|
|
127
|
-
${
|
|
112
|
+
${U(1===E,j`if (externalColorMixMode == 3) {
|
|
128
113
|
mrr = vec3(0.0, 0.6, 0.2);
|
|
129
114
|
}`)}
|
|
130
115
|
float additionalIrradiance = 0.02 * mainLightIntensity[2];
|
|
131
|
-
${
|
|
132
|
-
vec3 shadingNormal = ${
|
|
133
|
-
vec3 groundNormal = ${k?
|
|
116
|
+
${U(I,"mat3 tangentSpace = computeTangentSpace(fragmentFaceNormal, vPositionWorldCameraRelative, vuv0);")}
|
|
117
|
+
vec3 shadingNormal = ${I?"computeTextureNormal(tangentSpace, vuv0)":"fragmentShadingNormal"};
|
|
118
|
+
vec3 groundNormal = ${k?j`normalize(positionWorld())`:j`vec3(0.0, 0.0, 1.0)`};
|
|
134
119
|
|
|
135
120
|
vec3 viewDir = normalize(vPositionWorldCameraRelative);
|
|
136
121
|
float ssao = 1.0 - occlusion * evaluateAmbientOcclusionInverse();
|
|
137
|
-
${
|
|
122
|
+
${U(_,j`float snow = getSnow(fragmentFaceNormal, normalize(positionWorld()));
|
|
138
123
|
materialColor.rgb = mix(materialColor.rgb, vec3(1.1), snow);
|
|
139
124
|
ssao = mix(ssao, 0.5 * ssao, snow);
|
|
140
125
|
shadingNormal = mix(shadingNormal, fragmentFaceNormal, snow);`)}
|
|
141
|
-
${
|
|
126
|
+
${U(J,"materialColor = materialColor * (1.0 - overlayColor.a) + overlayColor;")}
|
|
142
127
|
|
|
143
128
|
vec3 additionalLight = evaluateAdditionalLighting(ssao, positionWorld());
|
|
144
|
-
${
|
|
145
|
-
${k?
|
|
129
|
+
${U(k,"float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld());")}
|
|
130
|
+
${k?j`float shadow = max(lightingGlobalFactor * (1.0 - additionalAmbientScale), evaluateShadow());`:"float shadow = evaluateShadow();"}
|
|
146
131
|
vec4 shadedColor = vec4(evaluateSceneLightingPBR(shadingNormal, materialColor.rgb, shadow, ssao, additionalLight, viewDir, groundNormal, mrr, additionalIrradiance), materialColor.a);
|
|
147
|
-
`)):(
|
|
148
|
-
${
|
|
132
|
+
`)):(y(z),k&&w(z),de&&z.uniforms.add(new N("ovNormalTex",e=>e.overlay?.getTexture(3))),z.main.add(j`
|
|
133
|
+
${U(k,"float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld());")}
|
|
149
134
|
float shadow = ${H?k?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), evaluateShadow())":"evaluateShadow()":k?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
|
|
150
135
|
|
|
151
|
-
${
|
|
136
|
+
${U(H&&1!==G,j`
|
|
152
137
|
float dotFL = dot(fragmentFaceNormal, mainLightDirection);
|
|
153
138
|
if( dotFL <= 0.0) shadow = 1.0;
|
|
154
139
|
`)}
|
|
155
|
-
${
|
|
140
|
+
${U(_,j`float snow = getSnow(fragmentFaceNormal, normalize(positionWorld()));
|
|
156
141
|
materialColor.rgb = mix(materialColor.rgb, vec3(1), snow);`)}
|
|
157
142
|
|
|
158
143
|
// At global scale we create some additional ambient light based on the main light to simulate global illumination
|
|
159
144
|
float ssao = evaluateAmbientOcclusion();
|
|
160
145
|
vec3 additionalLight = evaluateAdditionalLighting(ssao, positionWorld());
|
|
161
146
|
|
|
162
|
-
${
|
|
147
|
+
${U(J,"materialColor = materialColor * (1.0 - overlayColor.a) + overlayColor;")}
|
|
163
148
|
|
|
164
149
|
vec4 shadedColor = vec4(evaluateSceneLighting(fragmentShadingNormal, materialColor.rgb, shadow, ssao, additionalLight), materialColor.a);
|
|
165
|
-
${
|
|
150
|
+
${U(de,j`vec4 overlayWaterMask = getOverlayColor(ovNormalTex, overlayUVs);
|
|
166
151
|
float waterNormalLength = length(overlayWaterMask);
|
|
167
152
|
if (waterNormalLength > 0.95) {
|
|
168
153
|
mat3 tbnMatrix = mat3(tbnTangent, tbnBiTangent, groundNormal);
|
|
@@ -171,15 +156,28 @@ import{ComponentData as e}from"../views/3d/webgl-engine/collections/Component/Ma
|
|
|
171
156
|
// un-gamma the ground color to mix in linear space
|
|
172
157
|
shadedColor = mix(shadedColor, waterColorNonLinear, waterColorLinear.w);
|
|
173
158
|
}`)}
|
|
174
|
-
`)),z.main.add(`\n ${
|
|
159
|
+
`)),z.main.add(`\n ${U(Y,"if(rejectBySlice(vPositionWorldCameraRelative)) shadedColor.a *= groundSliceOpacity;")}\n\n outputColorHighlightOLID(applySlice(shadedColor, vPositionWorldCameraRelative), materialColor.rgb ${U(_,", snow")});\n `),R.sphereDepthInterpolate&&(A.include(D,R),A.fragment.include(g),z.main.add(j`vec3 worldRay = normalize(vPositionWorldCameraRelative);
|
|
175
160
|
vec3 viewRay = normalize(vPosition_view);
|
|
176
|
-
gl_FragDepth = delinearizeDepth(sphereDepthInterpolate(worldRay, viewRay, linearizeDepth(gl_FragCoord.z)));`)),A;const
|
|
177
|
-
${
|
|
161
|
+
gl_FragDepth = delinearizeDepth(sphereDepthInterpolate(worldRay, viewRay, linearizeDepth(gl_FragCoord.z)));`)),A;const ge=oe||8===B;return ge&&A.include(d,R),le&&A.include(m,R),J&&A.include(v,R),A.include(c,R),z.main.add(j`
|
|
162
|
+
${U(!Y,"discardBySlice(vPositionWorldCameraRelative);")}
|
|
178
163
|
|
|
179
164
|
vec4 textureColor = readBaseColorTexture();
|
|
180
165
|
discardOrAdjustAlpha(textureColor);
|
|
181
166
|
|
|
182
|
-
${
|
|
183
|
-
${
|
|
184
|
-
|
|
185
|
-
|
|
167
|
+
${U(ge,"outputDepth(linearDepth);")}
|
|
168
|
+
${U(le,j`
|
|
169
|
+
vec4 externalColor;
|
|
170
|
+
int externalColorMixMode;
|
|
171
|
+
readExternalColor(externalColor, externalColorMixMode);
|
|
172
|
+
|
|
173
|
+
vec4 materialColor = computeMaterialColor(textureColor, externalColor, externalColorMixMode);
|
|
174
|
+
${U(Y,j`
|
|
175
|
+
if (rejectBySlice(vPositionWorldCameraRelative)) {
|
|
176
|
+
materialColor.a *= groundSliceOpacity;
|
|
177
|
+
}
|
|
178
|
+
`)}
|
|
179
|
+
|
|
180
|
+
fragColor = vec4(vec3(0.5) + 0.5 * fragmentFaceNormalView, materialColor.a);
|
|
181
|
+
`)}
|
|
182
|
+
${U(re,J?ne?"fragColor = getOverlayColorTexel(componentOverlayUVs());":"fragColor = getOverlayColorTexel();":"outputObjectAndLayerIdColor();")}
|
|
183
|
+
${U(ae,U(J,ne?j`calculateOcclusionAndOutputHighlight(getAllOverlayHighlightValuesEncoded(componentOverlayUVs()));`:j`calculateOcclusionAndOutputHighlight(getAllOverlayHighlightValuesEncoded());`,j`calculateOcclusionAndOutputHighlight();`))}`),A}const A=Object.freeze(Object.defineProperty({__proto__:null,build:R},Symbol.toStringTag,{value:"Module"}));export{A as C,R as b};
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{Offset as e}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.js";import{isColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as i}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
MaskedColor maskedColor =
|
|
6
|
-
applySymbolColor(applyVVColor(applyInstanceColor(createMaskedFromNaNColor(externalColor))));
|
|
7
|
-
|
|
8
|
-
vcolorExt = maskedColor.color;
|
|
9
|
-
forwardColorMixMode(maskedColor.mask);
|
|
2
|
+
import{Offset as e}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.js";import{isColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as i}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{InstancedDoublePrecision as a}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import{NormalAttribute as l}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as s}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormal as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VerticalOffset as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{DefaultMaterialAuxiliaryPasses as d}from"../views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import{DefaultMaterialExternalColor as g}from"../views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js";import{ComputeNormalTexturePass as c}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateAmbientOcclusion as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as u,addAmbientBoostFactor as v,addLightingGlobalFactor as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as w}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{Normals as h}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js";import{PhysicallyBasedRendering as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import{PhysicallyBasedRenderingParameters as f}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapPassFragment as y,ReadShadowMapDrawFragment as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{colorTextureUV as L,normalTextureUV as j,emissiveTextureUV as C,occlusionTextureUV as P,metallicRoughnessTextureUV as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js";import{VisualVariables as T}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{DiscardOrAdjustAlphaPass as O}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import{addProjViewLocalOrigin as N,addCameraPosition as V}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3PassUniform as A}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{If as M,glsl as D}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as $}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{SnowCover as B}from"../views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js";import{outputColorHighlightOLID as I}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as U}from"../views/webgl/ShaderBuilder.js";function _(_){const R=new U,{attributes:E,vertex:W,fragment:F,varyings:z}=R,{output:G,normalType:k,offsetBackfaces:H,spherical:q,snowCover:J,pbrMode:K,textureAlphaPremultiplied:Q,instancedDoublePrecision:X,hasVertexColors:Y,hasVertexTangents:Z,hasColorTexture:ee,hasNormalTexture:re,hasNormalTextureTransform:oe,hasColorTextureTransform:ie}=_;if(N(W,_),E.add("position","vec3"),W.inputs.add("position",()=>"position"),z.add("vpos","vec3",{invariant:!0}),R.include(T,_),R.include(a,_),R.include(t,_),R.include(L,_),!r(G))return R.include(d,_),R;R.include(j,_),R.include(C,_),R.include(P,_),R.include(S,_),V(W,_),R.include(l,_),R.include(i);const ae=0===k||1===k;return ae&&H&&R.include(e),R.include(c,_),R.include(n,_),z.add("vPositionLocal","vec3"),R.include(s,_),R.include(g,_),R.include(X?y:x,_),W.main.add(D`
|
|
3
|
+
forwardDefaultMaterialExternalColor();
|
|
10
4
|
|
|
11
5
|
vpos = getVertexInLocalOriginSpace();
|
|
12
6
|
vPositionLocal = vpos - view[3].xyz;
|
|
13
7
|
vpos = subtractOrigin(vpos);
|
|
14
|
-
${
|
|
8
|
+
${M(ae,"vNormalWorld = dpNormal(vvLocalNormal(normalModel()));")}
|
|
15
9
|
vpos = addVerticalOffset(vpos, localOrigin);
|
|
16
|
-
${
|
|
10
|
+
${M(Z,"vTangent = dpTransformVertexTangent(tangent);")}
|
|
17
11
|
gl_Position = transformPosition(proj, view, vpos);
|
|
18
|
-
${
|
|
12
|
+
${M(ae&&H,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
|
|
19
13
|
|
|
20
14
|
forwardTextureCoordinates();
|
|
21
15
|
forwardColorUV();
|
|
@@ -24,18 +18,18 @@ import{Offset as e}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.
|
|
|
24
18
|
forwardOcclusionUV();
|
|
25
19
|
forwardMetallicRoughnessUV();
|
|
26
20
|
|
|
27
|
-
if (
|
|
21
|
+
if (shouldCullByOpacity()) {
|
|
28
22
|
gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
|
|
29
23
|
}
|
|
30
24
|
forwardLinearDepthToReadShadowMap();
|
|
31
|
-
`),
|
|
25
|
+
`),F.include(u,_),F.include(m,_),R.include(O,_),F.include(o,_),R.include(I,_),V(F,_),F.uniforms.add(W.uniforms.get("localOrigin"),new A("ambient",e=>e.ambient),new A("diffuse",e=>e.diffuse)),ee&&F.uniforms.add(new $("tex",e=>e.texture)),R.include(f,_),F.include(p,_),R.include(h,_),F.include(B,_),v(F),b(F),w(F),F.main.add(D`
|
|
32
26
|
discardBySlice(vpos);
|
|
33
|
-
${
|
|
34
|
-
vec4 texColor = texture(tex, ${
|
|
35
|
-
${
|
|
36
|
-
discardOrAdjustAlpha(texColor);`:
|
|
27
|
+
${ee?D`
|
|
28
|
+
vec4 texColor = texture(tex, ${ie?"colorUV":"vuv0"});
|
|
29
|
+
${M(Q,"texColor.rgb /= texColor.a;")}
|
|
30
|
+
discardOrAdjustAlpha(texColor);`:D`vec4 texColor = vec4(1.0);`}
|
|
37
31
|
shadingParams.viewDirection = normalize(vpos - cameraPosition);
|
|
38
|
-
${2===
|
|
32
|
+
${2===k?D`vec3 normal = screenDerivativeNormal(vPositionLocal);`:D`shadingParams.normalView = vNormalWorld;
|
|
39
33
|
vec3 normal = shadingNormal(shadingParams);`}
|
|
40
34
|
applyPBRFactors();
|
|
41
35
|
float ssao = evaluateAmbientOcclusionInverse() * getBakedOcclusion();
|
|
@@ -46,13 +40,18 @@ import{Offset as e}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.
|
|
|
46
40
|
float shadow = readShadow(additionalAmbientScale, vpos);
|
|
47
41
|
|
|
48
42
|
vec3 matColor = max(ambient, diffuse);
|
|
49
|
-
vec3 albedo = mixExternalColor(
|
|
50
|
-
|
|
43
|
+
vec3 albedo = mixExternalColor(
|
|
44
|
+
${M(Y,"vColor.rgb *")} matColor,
|
|
45
|
+
texColor.rgb,
|
|
46
|
+
vExternalColor.rgb,
|
|
47
|
+
colorMixMode
|
|
48
|
+
);
|
|
49
|
+
float opacity_ = getDefaultMaterialOpacity(texColor.a);
|
|
51
50
|
|
|
52
|
-
${
|
|
53
|
-
vec3 normalGround = ${
|
|
51
|
+
${re?`mat3 tangentSpace = computeTangentSpace(${Z?"normal":"normal, vpos, vuv0"});\n vec3 shadingNormal = computeTextureNormal(tangentSpace, ${oe?"normalUV":"vuv0"});`:"vec3 shadingNormal = normal;"}
|
|
52
|
+
vec3 normalGround = ${q?"normalize(posWorld);":"vec3(0.0, 0.0, 1.0);"}
|
|
54
53
|
|
|
55
|
-
${
|
|
54
|
+
${M(J,D`
|
|
56
55
|
float snow = getSnow(normal, normalGround);
|
|
57
56
|
albedo = mix(albedo, vec3(1), snow);
|
|
58
57
|
shadingNormal = mix(shadingNormal, normal, snow);
|
|
@@ -60,10 +59,10 @@ import{Offset as e}from"../views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.
|
|
|
60
59
|
|
|
61
60
|
vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
|
|
62
61
|
|
|
63
|
-
${1===
|
|
62
|
+
${1===K||2===K?D`
|
|
64
63
|
float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
|
|
65
|
-
${
|
|
66
|
-
vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);`:7===
|
|
64
|
+
${M(J,"mrr = applySnowToMRR(mrr, snow);")}
|
|
65
|
+
vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);`:7===K?D`vec3 shadedColor = albedo;`:D`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
|
|
67
66
|
vec4 finalColor = vec4(shadedColor, opacity_);
|
|
68
|
-
outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${
|
|
69
|
-
`),
|
|
67
|
+
outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${M(J,", snow")});
|
|
68
|
+
`),R}const R=Object.freeze(Object.defineProperty({__proto__:null,build:_},Symbol.toStringTag,{value:"Module"}));export{R as D,_ as b};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
2
|
+
import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{RejectBySlicePass as n}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{EvaluateSceneLighting as i,addAmbientBoostFactor as t,addLightingGlobalFactor as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{NormalUtils as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{positionOutsideClipSpace as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{ReadShadowMapPassFragment as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{GaussianSplatCovariance as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js";import{GaussianSplatEvaluation as d}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js";import{GaussianSplatTextureFetch as g}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js";import{GaussianSplatUnpacking as p}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import{QuaternionToRotationMatrix as u}from"../views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import{RgbNormalizedDepthEncoding as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbNormalizedDepthEncoding.glsl.js";import{Float2BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float2PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float3BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{Float3PassUniform as w}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as x}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as b,If as y}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as P}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintPassUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{getGaussianSplatAlphaCutoffValue as S}from"../views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";import{ShaderBuilder as M}from"../views/webgl/ShaderBuilder.js";function j(a){const{clippingEnabled:j,hasSlicePlane:z,receiveShadows:F,spherical:G}=a,D=new M;D.varyings.add("vColor","vec4"),D.varyings.add("conicOpacity","vec4"),D.varyings.add("gaussianLogAlphaCutoff","float"),D.varyings.add("offsetFromCenter","vec2"),R(a)&&D.varyings.add("fragmentPositionCameraRelative","vec3"),D.vertex.uniforms.add(new C("splatOrderTexture",e=>e.splatOrder),new C("splatFadingTexture",e=>e.splatFading),new C("splatAtlasTexture",e=>e.splatAtlas),new C("splatHeaderTexture",e=>e.splatHeader),new x("focalLength",e=>e.focalLength),new x("minSplatRadius",e=>e.minSplatRadius),new v("tanFov",e=>e.tanFov),new f("inverseScreenSize",({camera:a})=>e(L,1/a.fullWidth,1/a.fullHeight)),new P("proj",e=>e.camera.projectionMatrix),new P("view",e=>e.camera.viewMatrix),new f("nearFar",e=>e.camera.nearFar),new h("cameraPosition",e=>e.camera.eye)),j&&(D.vertex.uniforms.add(new w("clipMin",e=>e.clipMinCameraRelative),new w("clipMax",e=>e.clipMaxCameraRelative)),D.fragment.uniforms.add(new w("clipMin",e=>e.clipMinCameraRelative),new w("clipMax",e=>e.clipMaxCameraRelative))),D.vertex.include(p),D.vertex.include(g),D.vertex.include(u),D.vertex.include(c),D.vertex.include(d),D.vertex.include(n,a),F?(D.fragment.uniforms.add(new h("cameraPosition",e=>e.camera.eye)),D.fragment.include(i,a)):D.vertex.include(i,a),D.include(r,a),t(F?D.fragment:D.vertex),o(F?D.fragment:D.vertex),F&&D.include(l,a),D.outputs.add("fragColor","vec4",0),D.outputs.add("fragDepthColor","vec4",1);const A=S(a.alphaCutoff),T=Math.log(A),B=b`float groundLightAlignment = dot(groundNormal, mainLightDirection);
|
|
3
3
|
float additionalAmbientScale = additionalDirectedAmbientLight(groundLightAlignment);
|
|
4
|
-
vec3 additionalLight = mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;`,$=
|
|
5
|
-
vec3 groundNormal = ${
|
|
4
|
+
vec3 additionalLight = mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;`,$=b`
|
|
5
|
+
vec3 groundNormal = ${G?b`normalize(cameraRelativePosition + cameraPosition)`:b`vec3(0.0, 0.0, 1.0)`};
|
|
6
6
|
${B}
|
|
7
|
-
float shadow = ${
|
|
7
|
+
float shadow = ${G?b`lightingGlobalFactor * (1.0 - additionalAmbientScale)`:b`0.0`};
|
|
8
8
|
vColor.rgb = evaluateSceneLighting(groundNormal, vColor.rgb, shadow, 0.0, additionalLight);
|
|
9
|
-
`,E=
|
|
10
|
-
vec3 groundNormal = ${
|
|
9
|
+
`,E=b`
|
|
10
|
+
vec3 groundNormal = ${G?b`normalize(fragmentPositionCameraRelative + cameraPosition)`:b`vec3(0.0, 0.0, 1.0)`};
|
|
11
11
|
${B}
|
|
12
12
|
float shadow = readShadow(additionalAmbientScale, fragmentPositionCameraRelative);
|
|
13
13
|
shadedColor = evaluateSceneLighting(groundNormal, vColor.rgb, shadow, 0.0, additionalLight);
|
|
14
|
-
`;return D.vertex.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n uint pageNum = fetchGaussianPageIndex(gaussianIndex);\n\n // Unpack color first so very transparent splats can discard before fetching the page header.\n vColor = unpackColor(packedGaussian);\n\n // Apply per-page fading before the early alpha rejection.\n ${
|
|
14
|
+
`;return D.vertex.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n uint pageNum = fetchGaussianPageIndex(gaussianIndex);\n\n // Unpack color first so very transparent splats can discard before fetching the page header.\n vColor = unpackColor(packedGaussian);\n\n // Apply per-page fading before the early alpha rejection.\n ${y(a.fadingEnabled,"\n uint fadingTextureWidth = uint(textureSize(splatFadingTexture, 0).x);\n uint fadeX = pageNum % fadingTextureWidth;\n uint fadeY = pageNum / fadingTextureWidth;\n uint opacityModifierByte = texelFetch(splatFadingTexture, ivec2(fadeX , fadeY), 0).r;\n float opacityModifier = float(opacityModifierByte) / 255.0;\n vColor.a *= opacityModifier;\n ")}\n\n // Set default position outside clip space for early returns.\n gl_Position = ${s};\n\n if (vColor.a < ${A}) {\n return;\n }\n\n // Delay the page header fetch until the splat survives the opacity reject.\n vec3 cameraRelativePosition = fetchGaussianCameraRelativePosition(gaussianIndex, packedGaussian);\n\n ${y(j,"\n if (cameraRelativePosition.x < clipMin.x || cameraRelativePosition.y < clipMin.y || cameraRelativePosition.z < clipMin.z ||\n cameraRelativePosition.x > clipMax.x || cameraRelativePosition.y > clipMax.y || cameraRelativePosition.z > clipMax.z) {\n return;\n }\n ")}\n\n ${y(z,"if (rejectBySlice(cameraRelativePosition)) {\n return;\n }")}\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1);\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n return;\n }\n\n vec3 covarianceA;\n vec3 covarianceB;\n computePackedGaussianCovariance3D(packedGaussian, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec3 covariance2D = computeGaussianCovariance2D(viewPos.xyz, focalLength, tanFov, covariance3D, view);\n\n // Reject degenerate covariances before inverting them into conic coefficients.\n float determinant = computeGaussianCovarianceDeterminant(covariance2D);\n if (determinant <= 0.) {\n return;\n }\n\n vec2 eigenvalues = computeGaussianCovarianceEigenvalues(covariance2D);\n\n // Fold the per-splat opacity into the log cutoff so the vertex-side ellipse\n // bound matches the fragment alpha discard after fading.\n gaussianLogAlphaCutoff = ${T} - log(vColor.a);\n float gaussianEllipseThreshold = computeGaussianEllipseThreshold(gaussianLogAlphaCutoff);\n vec2 axisLengths = computeGaussianAxisLengths(eigenvalues, gaussianEllipseThreshold);\n float maxRadius = max(axisLengths.x, axisLengths.y);\n\n // Ignore Gaussians with very small contribution, with tolerance based on the quality profile.\n if (rejectGaussianByMinimumRadius(maxRadius, vColor.a, minSplatRadius)) {\n return;\n }\n\n vec4 projPos = proj * viewPos;\n float invW = 1. / (projPos.w + 1e-7);\n vec3 ndcPos = projPos.xyz * invW;\n vec2 clipSpacePixelScale = 2.0 * inverseScreenSize;\n\n // Cull splats whose screen-space ellipse cannot touch the viewport.\n if (rejectGaussianByScreenBounds(ndcPos.xy, maxRadius, clipSpacePixelScale)) {\n return;\n }\n\n offsetFromCenter = computeGaussianQuadOffset(covariance2D, eigenvalues, axisLengths, gl_VertexID);\n\n ${y(R(a),"float viewSpacePixelScale = -viewPos.z / focalLength;\n vec3 fragmentViewOffset = vec3(offsetFromCenter * viewSpacePixelScale, 0.0);\n fragmentPositionCameraRelative = cameraRelativePosition + transpose(mat3(view)) * fragmentViewOffset;")}\n\n // Store conic coefficients with opacity for fragment-side falloff.\n vec3 conic = computeGaussianConic(covariance2D, determinant);\n conicOpacity = vec4(conic, vColor.a);\n\n // Handle environment lighting per vertex when no shadow map is active.\n // When shadows are received, defer lighting to the fragment shader for crisp shadow borders.\n ${y(F,"forwardLinearDepth(-viewPos.z);",$)}\n\n // Place this quad corner in clip space around the projected splat center.\n vec2 quadClipPosition = ndcPos.xy + offsetFromCenter * clipSpacePixelScale - inverseScreenSize;\n\n gl_Position = vec4(quadClipPosition, ndcPos.z, 1.0);\n\n `),D.fragment.include(m),D.fragment.include(d),D.fragment.include(n,a),D.fragment.main.add(`\n ${y(j,"if (fragmentPositionCameraRelative.x < clipMin.x || fragmentPositionCameraRelative.y < clipMin.y || fragmentPositionCameraRelative.z < clipMin.z ||\n fragmentPositionCameraRelative.x > clipMax.x || fragmentPositionCameraRelative.y > clipMax.y || fragmentPositionCameraRelative.z > clipMax.z) {\n discard;\n }")}\n ${y(z,"if (rejectBySlice(fragmentPositionCameraRelative)) { discard; }")}\n\n float gaussianExponent = evaluateGaussianExponent(conicOpacity.xyz, offsetFromCenter);\n\n // A positive exponent indicates alpha > 1, which should not happen.\n // We also early check the opacity-aware alpha cutoff to avoid unnecessary exp().\n if (gaussianExponent > 0.0 || gaussianExponent < gaussianLogAlphaCutoff) {\n discard;\n }\n\n float gaussianFalloff = exp(gaussianExponent);\n\n // Cap at 0.99 to avoid blending issues, such as seams between overlapping Gaussians.\n float alpha = min(.99f, conicOpacity.w * gaussianFalloff);\n\n vec3 shadedColor = vColor.rgb;\n ${y(F,E)}\n fragColor = vec4(shadedColor * alpha, alpha);\n\n // We simulate first hit based depth using 0.25 as the opacity threshold.\n // This works because we render in front-to-back order,\n // i.e. the first hit that counts completely saturates the alpha channel\n // and further splats do not contribute.\n float depthHit = step(0.25, alpha);\n float normalizedDepth = gl_FragCoord.z;\n fragDepthColor = vec4(encodeNormalizedDepthToRGB(normalizedDepth) * depthHit, depthHit);\n `),D}function R({clippingEnabled:e,hasSlicePlane:a,receiveShadows:n}){return n||a||e}const L=a(),z=Object.freeze(Object.defineProperty({__proto__:null,build:j},Symbol.toStringTag,{value:"Module"}));export{z as G,j as b};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
2
|
+
import{set as e}from"../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{RejectBySlicePass as i}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{positionOutsideClipSpace as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{GaussianSplatCovariance as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js";import{GaussianSplatEvaluation as o}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js";import{GaussianSplatTextureFetch as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js";import{GaussianSplatUnpacking as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import{QuaternionToRotationMatrix as t}from"../views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import{Float2BindUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float3PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as p,If as u}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DUintPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{ShaderBuilder as x}from"../views/webgl/ShaderBuilder.js";function g(a){const{clippingEnabled:g,hasSlicePlane:h}=a,S=new x,{fragment:P,varyings:j,vertex:y}=S;j.add("conic","vec3"),j.add("gaussianLogAlphaCutoff","float"),j.add("offsetFromCenter","vec2"),y.uniforms.add(new m("splatOrderTexture",e=>e.splatOrder),new m("splatAtlasTexture",e=>e.splatAtlas),new m("splatHeaderTexture",e=>e.splatHeader),new d("minSplatRadius",e=>e.minSplatRadius),new l("inverseScreenSize",({camera:a})=>e(w,1/a.fullWidth,1/a.fullHeight)),new f("proj",e=>e.camera.projectionMatrix),new f("view",e=>e.camera.viewMatrix),new l("nearFar",e=>e.camera.nearFar)),g&&y.uniforms.add(new v("clipMin",e=>e.clipMinCameraRelative),new v("clipMax",e=>e.clipMaxCameraRelative)),y.include(s),y.include(c),y.include(t),y.include(r),y.include(o),y.include(i,a),y.code.add(p`float safeClipW(float clipW) {
|
|
3
3
|
return abs(clipW) < 1e-7 ? (clipW < 0.0 ? -1e-7 : 1e-7) : clipW;
|
|
4
|
-
}`),y.code.add(
|
|
4
|
+
}`),y.code.add(p`vec3 computeProjectivePixelGradient(
|
|
5
5
|
vec3 clipGradient,
|
|
6
6
|
vec3 clipWGradient,
|
|
7
7
|
float clipValue,
|
|
@@ -10,13 +10,13 @@ float invWSquared,
|
|
|
10
10
|
float halfScreenSize
|
|
11
11
|
) {
|
|
12
12
|
return (clipGradient * safeW - clipValue * clipWGradient) * invWSquared * halfScreenSize;
|
|
13
|
-
}`),y.code.add(
|
|
13
|
+
}`),y.code.add(p`vec3 multiplyCovariance3D(float[6] covariance3D, vec3 value) {
|
|
14
14
|
return vec3(
|
|
15
15
|
covariance3D[0] * value.x + covariance3D[1] * value.y + covariance3D[2] * value.z,
|
|
16
16
|
covariance3D[1] * value.x + covariance3D[3] * value.y + covariance3D[4] * value.z,
|
|
17
17
|
covariance3D[2] * value.x + covariance3D[4] * value.y + covariance3D[5] * value.z
|
|
18
18
|
);
|
|
19
|
-
}`),y.code.add(
|
|
19
|
+
}`),y.code.add(p`vec3 computeProjectiveCovariance2D(vec3 pixelXGradient, vec3 pixelYGradient, float[6] covariance3D, mat4 view) {
|
|
20
20
|
mat3 worldToView = transpose(mat3(view));
|
|
21
21
|
vec3 axisX = worldToView * pixelXGradient;
|
|
22
22
|
vec3 axisY = worldToView * pixelYGradient;
|
|
@@ -27,15 +27,15 @@ float covarianceXX = dot(axisX, covarianceAxisX) + regularization;
|
|
|
27
27
|
float covarianceXY = dot(axisX, covarianceAxisY);
|
|
28
28
|
float covarianceYY = dot(axisY, covarianceAxisY) + regularization;
|
|
29
29
|
return vec3(covarianceXX, covarianceXY, covarianceYY);
|
|
30
|
-
}`),y.code.add(
|
|
30
|
+
}`),y.code.add(p`float biasDepth(float linearDepth) {
|
|
31
31
|
const float bias = 80.0 * .000015259;
|
|
32
32
|
return min(linearDepth + bias, 1.0);
|
|
33
|
-
}`);const G=.25,D=Math.log(G);return y.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n\n float opacity = unpackOpacity(packedGaussian);\n\n gl_Position = ${
|
|
33
|
+
}`);const G=.25,D=Math.log(G);return y.main.add(`\n uint gaussianIndex = fetchOrderedGaussianIndex(uint(gl_InstanceID));\n uvec4 packedGaussian = fetchPackedGaussian(gaussianIndex);\n\n float opacity = unpackOpacity(packedGaussian);\n\n gl_Position = ${n};\n\n if (opacity < ${G}) {\n return;\n }\n\n vec3 cameraRelativePosition = fetchGaussianCameraRelativePosition(gaussianIndex, packedGaussian);\n\n ${u(g,p`if (cameraRelativePosition.x < clipMin.x || cameraRelativePosition.y < clipMin.y || cameraRelativePosition.z < clipMin.z ||
|
|
34
34
|
cameraRelativePosition.x > clipMax.x || cameraRelativePosition.y > clipMax.y || cameraRelativePosition.z > clipMax.z) {
|
|
35
35
|
return;
|
|
36
|
-
}`)}\n\n ${
|
|
36
|
+
}`)}\n\n ${u(h,p`if (rejectBySlice(cameraRelativePosition)) {
|
|
37
37
|
return;
|
|
38
|
-
}`)}\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1.0);\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n return;\n }\n\n vec3 covarianceA;\n vec3 covarianceB;\n computePackedGaussianCovariance3D(packedGaussian, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec4 projPos = proj * viewPos;\n float safeW = safeClipW(projPos.w);\n float invWSquared = 1.0 / (safeW * safeW);\n vec2 halfScreenSize = 0.5 / inverseScreenSize;\n float maxShadowSplatRadius = max(halfScreenSize.x, halfScreenSize.y);\n\n // Projection matrix columns are the clip-space derivatives with respect to view-space xyz.\n vec3 clipWGradient = vec3(proj[0][3], proj[1][3], proj[2][3]);\n vec3 pixelXGradient = computeProjectivePixelGradient(\n vec3(proj[0][0], proj[1][0], proj[2][0]),\n clipWGradient,\n projPos.x,\n safeW,\n invWSquared,\n halfScreenSize.x\n );\n vec3 pixelYGradient = computeProjectivePixelGradient(\n vec3(proj[0][1], proj[1][1], proj[2][1]),\n clipWGradient,\n projPos.y,\n safeW,\n invWSquared,\n halfScreenSize.y\n );\n vec3 covariance2D = computeProjectiveCovariance2D(pixelXGradient, pixelYGradient, covariance3D, view);\n\n float determinant = computeGaussianCovarianceDeterminant(covariance2D);\n if (determinant <= 0.0) {\n return;\n }\n\n vec2 eigenvalues = computeGaussianCovarianceEigenvalues(covariance2D);\n\n gaussianLogAlphaCutoff = ${D} - log(opacity);\n float gaussianEllipseThreshold = computeGaussianEllipseThreshold(gaussianLogAlphaCutoff);\n vec2 axisLengths = computeGaussianAxisLengths(eigenvalues, gaussianEllipseThreshold);\n float maxRadius = max(axisLengths.x, axisLengths.y);\n\n // Avoid invalid/extremely large footprints.\n if (maxRadius < 0.0 || maxRadius > maxShadowSplatRadius) {\n return;\n }\n\n if (rejectGaussianByMinimumRadius(maxRadius, opacity, minSplatRadius)) {\n return;\n }\n\n vec3 ndcPos = projPos.xyz / safeW;\n vec2 clipSpacePixelScale = 2.0 * inverseScreenSize;\n\n if (rejectGaussianByScreenBounds(ndcPos.xy, maxRadius, clipSpacePixelScale)) {\n return;\n }\n\n offsetFromCenter = computeGaussianQuadOffset(covariance2D, eigenvalues, axisLengths, gl_VertexID);\n conic = computeGaussianConic(covariance2D, determinant);\n float linearDepth = (-viewPos.z - nearFar.x) / (nearFar.y - nearFar.x);\n float biasedDepth = biasDepth(linearDepth);\n\n vec2 clipPos = ndcPos.xy + offsetFromCenter * clipSpacePixelScale - inverseScreenSize;\n gl_Position = vec4(clipPos, biasedDepth * 2.0 - 1.0, 1.0);\n `),
|
|
38
|
+
}`)}\n\n vec4 viewPos = vec4(mat3(view) * cameraRelativePosition, 1.0);\n\n if (viewPos.z > -nearFar.x || viewPos.z < -nearFar.y) {\n return;\n }\n\n vec3 covarianceA;\n vec3 covarianceB;\n computePackedGaussianCovariance3D(packedGaussian, covarianceA, covarianceB);\n\n float covariance3D[6] = float[6](covarianceA.x, covarianceA.y, covarianceA.z, covarianceB.x, covarianceB.y, covarianceB.z);\n\n vec4 projPos = proj * viewPos;\n float safeW = safeClipW(projPos.w);\n float invWSquared = 1.0 / (safeW * safeW);\n vec2 halfScreenSize = 0.5 / inverseScreenSize;\n float maxShadowSplatRadius = max(halfScreenSize.x, halfScreenSize.y);\n\n // Projection matrix columns are the clip-space derivatives with respect to view-space xyz.\n vec3 clipWGradient = vec3(proj[0][3], proj[1][3], proj[2][3]);\n vec3 pixelXGradient = computeProjectivePixelGradient(\n vec3(proj[0][0], proj[1][0], proj[2][0]),\n clipWGradient,\n projPos.x,\n safeW,\n invWSquared,\n halfScreenSize.x\n );\n vec3 pixelYGradient = computeProjectivePixelGradient(\n vec3(proj[0][1], proj[1][1], proj[2][1]),\n clipWGradient,\n projPos.y,\n safeW,\n invWSquared,\n halfScreenSize.y\n );\n vec3 covariance2D = computeProjectiveCovariance2D(pixelXGradient, pixelYGradient, covariance3D, view);\n\n float determinant = computeGaussianCovarianceDeterminant(covariance2D);\n if (determinant <= 0.0) {\n return;\n }\n\n vec2 eigenvalues = computeGaussianCovarianceEigenvalues(covariance2D);\n\n gaussianLogAlphaCutoff = ${D} - log(opacity);\n float gaussianEllipseThreshold = computeGaussianEllipseThreshold(gaussianLogAlphaCutoff);\n vec2 axisLengths = computeGaussianAxisLengths(eigenvalues, gaussianEllipseThreshold);\n float maxRadius = max(axisLengths.x, axisLengths.y);\n\n // Avoid invalid/extremely large footprints.\n if (maxRadius < 0.0 || maxRadius > maxShadowSplatRadius) {\n return;\n }\n\n if (rejectGaussianByMinimumRadius(maxRadius, opacity, minSplatRadius)) {\n return;\n }\n\n vec3 ndcPos = projPos.xyz / safeW;\n vec2 clipSpacePixelScale = 2.0 * inverseScreenSize;\n\n if (rejectGaussianByScreenBounds(ndcPos.xy, maxRadius, clipSpacePixelScale)) {\n return;\n }\n\n offsetFromCenter = computeGaussianQuadOffset(covariance2D, eigenvalues, axisLengths, gl_VertexID);\n conic = computeGaussianConic(covariance2D, determinant);\n float linearDepth = (-viewPos.z - nearFar.x) / (nearFar.y - nearFar.x);\n float biasedDepth = biasDepth(linearDepth);\n\n vec2 clipPos = ndcPos.xy + offsetFromCenter * clipSpacePixelScale - inverseScreenSize;\n gl_Position = vec4(clipPos, biasedDepth * 2.0 - 1.0, 1.0);\n `),P.include(o),P.main.add(p`float gaussianExponent = evaluateGaussianExponent(conic, offsetFromCenter);
|
|
39
39
|
if (gaussianExponent > 0.0 || gaussianExponent < gaussianLogAlphaCutoff) {
|
|
40
40
|
discard;
|
|
41
|
-
}`),
|
|
41
|
+
}`),S}const w=a(),h=Object.freeze(Object.defineProperty({__proto__:null,build:g},Symbol.toStringTag,{value:"Module"}));export{h as G,g as b};
|