@arcgis/core 5.1.0-next.72 → 5.1.0-next.73

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 (104) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{b801631b58e6fc6cec8a.js → 0ae360bf253adee46737.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{b495f14d90abe8d1a558.js → 12e575a6d2b008b8fc2b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{61ef14e42bc09b787d89.js → 13e60f19f436b8d683ae.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{7e6ccf9f3e756186e93e.js → 29e76256e3e867e80520.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{bea70be8e38b8c83ccd2.js → 30f04dc001eaf838d64c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{628f56c09838eb9c573b.js → 422824e407b550170c8c.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{68b47a5a50e0b5fffca2.js → 5c663d5f98bdfa29151b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{ae0a572cbbdd9815ee2e.js → 62b3e933f548ce354b99.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6f9ea461c268c421f9c9.js → 7951d93f5f15aa76f49c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b79058f5bda6fcac22f8.js → 80ace1c7203c5059525d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b92794def31592a6a25f.js → 8d75f6f27c1c17c33992.js} +1 -1
  13. package/assets/esri/core/workers/chunks/95d82c619dcbec2e1050.js +1 -0
  14. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +2 -0
  15. package/assets/esri/core/workers/chunks/{02876e434dc91c42b2f4.js → a78bc340a794fd332667.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1edd39c7c4acdc591d10.js → a809b811121099a87a98.js} +1 -1
  17. package/assets/esri/core/workers/chunks/abdf146b35e179b5b245.js +1 -0
  18. package/assets/esri/core/workers/chunks/{d2aa75816e84b1e7fd25.js → afc0baf86ece710ef867.js} +1 -1
  19. package/assets/esri/core/workers/chunks/b6cadb8a579241adcb86.js +1 -0
  20. package/assets/esri/core/workers/chunks/{3cd9bd20e75ba4d5b294.js → b9848bdbaf3d9ac93d54.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{b475f5492c6e3fd4cca8.js → bef27a25fbc4a6e19ec0.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{a65d576e90179a2b5400.js → c5507480344176fad241.js} +1 -1
  23. package/assets/esri/core/workers/chunks/c70df6ed190f9ebcf6aa.js +1 -0
  24. package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +1 -0
  25. package/assets/esri/core/workers/chunks/{dec6d41d614105e6fd93.js → cfe246adb5e6cb6f0cfc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{91a0227a64a944af3286.js → d17fcfc502f0e0fa6523.js} +2 -2
  27. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +2 -0
  28. package/assets/esri/core/workers/chunks/{aa1a3a849aba84cf585b.js → e1bc9ad767e08dc18bbc.js} +1 -1
  29. package/assets/esri/core/workers/chunks/e25a684eb9f025bdcc01.js +1 -0
  30. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +1312 -0
  31. package/assets/esri/core/workers/chunks/{0d96e39380fd84cea9ba.js → f207b3be0714cc50030a.js} +1 -1
  32. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{c1838822b096d5f36a8b.js → f5c57ff48ca505ed701d.js} +1 -1
  34. package/chunks/GlobalIllumination.glsl.js +186 -116
  35. package/chunks/GlobalIlluminationBlur.glsl.js +81 -61
  36. package/chunks/GlobalIlluminationUpscale.glsl.js +66 -0
  37. package/config.js +1 -1
  38. package/form/elements/FieldElement.d.ts +3 -2
  39. package/form/elements/inputs/Input.d.ts +1 -1
  40. package/form/elements/inputs/MultipleChoiceInput.d.ts +65 -0
  41. package/form/elements/inputs/MultipleChoiceInput.js +2 -0
  42. package/form/elements/inputs/inputUtils.js +1 -1
  43. package/form/elements/inputs/multipleChoice/Choice.d.ts +30 -0
  44. package/form/elements/inputs/multipleChoice/Choice.js +2 -0
  45. package/form/elements/inputs/multipleChoice/OtherChoice.d.ts +28 -0
  46. package/form/elements/inputs/multipleChoice/OtherChoice.js +2 -0
  47. package/form/elements/inputs.d.ts +11 -2
  48. package/form/elements/inputs.js +1 -1
  49. package/form/support/formUtils.js +1 -1
  50. package/interfaces.d.ts +28 -0
  51. package/kernel.js +1 -1
  52. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  53. package/package.json +2 -2
  54. package/support/revision.js +1 -1
  55. package/third-party-notices.txt +7 -29
  56. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  57. package/views/3d/environment/EnvironmentManager.js +1 -1
  58. package/views/3d/layers/I3SMeshView3D.js +1 -1
  59. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  60. package/views/3d/support/orientedBoundingBox.js +1 -1
  61. package/views/3d/terrain/TerrainRenderer.js +1 -1
  62. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  63. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +21 -0
  64. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +11 -7
  65. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +2 -0
  66. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  67. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +2 -0
  68. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  69. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  70. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +2 -0
  71. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +2 -0
  72. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  73. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  74. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  75. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  76. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  77. package/views/interactive/sketch/SketchOptions.d.ts +3 -1
  78. package/views/interactive/sketch/SketchTooltipOptions.d.ts +6 -0
  79. package/views/support/Scheduler.js +1 -1
  80. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  81. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  82. package/widgets/BatchAttributeForm/inputs/SingleFeatureInputAdapter.js +2 -0
  83. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +28 -4
  84. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  85. package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +2 -0
  86. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  87. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  88. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  89. package/widgets/Search/support/layerSearchUtils.js +1 -1
  90. package/widgets/support/widgetUtils.js +1 -1
  91. package/assets/esri/core/workers/chunks/85edbb072a2ce6c1bb30.js +0 -2
  92. package/assets/esri/core/workers/chunks/943cf0653a2b7de16a4f.js +0 -1
  93. package/assets/esri/core/workers/chunks/a37fc886227365f7ecd5.js +0 -1
  94. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +0 -1
  95. package/assets/esri/core/workers/chunks/d4a9eb4470cc6a1f67fc.js +0 -2
  96. package/assets/esri/core/workers/chunks/dca595fdd5e1a571e441.js +0 -1
  97. package/assets/esri/core/workers/chunks/de583214195eff13cb00.js +0 -1140
  98. package/assets/esri/core/workers/chunks/df8143b72ef94806c992.js +0 -1
  99. package/assets/esri/core/workers/chunks/ef013a77950c1902de11.js +0 -1
  100. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +0 -7
  101. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +0 -2
  102. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +0 -2
  103. /package/assets/esri/core/workers/chunks/{85edbb072a2ce6c1bb30.js.LICENSE.txt → 9eb4ae556950e1d0124d.js.LICENSE.txt} +0 -0
  104. /package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js.LICENSE.txt → d65b1234867f7d773d50.js.LICENSE.txt} +0 -0
@@ -1,117 +1,187 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as i}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{EncodeEmissionColors as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js";import{addMainLightDirection as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceReflections as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import{CameraSpace as a}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as s,If as l}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as u}from"../views/webgl/NoParameters.js";import{ShaderBuilder as p}from"../views/webgl/ShaderBuilder.js";class g extends u{constructor(){super(...arguments),this.projScale=1,this.frameCount=0}}function h(u){const g=new p,h=g.fragment;return g.include(e),g.include(a),r(h),h.include(i),g.include(t,{highStepCount:!1,screenSpaceReflections:!0}),h.include(o),h.uniforms.add(new d("normalMap",e=>e.normalTexture),new d("depthMap",e=>e.depthTexture),new d("lastFrameDepthTexture",(e,i)=>i.reprojection.lastFrameDepth?.attachment),new m("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new c("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new c("view",e=>e.camera.viewMatrix),new n("frameCount",e=>e.frameCount),new d("blueNoiseTex",e=>e.noiseTexture)),u.hasEmission&&h.uniforms.add(new d("lastFrameEmissionTexture",(e,i)=>i.reprojection.lastFrameEmission?.attachment)),h.constants.add("timeSamplesSize","float",64),h.constants.add("blueNoiseGridSize","float",8),h.code.add(s`vec4 randomDirection(float index) {
3
- vec2 textureOffset = vec2(mod(index, blueNoiseGridSize), floor(index / blueNoiseGridSize)) * timeSamplesSize;
4
- ivec2 iuv = ivec2(textureOffset + mod(gl_FragCoord.xy, vec2(timeSamplesSize)));
5
- vec4 blueNoiseValue = texelFetch(blueNoiseTex, iuv, 0);
6
- return 2.0 * blueNoiseValue - 1.0;
7
- }
8
- vec3 sampleCosineHemisphere(vec2 u) {
9
- float phi = 6.28318530718 * u.x;
10
- float radius = sqrt(u.y);
11
- float x = radius * cos(phi);
12
- float y = radius * sin(phi);
13
- float z = sqrt(max(0.0, 1.0 - u.y));
14
- return vec3(x, y, z);
15
- }
16
- mat3 basisFromNormal(vec3 n) {
17
- vec3 up = abs(n.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
18
- vec3 tangent = normalize(cross(up, n));
19
- vec3 bitangent = cross(n, tangent);
20
- return mat3(tangent, bitangent, n);
21
- }`),h.main.add(s`
22
- float depth = depthFromTexture(depthMap, uv);
23
-
24
- // Early out if depth is out of range, such as in the sky
25
- if (depth >= 1.0 || depth <= 0.0) {
26
- fragColor = vec4(0.0, 0.0, 0.0, 1.0);
27
- return;
28
- }
29
-
30
- // Get the normal of current fragment
31
- ivec2 iuv = ivec2(uv * vec2(textureSize(normalMap, 0)));
32
- vec4 normal4 = texelFetch(normalMap, iuv, 0);
33
- if(normal4.a != 1.0) {
34
- fragColor = vec4(0.0, 0.0, 0.0, 1.0);
35
- return;
36
- }
37
- vec3 normal = normalize(normal4.xyz * 2.0 - 1.0);
38
-
39
- // Reconstruct view space position of current fragment
40
- float currentPixelDepth = linearizeDepth(depth);
41
- vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy, currentPixelDepth);
42
- vec4 viewPos = vec4(currentPixelPos, 1.0);
43
-
44
- // Reproject current view position to last frame
45
- vec4 reprojectedViewPos = reprojectionViewMatrix * viewPos;
46
- vec4 reprojectedCoordinate = applyProjectionMat(proj, reprojectedViewPos.xyz);
47
-
48
- // Read last frame reprojected depth and GI value.
49
- float lastFrameDepthViewPos = -linearDepthFromTextureLastFrame(lastFrameDepthTexture, reprojectedCoordinate.xy);
50
- vec4 lastFrameGlobalIllumination = texture(lastFrameGlobalIlluminationTexture, reprojectedCoordinate.xy);
51
-
52
- int steps;
53
- float weightOcclusion;
54
- float weightEmission;
55
-
56
- // Heuristic to determine blending weights and number of steps for occlusion and emission
57
- if (abs((lastFrameDepthViewPos + reprojectedViewPos.z)/max(lastFrameDepthViewPos, reprojectedViewPos.z)) > 0.01) {
58
- steps = 6;
59
- weightOcclusion = 1.0;
60
- weightEmission = 1.0;
61
- } else {
62
- steps = 1;
63
- if (lastFrameGlobalIllumination.b > 0.5) {
64
- weightOcclusion = 0.15;
65
- weightEmission = 0.008;
66
- } else if (lastFrameGlobalIllumination.b > 0.02) {
67
- weightOcclusion = lastFrameGlobalIllumination.b - 0.005;
68
- weightEmission = 0.008;
69
- } else {
70
- weightOcclusion = 0.016;
71
- weightEmission = 0.008;
72
- }
73
- }
74
-
75
- vec4 randomDirectionSample;
76
- mat3 normalBasis = basisFromNormal(normal);
77
-
78
- // For each ray determine if it hits geometry and calculate occlusion and emission values
79
- float stepSize = 1.0 / float(steps);
80
- for (int i = 0; i < steps; ++i) {
81
- float index = float(i * min(64/steps, 6) + int(mod(frameCount, float(64/steps))));
82
- randomDirectionSample = randomDirection(index);
83
- vec2 hemisphereSample = randomDirectionSample.rg * 0.5 + 0.5;
84
- vec3 rayDirection = normalBasis * sampleCosineHemisphere(hemisphereSample);
85
- vec3 hit = screenSpaceIntersection(rayDirection, viewPos.xyz, normalize(viewPos.xyz), normal, randomDirectionSample.a * 0.5 + 0.5, true);
86
-
87
- if (hit.z > 0.0) {
88
- // Emission - reproject to get and accumulate emission from last frame
89
- vec2 hitReprojectedCoordinate = reprojectionCoordinate(hit);
90
- vec3 emissionColor = ${l(u.hasEmission,"texture(lastFrameEmissionTexture, hitReprojectedCoordinate).xyz","vec3(0.0)")};
91
- fragColor += vec4(emissionColor * vec3(stepSize), 0.0);
92
- } else {
93
- // Occlusion - heuristic modulating sky intensity based on angle to main light
94
- vec4 viewMainLightDirection = view * vec4(mainLightDirection, 0.0);
95
- float skyModulation = pow(max(dot(rayDirection, viewMainLightDirection.xyz), 0.0), 3.0) * 5.5;
96
- float weight = clamp(3.5 * dot(viewMainLightDirection.xyz, normal), 0.0, 1.0);
97
- skyModulation = mix(1.0, skyModulation * 0.2 + 0.8, weight);
98
- fragColor += skyModulation * vec4(vec3(0.0), stepSize);
99
- }
100
- }
101
-
102
- // Rendering trick add noise to reduce accumulation artifacts
103
- float ditheringNoise = weightOcclusion < 1. ? randomDirectionSample.b * 0.0039 : 0.0;
104
-
105
- // Accumulate occlusion
106
- fragColor.a = mix(lastFrameGlobalIllumination.a + ditheringNoise, fragColor.a, weightOcclusion);
107
-
108
- // Accumulate emission
109
- vec3 lastFrameEmission = decodeVec2ToRGB(lastFrameGlobalIllumination.rg);
110
- fragColor.rgb = mix(lastFrameEmission + ditheringNoise, fragColor.rgb, weightEmission);
111
-
112
- // Encode emission and occlusion into output
113
- vec2 encodedColor = encodeRGBtoVec2(fragColor.rgb);
114
- fragColor.r = encodedColor.x;
115
- fragColor.g = encodedColor.y;
116
- fragColor.b = weightOcclusion;
117
- `),g}const f=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:g,build:h},Symbol.toStringTag,{value:"Module"}));export{g as G,f as a,h as b};
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{addMainLightDirection as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceReflections as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import{CameraSpace as a}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as l}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as r,If as n}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{ColorAttachment1 as u}from"../views/webgl/enums.js";import{NoParameters as d}from"../views/webgl/NoParameters.js";import{ShaderBuilder as p}from"../views/webgl/ShaderBuilder.js";const h=.01,f=.008,g=.002,v=.5,x=.02,b=.1,w=.008,D=.012,S=.008,y=40,F=.095,j=.008,z=60,I=2,B=.0039,G=.25;class M extends d{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.frameCount=0}}function W(d){const M=new p,W=M.fragment;return M.include(e),M.include(a),i(W),W.include(t),M.include(o,{highStepCount:!1,screenSpaceReflections:!0}),W.uniforms.add(new m("normalMap",e=>e.normalTexture),new m("depthMap",e=>e.depthTexture),new m("lastFrameDepthTexture",(e,t)=>t.reprojection.lastFrameDepth?.attachment),new c("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new c("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(u)),new s("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new s("view",e=>e.camera.viewMatrix),new l("accumulatedFramesGI",e=>e.accumulatedFrames),new l("frameCount",e=>e.frameCount),new l("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new m("blueNoiseTex",e=>e.noiseTexture)),d.hasEmission&&W.uniforms.add(new m("lastFrameEmissionTexture",(e,t)=>t.reprojection.lastFrameEmission?.attachment)),W.constants.add("timeSamplesSize","float",64),W.constants.add("blueNoiseGridSize","float",8),W.code.add(r`
3
+ float computeIdleEmissionBlendWeight(float accumulatedFrames) {
4
+ float idleEmissionBlendProgress = clamp(
5
+ accumulatedFrames / ${r.float(y)},
6
+ 0.0,
7
+ 1.0
8
+ );
9
+ return mix(
10
+ ${r.float(D)},
11
+ ${r.float(S)},
12
+ idleEmissionBlendProgress
13
+ );
14
+ }
15
+
16
+ float computeIdleOcclusionBlendWeight(float accumulatedFrames) {
17
+ float idleOcclusionBlendProgress = clamp(
18
+ accumulatedFrames / ${r.float(z)},
19
+ 0.0,
20
+ 1.0
21
+ );
22
+ return mix(
23
+ ${r.float(F)},
24
+ ${r.float(j)},
25
+ pow(idleOcclusionBlendProgress, ${r.float(I)})
26
+ );
27
+ }
28
+
29
+ // Blue noise value based on a texture lookup
30
+ vec4 randomDirection(float index) {
31
+ vec2 textureOffset = vec2(mod(index, blueNoiseGridSize), floor(index / blueNoiseGridSize)) * timeSamplesSize;
32
+ vec2 noiseCoord = textureOffset + mod(
33
+ floor(uv * vec2(textureSize(normalMap, 0)) * scaleGlobalIllumination),
34
+ vec2(timeSamplesSize)
35
+ );
36
+ vec4 blueNoiseValue = texelFetch(blueNoiseTex, ivec2(noiseCoord), 0);
37
+
38
+ return 2.0 * blueNoiseValue - 1.0;
39
+ }
40
+
41
+ bool isEdgeDepth(float centerDepth, vec2 sampleUv) {
42
+ vec2 texelSize = 1.0 / vec2(textureSize(depthMap, 0));
43
+ float depthLeft = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(-texelSize.x, 0.0)));
44
+ float depthRight = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(texelSize.x, 0.0)));
45
+ float depthUp = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(0.0, texelSize.y)));
46
+ float depthDown = linearizeDepth(depthFromTexture(depthMap, sampleUv + vec2(0.0, -texelSize.y)));
47
+
48
+ float maxDifference = max(max(abs(centerDepth - depthLeft), abs(centerDepth - depthRight)), max(abs(centerDepth - depthUp), abs(centerDepth - depthDown)));
49
+
50
+ return abs(maxDifference / centerDepth) > 0.01;
51
+ }
52
+
53
+ vec3 sampleCosineHemisphere(vec2 u) {
54
+ float phi = 6.28318530718 * u.x;
55
+ float radius = sqrt(u.y);
56
+ float x = radius * cos(phi);
57
+ float y = radius * sin(phi);
58
+ float z = sqrt(max(0.0, 1.0 - u.y));
59
+
60
+ return vec3(x, y, z);
61
+ }
62
+
63
+ mat3 basisFromNormal(vec3 n) {
64
+ vec3 up = abs(n.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
65
+ vec3 tangent = normalize(cross(up, n));
66
+ vec3 bitangent = cross(n, tangent);
67
+
68
+ return mat3(tangent, bitangent, n);
69
+ }
70
+ `),M.outputs.add("fragGlobalIllumination","vec4",0),M.outputs.add("fragWeight","float",1),W.main.add(r`
71
+ float depth = depthFromTexture(depthMap, uv);
72
+
73
+ // Early out if depth is out of range, such as in the sky
74
+ if (depth >= 1.0 || depth <= 0.0) {
75
+ fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
76
+ fragWeight = 0.0;
77
+ return;
78
+ }
79
+
80
+ // Get the normal of current fragment
81
+ ivec2 iuv = ivec2(uv * vec2(textureSize(normalMap, 0)));
82
+ vec4 normal4 = texelFetch(normalMap, iuv, 0);
83
+ if (normal4.a != 1.0) {
84
+ fragGlobalIllumination = vec4(0.0, 0.0, 0.0, 1.0);
85
+ fragWeight = 0.0;
86
+ return;
87
+ }
88
+ vec3 normal = normalize(normal4.xyz * 2.0 - 1.0);
89
+
90
+ // Reconstruct view space position of current fragment
91
+ float currentPixelDepth = linearizeDepth(depth);
92
+ vec3 currentPixelPos = reconstructPosition(uv * vec2(textureSize(normalMap, 0)), currentPixelDepth);
93
+ vec4 viewPos = vec4(currentPixelPos, 1.0);
94
+
95
+ // Reproject current view position to last frame
96
+ vec4 reprojectedViewPos = reprojectionViewMatrix * viewPos;
97
+ vec4 reprojectedCoordinate = applyProjectionMat(proj, reprojectedViewPos.xyz);
98
+
99
+ // Read last frame reprojected depth and GI value.
100
+ float lastFrameDepthViewPos = -linearDepthFromTextureLastFrame(lastFrameDepthTexture, reprojectedCoordinate.xy);
101
+ vec4 lastFrameGlobalIllumination = texture(lastFrameGlobalIlluminationTexture, reprojectedCoordinate.xy);
102
+ float historyOcclusionBlendWeight = texture(lastFrameGlobalIlluminationWeightTexture, reprojectedCoordinate.xy).r;
103
+
104
+ int steps;
105
+ float occlusionBlendWeight = 1.0;
106
+ float emissionBlendWeight = 1.0;
107
+ float idleEmissionBlendWeight = computeIdleEmissionBlendWeight(accumulatedFramesGI);
108
+ float idleOcclusionBlendWeight = computeIdleOcclusionBlendWeight(accumulatedFramesGI);
109
+ float reprojectionDepthMismatch = abs((lastFrameDepthViewPos + reprojectedViewPos.z) / max(lastFrameDepthViewPos, reprojectedViewPos.z));
110
+ bool hasReprojectionMismatch = reprojectionDepthMismatch > ${r.float(h)};
111
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
112
+ bool isLowQualityEdgePixel = isScaledGlobalIllumination && isEdgeDepth(currentPixelDepth, uv);
113
+ bool resetEmissionHistory = false;
114
+
115
+ // Heuristic to determine blending weights and number of steps for occlusion and emission
116
+ if (hasReprojectionMismatch) {
117
+ if (isLowQualityEdgePixel) {
118
+ steps = 1;
119
+ occlusionBlendWeight = ${r.float(f)};
120
+ resetEmissionHistory = true;
121
+ } else {
122
+ steps = 6;
123
+ occlusionBlendWeight = 1.0;
124
+ resetEmissionHistory = true;
125
+ }
126
+ } else {
127
+ steps = 1;
128
+ if (historyOcclusionBlendWeight > ${r.float(v)}) {
129
+ occlusionBlendWeight = ${r.float(b)};
130
+ emissionBlendWeight = ${r.float(w)};
131
+ } else if (historyOcclusionBlendWeight > ${r.float(x)}) {
132
+ occlusionBlendWeight = historyOcclusionBlendWeight - 0.05;
133
+ emissionBlendWeight = ${r.float(w)};
134
+ } else {
135
+ occlusionBlendWeight = isScaledGlobalIllumination ? ${r.float(f)} : idleOcclusionBlendWeight;
136
+ emissionBlendWeight = isScaledGlobalIllumination ? ${r.float(g)} : idleEmissionBlendWeight;
137
+ }
138
+ }
139
+
140
+ vec4 randomDirectionSample;
141
+ mat3 normalBasis = basisFromNormal(normal);
142
+ int temporalSampleStride = min(64 / steps, 6);
143
+ float temporalFrameOffset = mod(frameCount, float(64 / steps));
144
+
145
+ // For each ray determine if it hits geometry and calculate occlusion and emission values
146
+ float stepSize = 1.0 / float(steps);
147
+ for (int i = 0; i < steps; ++i) {
148
+ float sampleIndex = float(i * temporalSampleStride + int(temporalFrameOffset));
149
+ randomDirectionSample = randomDirection(sampleIndex);
150
+ vec2 hemisphereSample = randomDirectionSample.rg * 0.5 + 0.5;
151
+ vec3 rayDirection = normalBasis * sampleCosineHemisphere(hemisphereSample);
152
+ vec3 hit = screenSpaceIntersection(rayDirection, viewPos.xyz, normalize(viewPos.xyz), normal, randomDirectionSample.a * 0.5 + 0.5, true);
153
+
154
+ if (hit.z > 0.0) {
155
+ // Emission - reproject to get and accumulate emission from last frame
156
+ vec2 hitReprojectedCoordinate = reprojectionCoordinate(hit);
157
+ vec3 emissionColor = ${n(d.hasEmission,"texture(lastFrameEmissionTexture, hitReprojectedCoordinate).xyz","vec3(0.0)")};
158
+
159
+ fragGlobalIllumination.rgb += emissionColor * stepSize;
160
+ } else {
161
+ // Occlusion - heuristic modulating sky intensity based on angle to main light
162
+ vec4 viewMainLightDirection = view * vec4(mainLightDirection, 0.0);
163
+ float skyModulation = pow(max(dot(rayDirection, viewMainLightDirection.xyz), 0.0), 3.0) * 5.5;
164
+ float skyFacingWeight = clamp(3.5 * dot(viewMainLightDirection.xyz, normal), 0.0, 1.0);
165
+ skyModulation = mix(1.0, skyModulation * 0.2 + 0.8, skyFacingWeight);
166
+ fragGlobalIllumination.a += skyModulation * stepSize;
167
+ }
168
+ }
169
+
170
+ // Rendering trick add noise to reduce accumulation artifacts
171
+ float accumulationDither = occlusionBlendWeight < 1.0
172
+ ? randomDirectionSample.b * ${r.float(B)}
173
+ : 0.0;
174
+
175
+ // Accumulate occlusion
176
+ // Accumulate emission
177
+ vec3 lastFrameEmission = lastFrameGlobalIllumination.rgb;
178
+ float emissionDitherScale = isScaledGlobalIllumination ? ${r.float(G)} : 1.0;
179
+ fragGlobalIllumination.rgb = resetEmissionHistory
180
+ ? vec3(0.0)
181
+ : mix(lastFrameEmission + accumulationDither * emissionDitherScale, fragGlobalIllumination.rgb, emissionBlendWeight);
182
+
183
+ // Accumulate occlusion
184
+ fragGlobalIllumination.a = mix(lastFrameGlobalIllumination.a + accumulationDither, fragGlobalIllumination.a, occlusionBlendWeight);
185
+
186
+ fragWeight = occlusionBlendWeight;
187
+ `),M}const P=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:M,build:W},Symbol.toStringTag,{value:"Module"}));export{M as G,P as a,W as b};
@@ -1,68 +1,88 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ScreenSpacePass as o}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{EncodeEmissionColors as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js";import{CameraSpace as s}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{Float2DrawUniform as i}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as m}from"../views/webgl/NoParameters.js";import{ShaderBuilder as u}from"../views/webgl/ShaderBuilder.js";const p=4;class f extends m{constructor(){super(...arguments),this.blurSize=e()}}function d(){const e=new u,m=e.fragment;e.include(o),e.include(s),m.include(l);const f=(p+3)/2,d=1/(2*f*f);m.include(t);const h=5e4;m.uniforms.add(new c("depthMap",e=>e.depthTexture),new c("normalMap",e=>e.normalTexture),new n("tex",e=>e.colorTexture),new i("blurSize",e=>e.blurSize),new a("projScale",(e,o)=>{const t=o.camera.distance;return t>h?Math.max(0,e.projScale-(t-h)):e.projScale}));const g=15.3,S=.1,v=.03,b=.08,w=1.5;m.code.add(r`
3
- void accumulateBlurSample(
4
- vec2 sampleUv,
5
- float sampleOffset,
6
- float centerDepth,
7
- vec3 centerNormal,
8
- float depthSharpness,
9
- inout float emissionWeightSum,
10
- inout vec3 emissionSum,
11
- inout float occlusionWeightSum,
12
- inout float occlusionSum,
13
- float centerOcclusionWeight
14
- ) {
15
- vec4 globalIllumination = texture(tex, sampleUv);
16
- vec3 sampleNormal = texture(normalMap, sampleUv).rgb;
17
- float sampleDepth = linearDepthFromTexture(depthMap, sampleUv);
2
+ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ScreenSpacePass as l}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as t}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{BooleanBindUniform as a}from"../views/3d/webgl-engine/core/shaderModules/BooleanBindUniform.js";import{Float2DrawUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as c}from"../views/webgl/NoParameters.js";import{ShaderBuilder as p}from"../views/webgl/ShaderBuilder.js";const h=4;class f extends c{constructor(){super(...arguments),this.blurSize=e()}}function d(){const e=new p,c=e.fragment;e.include(l),e.include(t),e.include(i);const f=(h+3)/2,d=1/(2*f*f);c.include(o);const g=5e4;c.uniforms.add(new a("hasEmission",e=>e.hasEmission),new u("depthMap",e=>e.depthTexture),new u("normalMap",e=>e.normalTexture),new m("globalIlluminationTexture",e=>e.texture),new m("globalIlluminationWeightTexture",e=>e.weightTexture),new s("blurSize",e=>e.blurSize),new n("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new n("projScale",(e,l)=>{const o=l.camera.distance;return o>g?Math.max(0,e.projScale-(o-g)):e.projScale}));const b=.1,S=400,v=.03,w=.08,W=1.5;return c.code.add(r`
3
+ void accumulateBlurSample(
4
+ vec2 sampleUv,
5
+ float sampleOffset,
6
+ float centerDepth,
7
+ vec3 centerNormal,
8
+ float depthSharpness,
9
+ bool skipOcclusionBlur,
10
+ inout float emissionWeightSum,
11
+ inout vec3 emissionSum,
12
+ inout float occlusionWeightSum,
13
+ inout float occlusionSum,
14
+ float centerOcclusionBlendWeight
15
+ ) {
16
+ vec4 sampleGlobalIllumination = texture(globalIlluminationTexture, sampleUv);
17
+ vec3 sampleNormal = texture(normalMap, sampleUv).rgb;
18
+ float sampleDepth = linearDepthFromTexture(depthMap, sampleUv);
18
19
 
19
- float depthDelta = sampleDepth - centerDepth;
20
- float normalWeight = clamp(1.0 - ${r.float(g)} * length(sampleNormal - centerNormal), 0.0, 1.0);
21
- vec3 decodedEmission = decodeVec2ToRGB(globalIllumination.rg);
20
+ float depthDelta = sampleDepth - centerDepth;
21
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
22
+ float normalSimilarityWeight = globalIlluminationNormalSimilarityWeight(sampleNormal, centerNormal);
23
+ float depthNormalCorrection = globalIlluminationDepthNormalCorrection(sampleNormal);
24
+ vec3 emission = sampleGlobalIllumination.rgb;
25
+ float emissionSpatialWeightMultiplier = isScaledGlobalIllumination ? ${r.float(S)} : 1.0;
22
26
 
23
- float emissionWeight = exp(-sampleOffset * sampleOffset * ${r.float(d)} * ${r.float(S)} - depthDelta * depthDelta * depthSharpness);
24
- emissionWeight *= normalWeight;
25
- emissionWeightSum += emissionWeight;
26
- emissionSum += emissionWeight * decodedEmission;
27
+ float emissionWeight = exp(
28
+ -sampleOffset * sampleOffset * ${r.float(d)} * ${r.float(b)} * emissionSpatialWeightMultiplier
29
+ - depthDelta * depthDelta * depthSharpness * depthNormalCorrection
30
+ );
31
+ emissionWeight *= normalSimilarityWeight;
32
+ emissionWeightSum += emissionWeight;
33
+ emissionSum += emissionWeight * emission;
27
34
 
28
- float occlusionKernelScale = centerOcclusionWeight > ${r.float(v)}
29
- ? ${r.float(b)}
30
- : ${r.float(w)};
31
- float occlusionWeight = exp(-sampleOffset * sampleOffset * occlusionKernelScale - depthDelta * depthDelta * depthSharpness);
32
- occlusionWeight *= normalWeight;
33
- occlusionWeightSum += occlusionWeight;
34
- occlusionSum += occlusionWeight * globalIllumination.a;
35
- }
36
- `);const W=-.05;return m.main.add(r`
37
- vec3 emissionSum = vec3(0.0);
38
- float emissionWeightSum = 0.0;
35
+ if (skipOcclusionBlur) {
36
+ return;
37
+ }
39
38
 
40
- float centerDepth = linearDepthFromTexture(depthMap, uv);
41
- vec3 centerNormal = texture(normalMap, uv).rgb;
42
- float occlusionSum = 0.0;
43
- float occlusionWeightSum = 0.0;
44
- float centerOcclusionWeight = texture(tex, uv).b;
39
+ float occlusionSpatialKernelScale = centerOcclusionBlendWeight > ${r.float(v)}
40
+ ? ${r.float(w)}
41
+ : ${r.float(W)};
42
+ float occlusionWeight = exp(-sampleOffset * sampleOffset * occlusionSpatialKernelScale - depthDelta * depthDelta * depthSharpness);
43
+ occlusionWeight *= normalSimilarityWeight;
44
+ occlusionWeightSum += occlusionWeight;
45
+ occlusionSum += occlusionWeight * sampleGlobalIllumination.a;
46
+ }
47
+ `),c.main.add(r`
48
+ vec3 emissionSum = vec3(0.0);
49
+ float emissionWeightSum = 0.0;
45
50
 
46
- float depthSharpness = ${r.float(W)} * projScale / centerDepth;
47
- for (int sampleOffset = -${r.int(p)}; sampleOffset <= ${r.int(p)}; ++sampleOffset) {
48
- float sampleOffsetFloat = float(sampleOffset);
49
- vec2 sampleUv = uv + sampleOffsetFloat * blurSize;
50
- accumulateBlurSample(
51
- sampleUv,
52
- sampleOffsetFloat,
53
- centerDepth,
54
- centerNormal,
55
- depthSharpness,
56
- emissionWeightSum,
57
- emissionSum,
58
- occlusionWeightSum,
59
- occlusionSum,
60
- centerOcclusionWeight
61
- );
62
- }
51
+ vec4 centerGlobalIllumination = texture(globalIlluminationTexture, uv);
52
+ float centerOcclusionBlendWeight = texture(globalIlluminationWeightTexture, uv).r;
53
+ bool isScaledGlobalIllumination = scaleGlobalIllumination < 1.0;
54
+ bool shouldReuseCenterOcclusion = isScaledGlobalIllumination && centerOcclusionBlendWeight <= ${r.float(v)};
55
+ bool shouldSkipLowQualityBlur = !hasEmission && shouldReuseCenterOcclusion;
56
+ if (shouldSkipLowQualityBlur) {
57
+ fragColor = centerGlobalIllumination;
58
+ return;
59
+ }
63
60
 
64
- vec3 blurredEmission = (emissionSum / emissionWeightSum).rgb;
65
- vec2 encodedEmission = encodeRGBtoVec2(blurredEmission.rgb);
66
- float occlusion = occlusionSum / occlusionWeightSum;
67
- fragColor = vec4(vec3(encodedEmission.x, encodedEmission.y, centerOcclusionWeight), occlusion);
68
- `),e}const h=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:f,build:d},Symbol.toStringTag,{value:"Module"}));export{f as G,h as a,d as b};
61
+ float centerDepth = linearDepthFromTexture(depthMap, uv);
62
+ vec3 centerNormal = texture(normalMap, uv).rgb;
63
+ float occlusionSum = 0.0;
64
+ float occlusionWeightSum = 0.0;
65
+
66
+ float depthSharpness = globalIlluminationDepthSharpness(projScale, centerDepth);
67
+ for (int sampleOffset = -${r.int(h)}; sampleOffset <= ${r.int(h)}; ++sampleOffset) {
68
+ float sampleOffsetFloat = float(sampleOffset);
69
+ vec2 sampleUv = uv + sampleOffsetFloat * blurSize;
70
+ accumulateBlurSample(
71
+ sampleUv,
72
+ sampleOffsetFloat,
73
+ centerDepth,
74
+ centerNormal,
75
+ depthSharpness,
76
+ shouldReuseCenterOcclusion,
77
+ emissionWeightSum,
78
+ emissionSum,
79
+ occlusionWeightSum,
80
+ occlusionSum,
81
+ centerOcclusionBlendWeight
82
+ );
83
+ }
84
+
85
+ vec3 blurredEmission = (emissionSum / emissionWeightSum).rgb;
86
+ float occlusion = shouldReuseCenterOcclusion ? centerGlobalIllumination.a : occlusionSum / occlusionWeightSum;
87
+ fragColor = vec4(blurredEmission, occlusion);
88
+ `),e}const g=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:f,build:d},Symbol.toStringTag,{value:"Module"}));export{f as G,g as a,d as b};
@@ -0,0 +1,66 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as t}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{GlobalIlluminationWeights as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js";import{CameraSpace as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as i}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DDrawUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as h}from"../views/webgl/NoParameters.js";import{ShaderBuilder as u}from"../views/webgl/ShaderBuilder.js";const s=5e4;class m extends h{}function c(){const h=new u,m=h.fragment;return h.include(e),h.include(r),h.include(l),m.include(t),m.uniforms.add(new n("depthMap",e=>e.depthTexture),new n("normalMap",e=>e.normalTexture),new o("tex",e=>e.colorTexture),new o("globalIlluminationWeightTexture",e=>e.weightTexture),new a("scaleGlobalIllumination",e=>e.scaleGlobalIllumination),new a("projScale",(e,t)=>{const l=t.camera.distance;return l>s?Math.max(0,e.projScale-(l-s)):e.projScale})),m.code.add(i`float computeDepthWeight(float sampleDepth, float centerDepth, float depthSharpness) {
3
+ float depthDelta = abs(sampleDepth - centerDepth);
4
+ return exp(-0.08 - depthDelta * depthDelta * depthSharpness);
5
+ }
6
+ vec3 normalFromTexture(sampler2D normalTexture, vec2 uv) {
7
+ ivec2 normalTextureSize = textureSize(normalTexture, 0);
8
+ ivec2 normalTexel = clamp(ivec2(uv * vec2(normalTextureSize)), ivec2(0), normalTextureSize - ivec2(1));
9
+ return texelFetch(normalTexture, normalTexel, 0).xyz;
10
+ }
11
+ void sampleJointBilateralUpscale(vec2 sampleUv, out vec4 upscaledColor, out float upscaledWeight) {
12
+ float centerDepth = linearDepthFromTexture(depthMap, sampleUv);
13
+ vec3 centerNormal = normalFromTexture(normalMap, sampleUv);
14
+ float depthSharpness = globalIlluminationDepthSharpness(projScale, centerDepth, centerNormal);
15
+ vec2 lowResTextureSize = vec2(textureSize(tex, 0));
16
+ vec2 texelPosition = sampleUv * lowResTextureSize - 0.5;
17
+ vec2 texelBase = floor(texelPosition);
18
+ vec2 bilinearWeightsFraction = fract(texelPosition);
19
+ vec2 uv00 = (texelBase + vec2(0.5, 0.5)) / lowResTextureSize;
20
+ vec2 uv10 = (texelBase + vec2(1.5, 0.5)) / lowResTextureSize;
21
+ vec2 uv01 = (texelBase + vec2(0.5, 1.5)) / lowResTextureSize;
22
+ vec2 uv11 = (texelBase + vec2(1.5, 1.5)) / lowResTextureSize;
23
+ vec4 color00 = texture(tex, uv00);
24
+ vec4 color10 = texture(tex, uv10);
25
+ vec4 color01 = texture(tex, uv01);
26
+ vec4 color11 = texture(tex, uv11);
27
+ float weight00 = texture(globalIlluminationWeightTexture, uv00).r;
28
+ float weight10 = texture(globalIlluminationWeightTexture, uv10).r;
29
+ float weight01 = texture(globalIlluminationWeightTexture, uv01).r;
30
+ float weight11 = texture(globalIlluminationWeightTexture, uv11).r;
31
+ float depth00 = linearDepthFromTexture(depthMap, uv00);
32
+ float depth10 = linearDepthFromTexture(depthMap, uv10);
33
+ float depth01 = linearDepthFromTexture(depthMap, uv01);
34
+ float depth11 = linearDepthFromTexture(depthMap, uv11);
35
+ vec3 normal00 = normalFromTexture(normalMap, uv00);
36
+ vec3 normal10 = normalFromTexture(normalMap, uv10);
37
+ vec3 normal01 = normalFromTexture(normalMap, uv01);
38
+ vec3 normal11 = normalFromTexture(normalMap, uv11);
39
+ float bilinearWeight00 = (1.0 - bilinearWeightsFraction.x) * (1.0 - bilinearWeightsFraction.y);
40
+ float bilinearWeight10 = bilinearWeightsFraction.x * (1.0 - bilinearWeightsFraction.y);
41
+ float bilinearWeight01 = (1.0 - bilinearWeightsFraction.x) * bilinearWeightsFraction.y;
42
+ float bilinearWeight11 = bilinearWeightsFraction.x * bilinearWeightsFraction.y;
43
+ float jointBilateralWeight00 = bilinearWeight00 * computeDepthWeight(depth00, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal00, centerNormal);
44
+ float jointBilateralWeight10 = bilinearWeight10 * computeDepthWeight(depth10, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal10, centerNormal);
45
+ float jointBilateralWeight01 = bilinearWeight01 * computeDepthWeight(depth01, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal01, centerNormal);
46
+ float jointBilateralWeight11 = bilinearWeight11 * computeDepthWeight(depth11, centerDepth, depthSharpness) * globalIlluminationNormalSimilarityWeight(normal11, centerNormal);
47
+ float jointBilateralWeightSum = jointBilateralWeight00 + jointBilateralWeight10 + jointBilateralWeight01 + jointBilateralWeight11;
48
+ if (jointBilateralWeightSum < 0.0001) {
49
+ vec2 nearestUv = (floor(texelPosition + 0.5) + vec2(0.5)) / lowResTextureSize;
50
+ upscaledColor = texture(tex, nearestUv);
51
+ upscaledWeight = texture(globalIlluminationWeightTexture, nearestUv).r;
52
+ return;
53
+ }
54
+ upscaledColor = (
55
+ color00 * jointBilateralWeight00 +
56
+ color10 * jointBilateralWeight10 +
57
+ color01 * jointBilateralWeight01 +
58
+ color11 * jointBilateralWeight11
59
+ ) / jointBilateralWeightSum;
60
+ upscaledWeight = (
61
+ weight00 * jointBilateralWeight00 +
62
+ weight10 * jointBilateralWeight10 +
63
+ weight01 * jointBilateralWeight01 +
64
+ weight11 * jointBilateralWeight11
65
+ ) / jointBilateralWeightSum;
66
+ }`),h.outputs.add("fragColor","vec4",0),h.outputs.add("fragWeight","float",1),m.main.add(i`sampleJointBilateralUpscale(uv, fragColor, fragWeight);`),h}const p=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationUpscaleDrawParameters:m,build:c},Symbol.toStringTag,{value:"Module"}));export{m as G,p as a,c as b};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.72";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.73";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -10,6 +10,7 @@ import type { TextBoxInputProperties } from "./inputs/TextBoxInput.js";
10
10
  import type { TextAreaInputProperties } from "./inputs/TextAreaInput.js";
11
11
  import type { SwitchInputProperties } from "./inputs/SwitchInput.js";
12
12
  import type { RadioButtonsInputProperties } from "./inputs/RadioButtonsInput.js";
13
+ import type { MultipleChoiceInputProperties } from "./inputs/MultipleChoiceInput.js";
13
14
  import type { DateTimePickerInputProperties } from "./inputs/DateTimePickerInput.js";
14
15
  import type { DateTimeOffsetPickerInputProperties } from "./inputs/DateTimeOffsetPickerInput.js";
15
16
  import type { DatePickerInputProperties } from "./inputs/DatePickerInput.js";
@@ -23,7 +24,7 @@ export interface FieldElementProperties extends ElementProperties, Partial<Pick<
23
24
  */
24
25
  domain?: (CodedValueDomainProperties & { type: "coded-value" }) | (RangeDomainProperties & { type: "range" }) | null;
25
26
  /** The input to use for the element. The client application is responsible for defining the default user interface. */
26
- input?: ((BarcodeScannerInputProperties & { type: "barcode-scanner" }) | (ComboBoxInputProperties & { type: "combo-box" }) | (DatePickerInputProperties & { type: "date-picker" }) | (DateTimeOffsetPickerInputProperties & { type: "timestampoffset-picker" }) | (DateTimePickerInputProperties & { type: "datetime-picker" }) | (RadioButtonsInputProperties & { type: "radio-buttons" }) | (SwitchInputProperties & { type: "switch" }) | (TextAreaInputProperties & { type: "text-area" }) | (TextBoxInputProperties & { type: "text-box" }) | (TimePickerInputProperties & { type: "time-picker" })) | null;
27
+ input?: ((BarcodeScannerInputProperties & { type: "barcode-scanner" }) | (ComboBoxInputProperties & { type: "combo-box" }) | (DatePickerInputProperties & { type: "date-picker" }) | (DateTimeOffsetPickerInputProperties & { type: "timestampoffset-picker" }) | (DateTimePickerInputProperties & { type: "datetime-picker" }) | (MultipleChoiceInputProperties & { type: "multiple-choice" }) | (RadioButtonsInputProperties & { type: "radio-buttons" }) | (SwitchInputProperties & { type: "switch" }) | (TextAreaInputProperties & { type: "text-area" }) | (TextBoxInputProperties & { type: "text-box" }) | (TimePickerInputProperties & { type: "time-picker" })) | null;
27
28
  }
28
29
 
29
30
  /**
@@ -130,7 +131,7 @@ export default class FieldElement extends Element {
130
131
  accessor hint: string | null | undefined;
131
132
  /** The input to use for the element. The client application is responsible for defining the default user interface. */
132
133
  get input(): Input | null | undefined;
133
- set input(value: ((BarcodeScannerInputProperties & { type: "barcode-scanner" }) | (ComboBoxInputProperties & { type: "combo-box" }) | (DatePickerInputProperties & { type: "date-picker" }) | (DateTimeOffsetPickerInputProperties & { type: "timestampoffset-picker" }) | (DateTimePickerInputProperties & { type: "datetime-picker" }) | (RadioButtonsInputProperties & { type: "radio-buttons" }) | (SwitchInputProperties & { type: "switch" }) | (TextAreaInputProperties & { type: "text-area" }) | (TextBoxInputProperties & { type: "text-box" }) | (TimePickerInputProperties & { type: "time-picker" })) | null | undefined);
134
+ set input(value: ((BarcodeScannerInputProperties & { type: "barcode-scanner" }) | (ComboBoxInputProperties & { type: "combo-box" }) | (DatePickerInputProperties & { type: "date-picker" }) | (DateTimeOffsetPickerInputProperties & { type: "timestampoffset-picker" }) | (DateTimePickerInputProperties & { type: "datetime-picker" }) | (MultipleChoiceInputProperties & { type: "multiple-choice" }) | (RadioButtonsInputProperties & { type: "radio-buttons" }) | (SwitchInputProperties & { type: "switch" }) | (TextAreaInputProperties & { type: "text-area" }) | (TextBoxInputProperties & { type: "text-box" }) | (TimePickerInputProperties & { type: "time-picker" })) | null | undefined);
134
135
  /**
135
136
  * A reference to the [ExpressionInfo.name](https://developers.arcgis.com/javascript/latest/references/core/form/ExpressionInfo/#name) of an
136
137
  * [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression defined in the
@@ -2,4 +2,4 @@ import type { JSONSupport } from "../../../core/JSONSupport.js";
2
2
 
3
3
  export default abstract class Input extends JSONSupport {}
4
4
 
5
- export type InputType = "barcode-scanner" | "combo-box" | "date-picker" | "datetime-picker" | "timestampoffset-picker" | "radio-buttons" | "switch" | "text-area" | "text-box" | "time-picker";
5
+ export type InputType = "barcode-scanner" | "combo-box" | "date-picker" | "datetime-picker" | "multiple-choice" | "timestampoffset-picker" | "radio-buttons" | "switch" | "text-area" | "text-box" | "time-picker";