@onerjs/addons 8.51.5 → 8.51.6

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 (67) hide show
  1. package/atmosphere/Shaders/ShadersInclude/atmosphereFragmentDeclaration.js.map +1 -1
  2. package/atmosphere/Shaders/ShadersInclude/atmosphereFunctions.js.map +1 -1
  3. package/atmosphere/Shaders/ShadersInclude/atmosphereUboDeclaration.js.map +1 -1
  4. package/atmosphere/Shaders/ShadersInclude/atmosphereVertexDeclaration.js.map +1 -1
  5. package/atmosphere/Shaders/ShadersInclude/depthFunctions.js.map +1 -1
  6. package/atmosphere/Shaders/aerialPerspective.fragment.d.ts +0 -4
  7. package/atmosphere/Shaders/aerialPerspective.fragment.js +11 -4
  8. package/atmosphere/Shaders/aerialPerspective.fragment.js.map +1 -1
  9. package/atmosphere/Shaders/compositeAerialPerspective.fragment.d.ts +0 -5
  10. package/atmosphere/Shaders/compositeAerialPerspective.fragment.js +12 -5
  11. package/atmosphere/Shaders/compositeAerialPerspective.fragment.js.map +1 -1
  12. package/atmosphere/Shaders/compositeGlobeAtmosphere.fragment.d.ts +0 -5
  13. package/atmosphere/Shaders/compositeGlobeAtmosphere.fragment.js +12 -5
  14. package/atmosphere/Shaders/compositeGlobeAtmosphere.fragment.js.map +1 -1
  15. package/atmosphere/Shaders/compositeSky.fragment.d.ts +0 -4
  16. package/atmosphere/Shaders/compositeSky.fragment.js +11 -4
  17. package/atmosphere/Shaders/compositeSky.fragment.js.map +1 -1
  18. package/atmosphere/Shaders/diffuseSkyIrradiance.fragment.d.ts +0 -7
  19. package/atmosphere/Shaders/diffuseSkyIrradiance.fragment.js +14 -7
  20. package/atmosphere/Shaders/diffuseSkyIrradiance.fragment.js.map +1 -1
  21. package/atmosphere/Shaders/fullscreenTriangle.vertex.d.ts +0 -2
  22. package/atmosphere/Shaders/fullscreenTriangle.vertex.js +8 -2
  23. package/atmosphere/Shaders/fullscreenTriangle.vertex.js.map +1 -1
  24. package/atmosphere/Shaders/multiScattering.fragment.d.ts +0 -4
  25. package/atmosphere/Shaders/multiScattering.fragment.js +11 -4
  26. package/atmosphere/Shaders/multiScattering.fragment.js.map +1 -1
  27. package/atmosphere/Shaders/skyView.fragment.d.ts +0 -4
  28. package/atmosphere/Shaders/skyView.fragment.js +11 -4
  29. package/atmosphere/Shaders/skyView.fragment.js.map +1 -1
  30. package/atmosphere/Shaders/transmittance.fragment.d.ts +0 -4
  31. package/atmosphere/Shaders/transmittance.fragment.js +11 -4
  32. package/atmosphere/Shaders/transmittance.fragment.js.map +1 -1
  33. package/atmosphere/ShadersWGSL/ShadersInclude/atmosphereFunctions.js.map +1 -1
  34. package/atmosphere/ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js.map +1 -1
  35. package/atmosphere/ShadersWGSL/ShadersInclude/depthFunctions.js.map +1 -1
  36. package/atmosphere/ShadersWGSL/aerialPerspective.fragment.d.ts +0 -3
  37. package/atmosphere/ShadersWGSL/aerialPerspective.fragment.js +10 -3
  38. package/atmosphere/ShadersWGSL/aerialPerspective.fragment.js.map +1 -1
  39. package/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.d.ts +0 -4
  40. package/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.js +11 -4
  41. package/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.js.map +1 -1
  42. package/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.d.ts +0 -4
  43. package/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.js +11 -4
  44. package/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.js.map +1 -1
  45. package/atmosphere/ShadersWGSL/compositeSky.fragment.d.ts +0 -3
  46. package/atmosphere/ShadersWGSL/compositeSky.fragment.js +10 -3
  47. package/atmosphere/ShadersWGSL/compositeSky.fragment.js.map +1 -1
  48. package/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.d.ts +0 -6
  49. package/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.js +13 -6
  50. package/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.js.map +1 -1
  51. package/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.d.ts +0 -1
  52. package/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.js +7 -1
  53. package/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.js.map +1 -1
  54. package/atmosphere/ShadersWGSL/multiScattering.fragment.d.ts +0 -3
  55. package/atmosphere/ShadersWGSL/multiScattering.fragment.js +10 -3
  56. package/atmosphere/ShadersWGSL/multiScattering.fragment.js.map +1 -1
  57. package/atmosphere/ShadersWGSL/skyView.fragment.d.ts +0 -3
  58. package/atmosphere/ShadersWGSL/skyView.fragment.js +10 -3
  59. package/atmosphere/ShadersWGSL/skyView.fragment.js.map +1 -1
  60. package/atmosphere/ShadersWGSL/transmittance.fragment.d.ts +0 -3
  61. package/atmosphere/ShadersWGSL/transmittance.fragment.js +10 -3
  62. package/atmosphere/ShadersWGSL/transmittance.fragment.js.map +1 -1
  63. package/msdfText/shaders/msdf.fragment.js.map +1 -1
  64. package/msdfText/shaders/msdf.vertex.js.map +1 -1
  65. package/msdfText/shadersWGSL/msdf.fragment.js.map +1 -1
  66. package/msdfText/shadersWGSL/msdf.vertex.js.map +1 -1
  67. package/package.json +2 -2
@@ -1,9 +1,10 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../Shaders/ShadersInclude/atmosphereFragmentDeclaration.js";
4
- import "../Shaders/ShadersInclude/atmosphereUboDeclaration.js";
5
- import "@onerjs/core/Shaders/ShadersInclude/helperFunctions.js";
6
- import "../Shaders/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereFragmentDeclaration } from "../Shaders/ShadersInclude/atmosphereFragmentDeclaration.js";
4
+ import { atmosphereUboDeclaration } from "../Shaders/ShadersInclude/atmosphereUboDeclaration.js";
5
+ import { helperFunctions } from "@onerjs/core/Shaders/ShadersInclude/helperFunctions.js";
6
+ import { intersectionFunctions } from "@onerjs/core/Shaders/ShadersInclude/intersectionFunctions.js";
7
+ import { atmosphereFunctions } from "../Shaders/ShadersInclude/atmosphereFunctions.js";
7
8
  const name = "skyViewPixelShader";
8
9
  const shader = `#define RENDER_SKY_VIEW
9
10
  precision highp float;precision highp sampler2D;
@@ -16,6 +17,12 @@ varying vec2 uv;void main() {gl_FragColor=renderSkyView(uv,transmittanceLut,mult
16
17
  if (!ShaderStore.ShadersStore[name]) {
17
18
  ShaderStore.ShadersStore[name] = shader;
18
19
  }
20
+ const includes = [atmosphereFragmentDeclaration, atmosphereUboDeclaration, helperFunctions, intersectionFunctions, atmosphereFunctions];
21
+ for (const inc of includes) {
22
+ if (!ShaderStore.IncludesShadersStore[inc.name]) {
23
+ ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
24
+ }
25
+ }
19
26
  /** @internal */
20
27
  export const skyViewPixelShader = { name, shader };
21
28
  //# sourceMappingURL=skyView.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skyView.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/Shaders/skyView.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,yDAAyD,CAAC;AACjE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6CAA6C,CAAC;AACrD,OAAO,+CAA+C,CAAC;AAEvD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;kGAMmF,CAAC;AACnG,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../Shaders/ShadersInclude/atmosphereFragmentDeclaration\";\nimport \"../Shaders/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"../Shaders/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"skyViewPixelShader\";\nconst shader = `#define RENDER_SKY_VIEW\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderSkyView(uv,transmittanceLut,multiScatteringLut);}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const skyViewPixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"skyView.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/Shaders/skyView.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;kGAMmF,CAAC;AACnG,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,6BAA6B,EAAE,wBAAwB,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AACxI,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereFragmentDeclaration } from \"../Shaders/ShadersInclude/atmosphereFragmentDeclaration\";\nimport { atmosphereUboDeclaration } from \"../Shaders/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { intersectionFunctions } from \"core/Shaders/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctions } from \"../Shaders/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"skyViewPixelShader\";\nconst shader = `#define RENDER_SKY_VIEW\nprecision highp float;precision highp sampler2D;\n#include<__decl__atmosphereFragment>\nuniform sampler2D transmittanceLut;uniform sampler2D multiScatteringLut;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderSkyView(uv,transmittanceLut,multiScatteringLut);}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [atmosphereFragmentDeclaration, atmosphereUboDeclaration, helperFunctions, intersectionFunctions, atmosphereFunctions];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const skyViewPixelShader = { name, shader };\n"]}
@@ -1,7 +1,3 @@
1
- import "../Shaders/ShadersInclude/atmosphereFragmentDeclaration.js";
2
- import "../Shaders/ShadersInclude/atmosphereUboDeclaration.js";
3
- import "@onerjs/core/Shaders/ShadersInclude/helperFunctions.js";
4
- import "../Shaders/ShadersInclude/atmosphereFunctions.js";
5
1
  /** @internal */
6
2
  export declare const transmittancePixelShader: {
7
3
  name: string;
@@ -1,9 +1,10 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../Shaders/ShadersInclude/atmosphereFragmentDeclaration.js";
4
- import "../Shaders/ShadersInclude/atmosphereUboDeclaration.js";
5
- import "@onerjs/core/Shaders/ShadersInclude/helperFunctions.js";
6
- import "../Shaders/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereFragmentDeclaration } from "../Shaders/ShadersInclude/atmosphereFragmentDeclaration.js";
4
+ import { atmosphereUboDeclaration } from "../Shaders/ShadersInclude/atmosphereUboDeclaration.js";
5
+ import { helperFunctions } from "@onerjs/core/Shaders/ShadersInclude/helperFunctions.js";
6
+ import { intersectionFunctions } from "@onerjs/core/Shaders/ShadersInclude/intersectionFunctions.js";
7
+ import { atmosphereFunctions } from "../Shaders/ShadersInclude/atmosphereFunctions.js";
7
8
  const name = "transmittancePixelShader";
8
9
  const shader = `#define RENDER_TRANSMITTANCE
9
10
  #define EXCLUDE_RAY_MARCHING_FUNCTIONS
@@ -16,6 +17,12 @@ varying vec2 uv;void main() {gl_FragColor=renderTransmittance(uv);}`;
16
17
  if (!ShaderStore.ShadersStore[name]) {
17
18
  ShaderStore.ShadersStore[name] = shader;
18
19
  }
20
+ const includes = [atmosphereFragmentDeclaration, atmosphereUboDeclaration, helperFunctions, intersectionFunctions, atmosphereFunctions];
21
+ for (const inc of includes) {
22
+ if (!ShaderStore.IncludesShadersStore[inc.name]) {
23
+ ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
24
+ }
25
+ }
19
26
  /** @internal */
20
27
  export const transmittancePixelShader = { name, shader };
21
28
  //# sourceMappingURL=transmittance.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transmittance.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/Shaders/transmittance.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,yDAAyD,CAAC;AACjE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6CAA6C,CAAC;AACrD,OAAO,+CAA+C,CAAC;AAEvD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;oEAMqD,CAAC;AACrE,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../Shaders/ShadersInclude/atmosphereFragmentDeclaration\";\nimport \"../Shaders/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"../Shaders/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"transmittancePixelShader\";\nconst shader = `#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\nprecision highp float;\n#include<__decl__atmosphereFragment>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderTransmittance(uv);}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const transmittancePixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"transmittance.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/Shaders/transmittance.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;oEAMqD,CAAC;AACrE,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,6BAA6B,EAAE,wBAAwB,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AACxI,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereFragmentDeclaration } from \"../Shaders/ShadersInclude/atmosphereFragmentDeclaration\";\nimport { atmosphereUboDeclaration } from \"../Shaders/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctions } from \"core/Shaders/ShadersInclude/helperFunctions\";\nimport { intersectionFunctions } from \"core/Shaders/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctions } from \"../Shaders/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"transmittancePixelShader\";\nconst shader = `#define RENDER_TRANSMITTANCE\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\nprecision highp float;\n#include<__decl__atmosphereFragment>\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vec2 uv;void main() {gl_FragColor=renderTransmittance(uv);}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\nconst includes = [atmosphereFragmentDeclaration, atmosphereUboDeclaration, helperFunctions, intersectionFunctions, atmosphereFunctions];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStore[inc.name]) {\n ShaderStore.IncludesShadersStore[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const transmittancePixelShader = { name, shader };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"atmosphereFunctions.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/atmosphereFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,uDAAuD,CAAC;AAE/D,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwOd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\n\nconst name = \"atmosphereFunctions\";\nconst shader = `#include<intersectionFunctions>\nconst MultiScatteringLutSize=vec2f(32.,32.);const MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2f(1.))/MultiScatteringLutSize;const MultiScatteringLutHalfTexelSize=vec2f(.5)/MultiScatteringLutSize;const NumAerialPerspectiveLutLayers=32.;const AerialPerspectiveLutSize=vec3f(16.,64.,NumAerialPerspectiveLutLayers);const DiffuseSkyIrradianceLutSize=vec2f(64.,16.);const DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2f(1.))/DiffuseSkyIrradianceLutSize;const DiffuseSkyIrradianceLutHalfTexelSize=vec2f(.5)/DiffuseSkyIrradianceLutSize;const SkyViewLutSize=vec2f(128.,128.);const SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2f(1.))/SkyViewLutSize;const SkyViewLutHalfTexelSize=vec2f(.5)/SkyViewLutSize;const AerialPerspectiveLutKMPerSlice=4.;const AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const TransmittanceLutSize=vec2f(256.,64.);const TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2f(1.))/TransmittanceLutSize;const TransmittanceLutHalfTexelSize=vec2f(.5)/TransmittanceLutSize;const TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const TransmittanceMaxUnoccludedU=1.-.5*TransmittanceHorizonRange;const TransmittanceMinOccludedU=1.+.5*TransmittanceHorizonRange;fn uvToUnit(uv: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return (uv-halfTexelSize)/domainInUVSpace;}\nfn unitToUV(unit: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return unit*domainInUVSpace+halfTexelSize;}\nfn sphereIntersectNearest(rayOrigin: vec3f,rayDirection: vec3f,sphereRadius: f32)->f32 {let result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);let c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return select(result.x,result.y,c>=0.);}\nfn moveToTopAtmosphere(\ncameraPosition: vec3f,\npositionRadius: f32,\npositionGeocentricNormal: vec3f,\nrayDirection: vec3f,\nintersectsAtmosphere: ptr<function,bool>,\ncameraPositionClampedToTopOfAtmosphere: ptr<function,vec3f>\n) {*intersectsAtmosphere=true;*cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphere.atmosphereRadius) {let tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphere.atmosphereRadius);if (tTop>=0.) {let upOffset=-atmosphere.planetRadiusOffset*positionGeocentricNormal;*cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {*intersectsAtmosphere=false;}}}\nfn getSkyViewUVFromParameters(\nintersectsGround: bool,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: f32,\ncosAngleBetweenViewAndLightOnPlane: f32,\nuv: ptr<function,vec2f>\n) {var unit=vec2f(0.);if (intersectsGround) {var coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=.5*coord; } else {var coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=.5*coord+.5; }\nunit.x=.5-.5*cosAngleBetweenViewAndLightOnPlane;*uv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nfn sampleSkyViewLut(\nskyViewLut: texture_2d<f32>,\npositionRadius: f32,\ngeocentricNormal: vec3f,\nrayDirection: vec3f,\ndirectionToLight: vec3f,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\nisRayIntersectingGround: ptr<function,bool>\n)->vec4f {*cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphere.atmosphereRadius) {let sinAngleBetweenViewAndNadir=sqrtClamped(1.-*cosAngleBetweenViewAndZenith**cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>atmosphere.sinCameraAtmosphereHorizonAngleFromNadir) {*isRayIntersectingGround=false;return vec4f(0.);}}\nlet sideVector=normalize(cross(geocentricNormal,rayDirection));let forwardVector=normalize(cross(sideVector,geocentricNormal));let lightOnPlane=normalize(vec2f(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));let cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;let rayIntersectionScale=mix(.95,1.,saturate((positionRadius-atmosphere.planetRadius)/atmosphere.atmosphereThickness));*isRayIntersectingGround =\npositionRadius>atmosphere.planetRadius &&\n(rayIntersectionScale**cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;var uv: vec2f;getSkyViewUVFromParameters(\n*isRayIntersectingGround,\ncosHorizonAngleFromZenith,\n*cosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\n&uv);return textureSampleLevel(skyViewLut,skyViewLutSampler,uv,0.);}\n#endif\nfn computeRayleighPhase(onePlusCosThetaSq: f32)->f32 {return 0.0596831037*onePlusCosThetaSq;}\nfn computeMiePhaseCornetteShanks(cosTheta: f32,onePlusCosThetaSq: f32)->f32 {const g=.8;const gSquared=g*g;const oneMinusGSquared=1.-gSquared;const onePlusGSquared=1.+gSquared;const twoPlusGSquared=2.+gSquared;const twoG=2.*g;const threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfn computeOzoneDensity(normalizedViewHeight: f32)->f32 {const MinOzoneDensity=.135;const OneMinusMinOzoneDensity=1.-MinOzoneDensity;const OzoneStartHeight=.15; \nconst PeakOzoneHeight=.25;const MaxOzoneHeight=.6;const InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);let lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;let sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);let upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;let densityOzone=select(upperAtmosphereDensity,lowerAtmosphereDensity,normalizedViewHeight<PeakOzoneHeight);return densityOzone;}\nfn sampleMediumRGB(\nviewHeight: f32,\nscatteringRayleigh: ptr<function,vec3f>,\nscatteringMie: ptr<function,vec3f>,\nextinction: ptr<function,vec3f>,\nscattering: ptr<function,vec3f>\n) {let normalizedViewHeight=saturate(viewHeight*atmosphere.inverseAtmosphereThickness);let densityMie=exp(-83.333*normalizedViewHeight);let densityRayleigh=exp(-12.5*normalizedViewHeight);let densityOzone=computeOzoneDensity(normalizedViewHeight);*scatteringRayleigh=densityRayleigh*atmosphere.peakRayleighScattering;*scatteringMie=densityMie*atmosphere.peakMieScattering;*scattering=*scatteringMie+*scatteringRayleigh;let extinctionRayleigh=*scatteringRayleigh;let extinctionMie=densityMie*atmosphere.peakMieExtinction;let extinctionOzone=densityOzone*atmosphere.peakOzoneAbsorption;*extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nfn computeTransmittance(rayOriginGlobal: vec3f,rayDirection: vec3f,tMax: f32,sampleCount: f32)->vec3f {var opticalDepth=vec3f(0.);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nfn getTransmittanceUV(radius: f32,cosAngleLightToZenith: f32,distanceToHorizon: ptr<function,f32>)->vec2f {let radiusSquared=radius*radius;let horizonDistance=sqrtClamped(radiusSquared-atmosphere.planetRadiusSquared);*distanceToHorizon=horizonDistance;let cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;let discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphere.atmosphereRadiusSquared;let distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));let minDistanceToAtmosphereEdge=max(0.,atmosphere.atmosphereRadius-radius);let maxDistanceToAtmosphereEdge=horizonDistance+atmosphere.horizonDistanceToAtmosphereEdge;let cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToHorizonCoordinate=horizonDistance/max(.000001,atmosphere.horizonDistanceToAtmosphereEdge);let unit=vec2f(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nfn sampleTransmittanceLut(transmittanceLut: texture_2d<f32>,positionRadius: f32,cosAngleLightToZenith: f32)->vec4f {var distanceToHorizon=0.;let uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,&distanceToHorizon);let weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureSampleLevel(transmittanceLut,transmittanceLutSampler,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nfn sampleMultiScatteringLut(multiScatteringLut: texture_2d<f32>,radius: f32,cosAngleLightToZenith: f32)->vec3f {let unit=vec2f(.5+.5*cosAngleLightToZenith,(radius-atmosphere.planetRadius)/atmosphere.atmosphereThickness);let uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let multiScattering=textureSampleLevel(multiScatteringLut,multiScatteringLutSampler,uv,0.).rgb;return max(atmosphere.minMultiScattering,multiScattering);}\n#endif\nconst uniformPhase=RECIPROCAL_PI4;fn integrateScatteredRadiance(\nisAerialPerspectiveLut: bool,\nlightIntensityParam: f32,\ntransmittanceLut: texture_2d<f32>,\n#ifndef COMPUTE_MULTI_SCATTERING\nmultiScatteringLut: texture_2d<f32>,\nmultiScatteringIntensityParam: f32,\n#endif\nrayOriginGlobal: vec3f,\nrayDirection: vec3f,\ndirectionToLightParam: vec3f,\ntMaxMax: f32,\nsampleCount: f32,\ndistanceToSurface: f32,\ntransmittance: ptr<function,vec3f>\n#if COMPUTE_MULTI_SCATTERING\n,multiScattering: ptr<function,vec3f>\n#endif\n)->vec3f {var radiance=vec3f(0.);*transmittance=vec3f(1.);\n#if COMPUTE_MULTI_SCATTERING\n*multiScattering=vec3f(0.);\n#endif\nlet tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.planetRadius);let tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.atmosphereRadius);var tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nlet cosTheta=dot(rayDirection,directionToLightParam);let onePlusCosThetaSq=1.+cosTheta*cosTheta;let rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);let miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nlet transmittanceScale=select(1.,atmosphere.aerialPerspectiveTransmittanceScale,isAerialPerspectiveLut);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;let sampleRadiusGlobal=length(samplePositionGlobal);let sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;let sampleCosAngleLightToZenith=dot(directionToLightParam,sampleGeocentricNormal);var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;sampleMediumRGB(sampleRadiusGlobal-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);let transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nlet phaseTimesScattering=uniformPhase*scattering;let S=transmittanceToLight*phaseTimesScattering;\n#else\nlet phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;let multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);let S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensityParam*multiScatteredRadiance*scattering;\n#endif\nlet sampleOpticalDepth=extinction*dt;let sampleTransmittanceVal=exp(-sampleOpticalDepth);let clampedExtinction=max(vec3f(.0000001),extinction);let SInt=(S-S*sampleTransmittanceVal)/clampedExtinction;radiance+=*transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nlet MSInt=(scattering-scattering*sampleTransmittanceVal)/clampedExtinction;*multiScattering+=*transmittance*MSInt;\n#endif\n*transmittance*=sampleTransmittanceVal;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {let planetPos=rayOriginGlobal+tBottom*rayDirection;let planetPosRadius=length(planetPos);let planetPosGeocentricNormal=planetPos/planetPosRadius;let nDotL=dot(directionToLightParam,planetPosGeocentricNormal);let lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance**transmittance*atmosphere.groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensityParam;return radiance;}\n#endif\nfn layerIdxToAerialPerspectiveLayer(layerIdx: f32)->f32 {var layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfn toAerialPerspectiveDepth(layer: f32)->f32 {return layer*AerialPerspectiveLutKMPerSlice;}\nfn toAerialPerspectiveLayer(distance: f32,aerialPerspectiveLutDistancePerSlice: f32)->f32 {return distance/aerialPerspectiveLutDistancePerSlice;}\nfn applyAerialPerspectiveSaturation(aerialPerspective: vec4f)->vec4f {let previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);let mixed=mix(vec3f(previousRadiance),aerialPerspective.rgb,atmosphere.aerialPerspectiveSaturation);return vec4f(mixed,aerialPerspective.a);}\nfn applyAerialPerspectiveIntensity(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (atmosphere.aerialPerspectiveIntensity==0.) {result=vec4f(0.);} else {let previousAlpha=result.a;result=result/max(.00001,previousAlpha);result=result*pow(previousAlpha,1./atmosphere.aerialPerspectiveIntensity);}\n#endif\nreturn result;}\nfn applyAerialPerspectiveRadianceBias(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nlet originalRadiance=dot(result.rgb,LuminanceEncodeApprox);let targetRadiance=originalRadiance+atmosphere.aerialPerspectiveRadianceBias;if (originalRadiance>0.) {result=result*max(0.,targetRadiance/originalRadiance);} else {result=max(vec4f(0.),vec4f(atmosphere.aerialPerspectiveRadianceBias));}\nresult.a=min(result.a,1.);\n#endif\nreturn result;}\nfn sampleAerialPerspectiveLut(\nscreenUV: vec2f,\nclampToLutRange: bool,\ndistanceFromCamera: f32,\nnumAerialPerspectiveLutLayers: f32,\naerialPerspectiveLutKMPerSlice: f32,\naerialPerspectiveLutRangeKM: f32,\naerialPerspective: ptr<function,vec4f>\n)->bool {*aerialPerspective=vec4f(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\natmosphere.clampedCameraRadius<=atmosphere.atmosphereRadius) {var layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);let normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);let weight=min(layer,1.);let layerIdx=max(0.,layer-1.);let floorLayerIdx=floor(layerIdx);let aerialPerspectiveLayer0=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx),0.);let aerialPerspectiveLayer1=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx+1.),0.);var interpolated=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);interpolated=vec4f(interpolated.rgb*atmosphere.atmosphereExposure,interpolated.a);interpolated=applyAerialPerspectiveSaturation(interpolated);interpolated=weight*applyAerialPerspectiveIntensity(interpolated);interpolated=applyAerialPerspectiveRadianceBias(interpolated);*aerialPerspective=interpolated;return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nfn getTransmittanceParameters(uv: vec2f,radius: ptr<function,f32>,cosAngleLightToZenith: ptr<function,f32>,distanceToAtmosphereEdge: ptr<function,f32>) {let unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);let distanceToHorizon=unit.y*atmosphere.horizonDistanceToAtmosphereEdge;let distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;*radius=sqrtClamped(distanceToHorizonSquared+atmosphere.planetRadiusSquared);let minDistanceToAtmosphereEdge=atmosphere.atmosphereRadius-*radius;let maxDistanceToAtmosphereEdge=distanceToHorizon+atmosphere.horizonDistanceToAtmosphereEdge;*distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToAtmosphereEdgeSquared=*distanceToAtmosphereEdge**distanceToAtmosphereEdge;*cosAngleLightToZenith=select(\n(atmosphere.horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.**radius**distanceToAtmosphereEdge),\n1.,\n*distanceToAtmosphereEdge<=0.\n);*cosAngleLightToZenith=clamp(*cosAngleLightToZenith,-1.,1.);}\nfn renderTransmittance(uv: vec2f)->vec4f {var radius: f32;var cosAngleLightToZenith: f32;var distanceToAtmosphereEdgeAlongAngle: f32;getTransmittanceParameters(uv,&radius,&cosAngleLightToZenith,&distanceToAtmosphereEdgeAlongAngle);let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLight=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let transmittance=computeTransmittance(vec3f(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,atmosphere.transmittanceSampleCount);return vec4f(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nfn getSphereSample(azimuth: f32,inclination: f32,sinInclination: ptr<function,f32>)->vec3f {*sinInclination=sin(inclination);return vec3f(*sinInclination*sin(azimuth),cos(inclination),*sinInclination*cos(azimuth));}\nfn renderMultiScattering(uv: vec2f,transmittanceLut: texture_2d<f32>)->vec4f {let MultiScatteringAzimuthIterationAngle=TWO_PI/atmosphere.multiScatteringAzimuthSampleCount;let MultiScatteringInclinationIterationAngle=PI/atmosphere.multiScatteringInclinationSampleCount;let MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;let unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let cosAngleLightToZenith=2.*unit.x-1.;let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLightLocal=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let rayOriginRadius=atmosphere.planetRadius+max(unit.y,.001)*atmosphere.atmosphereThickness;let rayOrigin=vec3f(0.,rayOriginRadius,0.);var inscattered=vec3f(0.);var multiScatteringTotal=vec3f(0.);for (var i=.5; i<atmosphere.multiScatteringAzimuthSampleCount; i+=1.) {let azimuth=MultiScatteringAzimuthIterationAngle*i;for (var j=.5; j<atmosphere.multiScatteringInclinationSampleCount; j+=1.) {let inclination=MultiScatteringInclinationIterationAngle*j;var sinInclination: f32;let rayDirection=getSphereSample(azimuth,inclination,&sinInclination);var transmittanceVal: vec3f;var multiScatteringVal: vec3f;let radianceVal=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLightLocal,\n100000000.,\natmosphere.multiScatteringLutSampleCount,\n-1.,\n&transmittanceVal,\n&multiScatteringVal);let weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScatteringVal*weight;inscattered+=radianceVal*weight;}}\nlet multiScatteringResult=inscattered/max(vec3f(.000001),vec3f(1.)-multiScatteringTotal);return vec4f(multiScatteringResult,1.);}\n#endif\nfn computeCosHorizonAngleFromZenith(radius: f32)->f32 {let sinAngleBetweenHorizonAndNadir=min(1.,atmosphere.planetRadius/radius);let cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);let cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nfn getSkyViewParametersFromUV(\nradius: f32,\nuv: vec2f,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\ncosAngleBetweenViewAndLightOnPlane: ptr<function,f32>\n) {let unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);let cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<.5) {var coord=2.*unit.y; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {var coord=2.*unit.y-1.; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n*cosAngleBetweenViewAndLightOnPlane=1.-2.*unit.x;}\nfn renderSkyView(uv: vec2f,transmittanceLut: texture_2d<f32>,multiScatteringLut: texture_2d<f32>)->vec4f {var cosAngleBetweenViewAndZenith: f32;var cosAngleBetweenViewAndLightOnPlane: f32;getSkyViewParametersFromUV(atmosphere.clampedCameraRadius,uv,&cosAngleBetweenViewAndZenith,&cosAngleBetweenViewAndLightOnPlane);let sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);let sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);let rayDirection =\nvec3f(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\nvec3f(0.,atmosphere.clampedCameraRadius,0.),\natmosphere.clampedCameraRadius,\nvec3f(0.,1.,0.),\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere\n);if (!intersectsAtmosphere) {return vec4f(0.);}\nvar transmittanceVal: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLightRelativeToCameraGeocentricNormal,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittanceVal\n);let transparency=1.-avg(transmittanceVal);return vec4f(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nfn renderCameraVolume(\npositionOnNearPlane: vec3f,\nlayerIdx: f32,\ntransmittanceLut: texture_2d<f32>,\nmultiScatteringLut: texture_2d<f32>\n)->vec4f {var result=vec4f(0.);let rayDirection=normalize(positionOnNearPlane);let layer=layerIdxToAerialPerspectiveLayer(layerIdx);let tMax=toAerialPerspectiveDepth(layer);var tMaxMax=tMax;var cameraPositionGlobalClampedToTopOfAtmosphere=atmosphere.clampedCameraPositionGlobal;if (atmosphere.clampedCameraRadius>=atmosphere.atmosphereRadius) {var intersectsAtmosphere=false;moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nlet distanceToAtmosphere=distance(atmosphere.clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nlet sampleCount=min(atmosphere.skyViewLutSampleCount,2.*layer+2.);var transmittance: vec3f;let radiance=integrateScatteredRadiance(\ntrue,\natmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\ntMaxMax,\nsampleCount,\n-1.,\n&transmittance);let transparency=1.-avg(transmittance);result=vec4f(radiance,transparency);return result;}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const atmosphereFunctionsWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"atmosphereFunctions.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/atmosphereFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,uDAAuD,CAAC;AAC/D,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwOd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nconst name = \"atmosphereFunctions\";\nconst shader = `#include<intersectionFunctions>\nconst MultiScatteringLutSize=vec2f(32.,32.);const MultiScatteringLutDomainInUVSpace=(MultiScatteringLutSize-vec2f(1.))/MultiScatteringLutSize;const MultiScatteringLutHalfTexelSize=vec2f(.5)/MultiScatteringLutSize;const NumAerialPerspectiveLutLayers=32.;const AerialPerspectiveLutSize=vec3f(16.,64.,NumAerialPerspectiveLutLayers);const DiffuseSkyIrradianceLutSize=vec2f(64.,16.);const DiffuseSkyIrradianceLutDomainInUVSpace=(DiffuseSkyIrradianceLutSize-vec2f(1.))/DiffuseSkyIrradianceLutSize;const DiffuseSkyIrradianceLutHalfTexelSize=vec2f(.5)/DiffuseSkyIrradianceLutSize;const SkyViewLutSize=vec2f(128.,128.);const SkyViewLutDomainInUVSpace=(SkyViewLutSize-vec2f(1.))/SkyViewLutSize;const SkyViewLutHalfTexelSize=vec2f(.5)/SkyViewLutSize;const AerialPerspectiveLutKMPerSlice=4.;const AerialPerspectiveLutRangeKM=AerialPerspectiveLutKMPerSlice*NumAerialPerspectiveLutLayers;const TransmittanceLutSize=vec2f(256.,64.);const TransmittanceLutDomainInUVSpace=(TransmittanceLutSize-vec2f(1.))/TransmittanceLutSize;const TransmittanceLutHalfTexelSize=vec2f(.5)/TransmittanceLutSize;const TransmittanceHorizonRange=2.*TransmittanceLutHalfTexelSize.x;const TransmittanceMaxUnoccludedU=1.-.5*TransmittanceHorizonRange;const TransmittanceMinOccludedU=1.+.5*TransmittanceHorizonRange;fn uvToUnit(uv: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return (uv-halfTexelSize)/domainInUVSpace;}\nfn unitToUV(unit: vec2f,domainInUVSpace: vec2f,halfTexelSize: vec2f)->vec2f {return unit*domainInUVSpace+halfTexelSize;}\nfn sphereIntersectNearest(rayOrigin: vec3f,rayDirection: vec3f,sphereRadius: f32)->f32 {let result=sphereIntersectFromOrigin(rayOrigin,rayDirection,sphereRadius);let c=dot(rayOrigin,rayOrigin)-sphereRadius*sphereRadius;return select(result.x,result.y,c>=0.);}\nfn moveToTopAtmosphere(\ncameraPosition: vec3f,\npositionRadius: f32,\npositionGeocentricNormal: vec3f,\nrayDirection: vec3f,\nintersectsAtmosphere: ptr<function,bool>,\ncameraPositionClampedToTopOfAtmosphere: ptr<function,vec3f>\n) {*intersectsAtmosphere=true;*cameraPositionClampedToTopOfAtmosphere=cameraPosition;if (positionRadius>atmosphere.atmosphereRadius) {let tTop=sphereIntersectNearest(cameraPosition,rayDirection,atmosphere.atmosphereRadius);if (tTop>=0.) {let upOffset=-atmosphere.planetRadiusOffset*positionGeocentricNormal;*cameraPositionClampedToTopOfAtmosphere=cameraPosition+rayDirection*tTop+upOffset;} else {*intersectsAtmosphere=false;}}}\nfn getSkyViewUVFromParameters(\nintersectsGround: bool,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: f32,\ncosAngleBetweenViewAndLightOnPlane: f32,\nuv: ptr<function,vec2f>\n) {var unit=vec2f(0.);if (intersectsGround) {var coord=(cosAngleBetweenViewAndZenith+1.)/(cosHorizonAngleFromZenith+1.);coord=sqrtClamped(coord); \nunit.y=.5*coord; } else {var coord=(cosAngleBetweenViewAndZenith-cosHorizonAngleFromZenith)/(1.-cosHorizonAngleFromZenith);coord=sqrtClamped(coord); \nunit.y=.5*coord+.5; }\nunit.x=.5-.5*cosAngleBetweenViewAndLightOnPlane;*uv=unitToUV(unit,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);}\n#if USE_SKY_VIEW_LUT && SAMPLE_SKY_VIEW_LUT\nfn sampleSkyViewLut(\nskyViewLut: texture_2d<f32>,\npositionRadius: f32,\ngeocentricNormal: vec3f,\nrayDirection: vec3f,\ndirectionToLight: vec3f,\ncosHorizonAngleFromZenith: f32,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\nisRayIntersectingGround: ptr<function,bool>\n)->vec4f {*cosAngleBetweenViewAndZenith=dot(rayDirection,geocentricNormal);if (positionRadius>atmosphere.atmosphereRadius) {let sinAngleBetweenViewAndNadir=sqrtClamped(1.-*cosAngleBetweenViewAndZenith**cosAngleBetweenViewAndZenith);if (sinAngleBetweenViewAndNadir>atmosphere.sinCameraAtmosphereHorizonAngleFromNadir) {*isRayIntersectingGround=false;return vec4f(0.);}}\nlet sideVector=normalize(cross(geocentricNormal,rayDirection));let forwardVector=normalize(cross(sideVector,geocentricNormal));let lightOnPlane=normalize(vec2f(dot(directionToLight,forwardVector),dot(directionToLight,sideVector)));let cosAngleBetweenViewAndLightOnPlane=lightOnPlane.x;let rayIntersectionScale=mix(.95,1.,saturate((positionRadius-atmosphere.planetRadius)/atmosphere.atmosphereThickness));*isRayIntersectingGround =\npositionRadius>atmosphere.planetRadius &&\n(rayIntersectionScale**cosAngleBetweenViewAndZenith)<=cosHorizonAngleFromZenith;var uv: vec2f;getSkyViewUVFromParameters(\n*isRayIntersectingGround,\ncosHorizonAngleFromZenith,\n*cosAngleBetweenViewAndZenith,\ncosAngleBetweenViewAndLightOnPlane,\n&uv);return textureSampleLevel(skyViewLut,skyViewLutSampler,uv,0.);}\n#endif\nfn computeRayleighPhase(onePlusCosThetaSq: f32)->f32 {return 0.0596831037*onePlusCosThetaSq;}\nfn computeMiePhaseCornetteShanks(cosTheta: f32,onePlusCosThetaSq: f32)->f32 {const g=.8;const gSquared=g*g;const oneMinusGSquared=1.-gSquared;const onePlusGSquared=1.+gSquared;const twoPlusGSquared=2.+gSquared;const twoG=2.*g;const threeOverEightPi=3./(8.*PI);return threeOverEightPi*oneMinusGSquared*onePlusCosThetaSq/(twoPlusGSquared*pow(onePlusGSquared-twoG*cosTheta,1.5));}\nfn computeOzoneDensity(normalizedViewHeight: f32)->f32 {const MinOzoneDensity=.135;const OneMinusMinOzoneDensity=1.-MinOzoneDensity;const OzoneStartHeight=.15; \nconst PeakOzoneHeight=.25;const MaxOzoneHeight=.6;const InverseRampupDistance=1./(PeakOzoneHeight-OzoneStartHeight);const InverseRampdownDistance=1./(MaxOzoneHeight-PeakOzoneHeight);let lowerAtmosphereDensity=MinOzoneDensity+OneMinusMinOzoneDensity*max(0.,normalizedViewHeight-OzoneStartHeight)*InverseRampupDistance;let sqrtUpperAtmosphereDensity=max(0.,1.-(normalizedViewHeight-PeakOzoneHeight)*InverseRampdownDistance);let upperAtmosphereDensity=sqrtUpperAtmosphereDensity*sqrtUpperAtmosphereDensity;let densityOzone=select(upperAtmosphereDensity,lowerAtmosphereDensity,normalizedViewHeight<PeakOzoneHeight);return densityOzone;}\nfn sampleMediumRGB(\nviewHeight: f32,\nscatteringRayleigh: ptr<function,vec3f>,\nscatteringMie: ptr<function,vec3f>,\nextinction: ptr<function,vec3f>,\nscattering: ptr<function,vec3f>\n) {let normalizedViewHeight=saturate(viewHeight*atmosphere.inverseAtmosphereThickness);let densityMie=exp(-83.333*normalizedViewHeight);let densityRayleigh=exp(-12.5*normalizedViewHeight);let densityOzone=computeOzoneDensity(normalizedViewHeight);*scatteringRayleigh=densityRayleigh*atmosphere.peakRayleighScattering;*scatteringMie=densityMie*atmosphere.peakMieScattering;*scattering=*scatteringMie+*scatteringRayleigh;let extinctionRayleigh=*scatteringRayleigh;let extinctionMie=densityMie*atmosphere.peakMieExtinction;let extinctionOzone=densityOzone*atmosphere.peakOzoneAbsorption;*extinction=extinctionRayleigh+extinctionMie+extinctionOzone;}\nfn computeTransmittance(rayOriginGlobal: vec3f,rayDirection: vec3f,tMax: f32,sampleCount: f32)->vec3f {var opticalDepth=vec3f(0.);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;sampleMediumRGB(length(samplePositionGlobal)-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);opticalDepth+=extinction*dt;}\nreturn exp(-opticalDepth);}\n#if defined(SAMPLE_TRANSMITTANCE_LUT) || !defined(EXCLUDE_RAY_MARCHING_FUNCTIONS)\nfn getTransmittanceUV(radius: f32,cosAngleLightToZenith: f32,distanceToHorizon: ptr<function,f32>)->vec2f {let radiusSquared=radius*radius;let horizonDistance=sqrtClamped(radiusSquared-atmosphere.planetRadiusSquared);*distanceToHorizon=horizonDistance;let cosAngleLightToZenithSquared=cosAngleLightToZenith*cosAngleLightToZenith;let discriminant=radiusSquared*(cosAngleLightToZenithSquared-1.)+atmosphere.atmosphereRadiusSquared;let distanceToAtmosphereEdge=max(0.,-radius*cosAngleLightToZenith+sqrtClamped(discriminant));let minDistanceToAtmosphereEdge=max(0.,atmosphere.atmosphereRadius-radius);let maxDistanceToAtmosphereEdge=horizonDistance+atmosphere.horizonDistanceToAtmosphereEdge;let cosAngleLightToZenithCoordinate=(distanceToAtmosphereEdge-minDistanceToAtmosphereEdge)/max(.000001,maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToHorizonCoordinate=horizonDistance/max(.000001,atmosphere.horizonDistanceToAtmosphereEdge);let unit=vec2f(cosAngleLightToZenithCoordinate,distanceToHorizonCoordinate);return unit*TransmittanceLutDomainInUVSpace+TransmittanceLutHalfTexelSize; }\nfn sampleTransmittanceLut(transmittanceLut: texture_2d<f32>,positionRadius: f32,cosAngleLightToZenith: f32)->vec4f {var distanceToHorizon=0.;let uv=getTransmittanceUV(positionRadius,cosAngleLightToZenith,&distanceToHorizon);let weight=smoothstep(TransmittanceMinOccludedU,TransmittanceMaxUnoccludedU,uv.x);return weight*textureSampleLevel(transmittanceLut,transmittanceLutSampler,uv,0.);}\n#endif\n#ifndef EXCLUDE_RAY_MARCHING_FUNCTIONS\n#ifndef COMPUTE_MULTI_SCATTERING\nfn sampleMultiScatteringLut(multiScatteringLut: texture_2d<f32>,radius: f32,cosAngleLightToZenith: f32)->vec3f {let unit=vec2f(.5+.5*cosAngleLightToZenith,(radius-atmosphere.planetRadius)/atmosphere.atmosphereThickness);let uv=unitToUV(unit,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let multiScattering=textureSampleLevel(multiScatteringLut,multiScatteringLutSampler,uv,0.).rgb;return max(atmosphere.minMultiScattering,multiScattering);}\n#endif\nconst uniformPhase=RECIPROCAL_PI4;fn integrateScatteredRadiance(\nisAerialPerspectiveLut: bool,\nlightIntensityParam: f32,\ntransmittanceLut: texture_2d<f32>,\n#ifndef COMPUTE_MULTI_SCATTERING\nmultiScatteringLut: texture_2d<f32>,\nmultiScatteringIntensityParam: f32,\n#endif\nrayOriginGlobal: vec3f,\nrayDirection: vec3f,\ndirectionToLightParam: vec3f,\ntMaxMax: f32,\nsampleCount: f32,\ndistanceToSurface: f32,\ntransmittance: ptr<function,vec3f>\n#if COMPUTE_MULTI_SCATTERING\n,multiScattering: ptr<function,vec3f>\n#endif\n)->vec3f {var radiance=vec3f(0.);*transmittance=vec3f(1.);\n#if COMPUTE_MULTI_SCATTERING\n*multiScattering=vec3f(0.);\n#endif\nlet tBottom=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.planetRadius);let tTop=sphereIntersectNearest(rayOriginGlobal,rayDirection,atmosphere.atmosphereRadius);var tMax=0.;if (tBottom<0.) {if (tTop<0.) {return radiance;} else {tMax=tTop;}} else {if (tTop>0.) {if (isAerialPerspectiveLut) {tMax=tTop;} else {tMax=min(tBottom,tTop);}}}\nif (distanceToSurface>0. && distanceToSurface<tMax) {tMax=distanceToSurface;}\ntMax=min(tMax,tMaxMax);\n#ifndef COMPUTE_MULTI_SCATTERING\nlet cosTheta=dot(rayDirection,directionToLightParam);let onePlusCosThetaSq=1.+cosTheta*cosTheta;let rayleighPhase=computeRayleighPhase(onePlusCosThetaSq);let miePhase=computeMiePhaseCornetteShanks(cosTheta,onePlusCosThetaSq);\n#endif\nlet transmittanceScale=select(1.,atmosphere.aerialPerspectiveTransmittanceScale,isAerialPerspectiveLut);var t=0.;let sampleSegmentWeight=tMax/sampleCount;const sampleSegmentT=.3;for (var s=0.; s<sampleCount; s+=1.) {let newT=sampleSegmentWeight*(s+sampleSegmentT);let dt=newT-t;t=newT;let samplePositionGlobal=rayOriginGlobal+t*rayDirection;let sampleRadiusGlobal=length(samplePositionGlobal);let sampleGeocentricNormal=samplePositionGlobal/sampleRadiusGlobal;let sampleCosAngleLightToZenith=dot(directionToLightParam,sampleGeocentricNormal);var scatteringRayleigh: vec3f;var scatteringMie: vec3f;var extinction: vec3f;var scattering: vec3f;sampleMediumRGB(sampleRadiusGlobal-atmosphere.planetRadius,&scatteringRayleigh,&scatteringMie,&extinction,&scattering);let transmittanceToLight=sampleTransmittanceLut(transmittanceLut,sampleRadiusGlobal,sampleCosAngleLightToZenith).rgb;\n#if COMPUTE_MULTI_SCATTERING\nlet phaseTimesScattering=uniformPhase*scattering;let S=transmittanceToLight*phaseTimesScattering;\n#else\nlet phaseTimesScattering=scatteringMie*miePhase+scatteringRayleigh*rayleighPhase;let multiScatteredRadiance=sampleMultiScatteringLut(multiScatteringLut,sampleRadiusGlobal,sampleCosAngleLightToZenith);let S=transmittanceScale*transmittanceToLight*phaseTimesScattering+multiScatteringIntensityParam*multiScatteredRadiance*scattering;\n#endif\nlet sampleOpticalDepth=extinction*dt;let sampleTransmittanceVal=exp(-sampleOpticalDepth);let clampedExtinction=max(vec3f(.0000001),extinction);let SInt=(S-S*sampleTransmittanceVal)/clampedExtinction;radiance+=*transmittance*SInt;\n#if COMPUTE_MULTI_SCATTERING\nlet MSInt=(scattering-scattering*sampleTransmittanceVal)/clampedExtinction;*multiScattering+=*transmittance*MSInt;\n#endif\n*transmittance*=sampleTransmittanceVal;}\n#if USE_GROUND_ALBEDO\nif (tMax==tBottom && tBottom>0.) {let planetPos=rayOriginGlobal+tBottom*rayDirection;let planetPosRadius=length(planetPos);let planetPosGeocentricNormal=planetPos/planetPosRadius;let nDotL=dot(directionToLightParam,planetPosGeocentricNormal);let lightTransmittance=sampleTransmittanceLut(transmittanceLut,planetPosRadius,nDotL).rgb;const diffuseBrdf=RECIPROCAL_PI;radiance+=lightTransmittance**transmittance*atmosphere.groundAlbedo*(nDotL*diffuseBrdf);}\n#endif\nradiance*=lightIntensityParam;return radiance;}\n#endif\nfn layerIdxToAerialPerspectiveLayer(layerIdx: f32)->f32 {var layer=(layerIdx+1.)/NumAerialPerspectiveLutLayers;layer*=layer; \nlayer*=NumAerialPerspectiveLutLayers;return layer;}\nfn toAerialPerspectiveDepth(layer: f32)->f32 {return layer*AerialPerspectiveLutKMPerSlice;}\nfn toAerialPerspectiveLayer(distance: f32,aerialPerspectiveLutDistancePerSlice: f32)->f32 {return distance/aerialPerspectiveLutDistancePerSlice;}\nfn applyAerialPerspectiveSaturation(aerialPerspective: vec4f)->vec4f {let previousRadiance=getLuminanceUnclamped(aerialPerspective.rgb);let mixed=mix(vec3f(previousRadiance),aerialPerspective.rgb,atmosphere.aerialPerspectiveSaturation);return vec4f(mixed,aerialPerspective.a);}\nfn applyAerialPerspectiveIntensity(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_INTENSITY\nif (atmosphere.aerialPerspectiveIntensity==0.) {result=vec4f(0.);} else {let previousAlpha=result.a;result=result/max(.00001,previousAlpha);result=result*pow(previousAlpha,1./atmosphere.aerialPerspectiveIntensity);}\n#endif\nreturn result;}\nfn applyAerialPerspectiveRadianceBias(aerialPerspective: vec4f)->vec4f {var result=aerialPerspective;\n#if APPLY_AERIAL_PERSPECTIVE_RADIANCE_BIAS\nlet originalRadiance=dot(result.rgb,LuminanceEncodeApprox);let targetRadiance=originalRadiance+atmosphere.aerialPerspectiveRadianceBias;if (originalRadiance>0.) {result=result*max(0.,targetRadiance/originalRadiance);} else {result=max(vec4f(0.),vec4f(atmosphere.aerialPerspectiveRadianceBias));}\nresult.a=min(result.a,1.);\n#endif\nreturn result;}\nfn sampleAerialPerspectiveLut(\nscreenUV: vec2f,\nclampToLutRange: bool,\ndistanceFromCamera: f32,\nnumAerialPerspectiveLutLayers: f32,\naerialPerspectiveLutKMPerSlice: f32,\naerialPerspectiveLutRangeKM: f32,\naerialPerspective: ptr<function,vec4f>\n)->bool {*aerialPerspective=vec4f(0.);\n#if USE_AERIAL_PERSPECTIVE_LUT\nif (distanceFromCamera>0. &&\n(clampToLutRange || distanceFromCamera<aerialPerspectiveLutRangeKM) &&\natmosphere.clampedCameraRadius<=atmosphere.atmosphereRadius) {var layer=toAerialPerspectiveLayer(distanceFromCamera,aerialPerspectiveLutKMPerSlice);let normalizedLayer=sqrt(layer/numAerialPerspectiveLutLayers); \nlayer=min(normalizedLayer*numAerialPerspectiveLutLayers,numAerialPerspectiveLutLayers);let weight=min(layer,1.);let layerIdx=max(0.,layer-1.);let floorLayerIdx=floor(layerIdx);let aerialPerspectiveLayer0=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx),0.);let aerialPerspectiveLayer1=textureSampleLevel(aerialPerspectiveLut,aerialPerspectiveLutSampler,screenUV,i32(floorLayerIdx+1.),0.);var interpolated=mix(aerialPerspectiveLayer0,aerialPerspectiveLayer1,layerIdx-floorLayerIdx);interpolated=vec4f(interpolated.rgb*atmosphere.atmosphereExposure,interpolated.a);interpolated=applyAerialPerspectiveSaturation(interpolated);interpolated=weight*applyAerialPerspectiveIntensity(interpolated);interpolated=applyAerialPerspectiveRadianceBias(interpolated);*aerialPerspective=interpolated;return true;}\n#endif\nreturn false;}\n#if RENDER_TRANSMITTANCE\nfn getTransmittanceParameters(uv: vec2f,radius: ptr<function,f32>,cosAngleLightToZenith: ptr<function,f32>,distanceToAtmosphereEdge: ptr<function,f32>) {let unit=uvToUnit(uv,TransmittanceLutDomainInUVSpace,TransmittanceLutHalfTexelSize);let distanceToHorizon=unit.y*atmosphere.horizonDistanceToAtmosphereEdge;let distanceToHorizonSquared=distanceToHorizon*distanceToHorizon;*radius=sqrtClamped(distanceToHorizonSquared+atmosphere.planetRadiusSquared);let minDistanceToAtmosphereEdge=atmosphere.atmosphereRadius-*radius;let maxDistanceToAtmosphereEdge=distanceToHorizon+atmosphere.horizonDistanceToAtmosphereEdge;*distanceToAtmosphereEdge=minDistanceToAtmosphereEdge+unit.x*(maxDistanceToAtmosphereEdge-minDistanceToAtmosphereEdge);let distanceToAtmosphereEdgeSquared=*distanceToAtmosphereEdge**distanceToAtmosphereEdge;*cosAngleLightToZenith=select(\n(atmosphere.horizonDistanceToAtmosphereEdgeSquared-distanceToAtmosphereEdgeSquared-distanceToHorizonSquared)/(2.**radius**distanceToAtmosphereEdge),\n1.,\n*distanceToAtmosphereEdge<=0.\n);*cosAngleLightToZenith=clamp(*cosAngleLightToZenith,-1.,1.);}\nfn renderTransmittance(uv: vec2f)->vec4f {var radius: f32;var cosAngleLightToZenith: f32;var distanceToAtmosphereEdgeAlongAngle: f32;getTransmittanceParameters(uv,&radius,&cosAngleLightToZenith,&distanceToAtmosphereEdgeAlongAngle);let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLight=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let transmittance=computeTransmittance(vec3f(0.,radius,0.),directionToLight,distanceToAtmosphereEdgeAlongAngle,atmosphere.transmittanceSampleCount);return vec4f(transmittance,avg(transmittance));}\n#endif\n#if RENDER_MULTI_SCATTERING\nfn getSphereSample(azimuth: f32,inclination: f32,sinInclination: ptr<function,f32>)->vec3f {*sinInclination=sin(inclination);return vec3f(*sinInclination*sin(azimuth),cos(inclination),*sinInclination*cos(azimuth));}\nfn renderMultiScattering(uv: vec2f,transmittanceLut: texture_2d<f32>)->vec4f {let MultiScatteringAzimuthIterationAngle=TWO_PI/atmosphere.multiScatteringAzimuthSampleCount;let MultiScatteringInclinationIterationAngle=PI/atmosphere.multiScatteringInclinationSampleCount;let MultiScatteringAngleStepProduct=MultiScatteringAzimuthIterationAngle*MultiScatteringInclinationIterationAngle;let unit=uvToUnit(uv,MultiScatteringLutDomainInUVSpace,MultiScatteringLutHalfTexelSize);let cosAngleLightToZenith=2.*unit.x-1.;let sinAngleLightToZenith=sqrtClamped(1.-cosAngleLightToZenith*cosAngleLightToZenith);let directionToLightLocal=normalize(vec3f(0.,cosAngleLightToZenith,sinAngleLightToZenith));let rayOriginRadius=atmosphere.planetRadius+max(unit.y,.001)*atmosphere.atmosphereThickness;let rayOrigin=vec3f(0.,rayOriginRadius,0.);var inscattered=vec3f(0.);var multiScatteringTotal=vec3f(0.);for (var i=.5; i<atmosphere.multiScatteringAzimuthSampleCount; i+=1.) {let azimuth=MultiScatteringAzimuthIterationAngle*i;for (var j=.5; j<atmosphere.multiScatteringInclinationSampleCount; j+=1.) {let inclination=MultiScatteringInclinationIterationAngle*j;var sinInclination: f32;let rayDirection=getSphereSample(azimuth,inclination,&sinInclination);var transmittanceVal: vec3f;var multiScatteringVal: vec3f;let radianceVal=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nrayOrigin,\nrayDirection,\ndirectionToLightLocal,\n100000000.,\natmosphere.multiScatteringLutSampleCount,\n-1.,\n&transmittanceVal,\n&multiScatteringVal);let weight=RECIPROCAL_PI4*abs(sinInclination)*MultiScatteringAngleStepProduct;multiScatteringTotal+=multiScatteringVal*weight;inscattered+=radianceVal*weight;}}\nlet multiScatteringResult=inscattered/max(vec3f(.000001),vec3f(1.)-multiScatteringTotal);return vec4f(multiScatteringResult,1.);}\n#endif\nfn computeCosHorizonAngleFromZenith(radius: f32)->f32 {let sinAngleBetweenHorizonAndNadir=min(1.,atmosphere.planetRadius/radius);let cosHorizonAngleFromNadir=sqrt(1.-sinAngleBetweenHorizonAndNadir*sinAngleBetweenHorizonAndNadir);let cosHorizonAngleFromZenith=-cosHorizonAngleFromNadir;return cosHorizonAngleFromZenith;}\n#if RENDER_SKY_VIEW\nfn getSkyViewParametersFromUV(\nradius: f32,\nuv: vec2f,\ncosAngleBetweenViewAndZenith: ptr<function,f32>,\ncosAngleBetweenViewAndLightOnPlane: ptr<function,f32>\n) {let unit=uvToUnit(uv,SkyViewLutDomainInUVSpace,SkyViewLutHalfTexelSize);let cosHorizonAngleFromZenith=computeCosHorizonAngleFromZenith(radius);if (unit.y<.5) {var coord=2.*unit.y; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(-1.,cosHorizonAngleFromZenith,coord); } else {var coord=2.*unit.y-1.; \ncoord*=coord; \n*cosAngleBetweenViewAndZenith=mix(cosHorizonAngleFromZenith,1.,coord); }\n*cosAngleBetweenViewAndLightOnPlane=1.-2.*unit.x;}\nfn renderSkyView(uv: vec2f,transmittanceLut: texture_2d<f32>,multiScatteringLut: texture_2d<f32>)->vec4f {var cosAngleBetweenViewAndZenith: f32;var cosAngleBetweenViewAndLightOnPlane: f32;getSkyViewParametersFromUV(atmosphere.clampedCameraRadius,uv,&cosAngleBetweenViewAndZenith,&cosAngleBetweenViewAndLightOnPlane);let sinAngleBetweenViewAndZenith=sqrtClamped(1.-cosAngleBetweenViewAndZenith*cosAngleBetweenViewAndZenith);let sinAngleBetweenViewAndLightOnPlane=sqrtClamped(1.-cosAngleBetweenViewAndLightOnPlane*cosAngleBetweenViewAndLightOnPlane);let rayDirection =\nvec3f(\nsinAngleBetweenViewAndZenith*cosAngleBetweenViewAndLightOnPlane,\ncosAngleBetweenViewAndZenith,\nsinAngleBetweenViewAndZenith*sinAngleBetweenViewAndLightOnPlane);var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\nvec3f(0.,atmosphere.clampedCameraRadius,0.),\natmosphere.clampedCameraRadius,\nvec3f(0.,1.,0.),\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere\n);if (!intersectsAtmosphere) {return vec4f(0.);}\nvar transmittanceVal: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLightRelativeToCameraGeocentricNormal,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittanceVal\n);let transparency=1.-avg(transmittanceVal);return vec4f(radiance,transparency);}\n#endif\n#if RENDER_CAMERA_VOLUME\nfn renderCameraVolume(\npositionOnNearPlane: vec3f,\nlayerIdx: f32,\ntransmittanceLut: texture_2d<f32>,\nmultiScatteringLut: texture_2d<f32>\n)->vec4f {var result=vec4f(0.);let rayDirection=normalize(positionOnNearPlane);let layer=layerIdxToAerialPerspectiveLayer(layerIdx);let tMax=toAerialPerspectiveDepth(layer);var tMaxMax=tMax;var cameraPositionGlobalClampedToTopOfAtmosphere=atmosphere.clampedCameraPositionGlobal;if (atmosphere.clampedCameraRadius>=atmosphere.atmosphereRadius) {var intersectsAtmosphere=false;moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return result;}\nlet distanceToAtmosphere=distance(atmosphere.clampedCameraPositionGlobal,cameraPositionGlobalClampedToTopOfAtmosphere);if (tMaxMax<distanceToAtmosphere) {return result;}\ntMaxMax=max(0.,tMaxMax-distanceToAtmosphere);}\nlet sampleCount=min(atmosphere.skyViewLutSampleCount,2.*layer+2.);var transmittance: vec3f;let radiance=integrateScatteredRadiance(\ntrue,\natmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\ntMaxMax,\nsampleCount,\n-1.,\n&transmittance);let transparency=1.-avg(transmittance);result=vec4f(radiance,transparency);return result;}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const atmosphereFunctionsWGSL = { name, shader };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"atmosphereUboDeclaration.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"atmosphereUboDeclaration\";\nconst shader = `struct Atmosphere {peakRayleighScattering: vec3<f32>,\nplanetRadius: f32,\npeakMieScattering: vec3<f32>,\natmosphereThickness: f32,\npeakMieAbsorption: vec3<f32>,\nplanetRadiusSquared: f32,\npeakMieExtinction: vec3<f32>,\natmosphereRadius: f32,\npeakOzoneAbsorption: vec3<f32>,\natmosphereRadiusSquared: f32,\nhorizonDistanceToAtmosphereEdge: f32,\nhorizonDistanceToAtmosphereEdgeSquared: f32,\nplanetRadiusWithOffset: f32,\nplanetRadiusOffset: f32,\natmosphereExposure: f32,\naerialPerspectiveRadianceBias: f32,\ninverseAtmosphereThickness: f32,\naerialPerspectiveTransmittanceScale: f32,\ninverseViewProjectionWithoutTranslation: mat4x4<f32>,\ndirectionToLight: vec3<f32>,\nmultiScatteringIntensity: f32,\ndirectionToLightRelativeToCameraGeocentricNormal: vec3<f32>,\ncameraRadius: f32,\nlightRadianceAtCamera: vec3<f32>,\ndiffuseSkyIrradianceDesaturationFactor: f32,\ngroundAlbedo: vec3<f32>,\naerialPerspectiveSaturation: f32,\nminMultiScattering: vec3<f32>,\ndiffuseSkyIrradianceIntensity: f32,\ncameraPositionGlobal: vec3<f32>,\nlightIntensity: f32,\nclampedCameraPositionGlobal: vec3<f32>,\naerialPerspectiveIntensity: f32,\ncameraGeocentricNormal: vec3<f32>,\nclampedCameraRadius: f32,\ncameraForward: vec3<f32>,\nclampedCameraHeight: f32,\ncameraPosition: vec3<f32>,\ncosCameraHorizonAngleFromZenith: f32,\nviewport: vec4<f32>,\nadditionalDiffuseSkyIrradiance: vec3<f32>,\ncameraHeight: f32,\ncameraNearPlane: f32,\noriginHeight: f32,\nsinCameraAtmosphereHorizonAngleFromNadir: f32,\ntransmittanceSampleCount: f32,\nskyViewLutSampleCount: f32,\nmultiScatteringLutSampleCount: f32,\nmultiScatteringAzimuthSampleCount: f32,\nmultiScatteringInclinationSampleCount: f32,\ndiffuseSkyIrradianceLutSampleCount: f32};var<uniform> atmosphere : Atmosphere;\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const atmosphereUboDeclarationWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"atmosphereUboDeclaration.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nconst name = \"atmosphereUboDeclaration\";\nconst shader = `struct Atmosphere {peakRayleighScattering: vec3<f32>,\nplanetRadius: f32,\npeakMieScattering: vec3<f32>,\natmosphereThickness: f32,\npeakMieAbsorption: vec3<f32>,\nplanetRadiusSquared: f32,\npeakMieExtinction: vec3<f32>,\natmosphereRadius: f32,\npeakOzoneAbsorption: vec3<f32>,\natmosphereRadiusSquared: f32,\nhorizonDistanceToAtmosphereEdge: f32,\nhorizonDistanceToAtmosphereEdgeSquared: f32,\nplanetRadiusWithOffset: f32,\nplanetRadiusOffset: f32,\natmosphereExposure: f32,\naerialPerspectiveRadianceBias: f32,\ninverseAtmosphereThickness: f32,\naerialPerspectiveTransmittanceScale: f32,\ninverseViewProjectionWithoutTranslation: mat4x4<f32>,\ndirectionToLight: vec3<f32>,\nmultiScatteringIntensity: f32,\ndirectionToLightRelativeToCameraGeocentricNormal: vec3<f32>,\ncameraRadius: f32,\nlightRadianceAtCamera: vec3<f32>,\ndiffuseSkyIrradianceDesaturationFactor: f32,\ngroundAlbedo: vec3<f32>,\naerialPerspectiveSaturation: f32,\nminMultiScattering: vec3<f32>,\ndiffuseSkyIrradianceIntensity: f32,\ncameraPositionGlobal: vec3<f32>,\nlightIntensity: f32,\nclampedCameraPositionGlobal: vec3<f32>,\naerialPerspectiveIntensity: f32,\ncameraGeocentricNormal: vec3<f32>,\nclampedCameraRadius: f32,\ncameraForward: vec3<f32>,\nclampedCameraHeight: f32,\ncameraPosition: vec3<f32>,\ncosCameraHorizonAngleFromZenith: f32,\nviewport: vec4<f32>,\nadditionalDiffuseSkyIrradiance: vec3<f32>,\ncameraHeight: f32,\ncameraNearPlane: f32,\noriginHeight: f32,\nsinCameraAtmosphereHorizonAngleFromNadir: f32,\ntransmittanceSampleCount: f32,\nskyViewLutSampleCount: f32,\nmultiScatteringLutSampleCount: f32,\nmultiScatteringAzimuthSampleCount: f32,\nmultiScatteringInclinationSampleCount: f32,\ndiffuseSkyIrradianceLutSampleCount: f32};var<uniform> atmosphere : Atmosphere;\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const atmosphereUboDeclarationWGSL = { name, shader };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"depthFunctions.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/depthFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,MAAM,GAAG;;;;;;;;;;CAUd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"depthFunctions\";\nconst shader = `fn reconstructDistanceFromCameraPlane(depth: f32,cameraNearPlane: f32)->f32 {return cameraNearPlane/(1.-depth);}\nfn sampleDistanceFromCameraPlane(depthTex: texture_2d<f32>,depthSampler: sampler,uv: vec2f,cameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCameraPlane(depth,cameraNearPlane),0.,depth>=1.);}\nfn reconstructDistanceFromCamera(depth: f32,cameraRayDirection: vec3f,cameraForward: vec3f,cameraNearPlane: f32)->f32 {let distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(.00001,dot(cameraForward,cameraRayDirection));}\nfn reconstructDistanceFromCameraWithTexture(\ndepthTex: texture_2d<f32>,\ndepthSampler: sampler,\nuv: vec2f,\ncameraRayDirection: vec3f,\ncameraForward: vec3f,\ncameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane),0.,depth>=1.);}\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const depthFunctionsWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"depthFunctions.js","sourceRoot":"","sources":["../../../../../../dev/addons/src/atmosphere/ShadersWGSL/ShadersInclude/depthFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,MAAM,GAAG;;;;;;;;;;CAUd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nconst name = \"depthFunctions\";\nconst shader = `fn reconstructDistanceFromCameraPlane(depth: f32,cameraNearPlane: f32)->f32 {return cameraNearPlane/(1.-depth);}\nfn sampleDistanceFromCameraPlane(depthTex: texture_2d<f32>,depthSampler: sampler,uv: vec2f,cameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCameraPlane(depth,cameraNearPlane),0.,depth>=1.);}\nfn reconstructDistanceFromCamera(depth: f32,cameraRayDirection: vec3f,cameraForward: vec3f,cameraNearPlane: f32)->f32 {let distanceFromCameraPlane=reconstructDistanceFromCameraPlane(depth,cameraNearPlane);return distanceFromCameraPlane/max(.00001,dot(cameraForward,cameraRayDirection));}\nfn reconstructDistanceFromCameraWithTexture(\ndepthTex: texture_2d<f32>,\ndepthSampler: sampler,\nuv: vec2f,\ncameraRayDirection: vec3f,\ncameraForward: vec3f,\ncameraNearPlane: f32)->f32 {let depth=textureSampleLevel(depthTex,depthSampler,uv,0.).r;return select(reconstructDistanceFromCamera(depth,cameraRayDirection,cameraForward,cameraNearPlane),0.,depth>=1.);}\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const depthFunctionsWGSL = { name, shader };\n"]}
@@ -1,6 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
4
1
  /** @internal */
5
2
  export declare const aerialPerspectivePixelShaderWGSL: {
6
3
  name: string;
@@ -1,8 +1,9 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
+ import { helperFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
+ import { intersectionFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/intersectionFunctions.js";
6
+ import { atmosphereFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
6
7
  const name = "aerialPerspectivePixelShader";
7
8
  const shader = `#define RENDER_CAMERA_VOLUME
8
9
  #include<atmosphereUboDeclaration>
@@ -21,6 +22,12 @@ multiScatteringLut
21
22
  if (!ShaderStore.ShadersStoreWGSL[name]) {
22
23
  ShaderStore.ShadersStoreWGSL[name] = shader;
23
24
  }
25
+ const includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];
26
+ for (const inc of includes) {
27
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
28
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
29
+ }
30
+ }
24
31
  /** @internal */
25
32
  export const aerialPerspectivePixelShaderWGSL = { name, shader };
26
33
  //# sourceMappingURL=aerialPerspective.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aerialPerspective.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/aerialPerspective.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAChE,OAAO,iDAAiD,CAAC;AACzD,OAAO,mDAAmD,CAAC;AAE3D,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAC5C,MAAM,MAAM,GAAG;;;;;;;;;;;;CAYd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"aerialPerspectivePixelShader\";\nconst shader = `#define RENDER_CAMERA_VOLUME\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying positionOnNearPlane: vec3f;uniform layerIdx: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderCameraVolume(\ninput.positionOnNearPlane,\nuniforms.layerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const aerialPerspectivePixelShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"aerialPerspective.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/aerialPerspective.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,MAAM,IAAI,GAAG,8BAA8B,CAAC;AAC5C,MAAM,MAAM,GAAG;;;;;;;;;;;;CAYd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AACzH,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { intersectionFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"aerialPerspectivePixelShader\";\nconst shader = `#define RENDER_CAMERA_VOLUME\n#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying positionOnNearPlane: vec3f;uniform layerIdx: f32;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=renderCameraVolume(\ninput.positionOnNearPlane,\nuniforms.layerIdx,\ntransmittanceLut,\nmultiScatteringLut\n);}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const aerialPerspectivePixelShaderWGSL = { name, shader };\n"]}
@@ -1,7 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
3
- import "../ShadersWGSL/ShadersInclude/depthFunctions.js";
4
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
5
1
  /** @internal */
6
2
  export declare const compositeAerialPerspectivePixelShaderWGSL: {
7
3
  name: string;
@@ -1,9 +1,10 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
- import "../ShadersWGSL/ShadersInclude/depthFunctions.js";
6
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
+ import { helperFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
+ import { depthFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/depthFunctions.js";
6
+ import { intersectionFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/intersectionFunctions.js";
7
+ import { atmosphereFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
7
8
  const name = "compositeAerialPerspectivePixelShader";
8
9
  const shader = `#include<atmosphereUboDeclaration>
9
10
  #if USE_AERIAL_PERSPECTIVE_LUT
@@ -67,6 +68,12 @@ fragmentOutputs.color=toGammaSpace(fragmentOutputs.color);
67
68
  if (!ShaderStore.ShadersStoreWGSL[name]) {
68
69
  ShaderStore.ShadersStoreWGSL[name] = shader;
69
70
  }
71
+ const includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, depthFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];
72
+ for (const inc of includes) {
73
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
74
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
75
+ }
76
+ }
70
77
  /** @internal */
71
78
  export const compositeAerialPerspectivePixelShaderWGSL = { name, shader };
72
79
  //# sourceMappingURL=compositeAerialPerspective.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compositeAerialPerspective.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAChE,OAAO,iDAAiD,CAAC;AACzD,OAAO,8CAA8C,CAAC;AACtD,OAAO,mDAAmD,CAAC;AAE3D,MAAM,IAAI,GAAG,uCAAuC,CAAC;AACrD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yCAAyC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/depthFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeAerialPerspectivePixelShader\";\nconst shader = `#include<atmosphereUboDeclaration>\n#if USE_AERIAL_PERSPECTIVE_LUT\nvar aerialPerspectiveLutSampler: sampler;var aerialPerspectiveLut: texture_2d_array<f32>;\n#endif\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;var transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;if (depth>=1.) {discard;}\nlet rayDirection=normalize(input.positionOnNearPlane);let distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;var aerialPerspective=vec4f(0.);if (sampleAerialPerspectiveLut(\ninput.vUV,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\n&aerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective=vec4f(aerialPerspective.rgb,0.);\n#endif\nfragmentOutputs.color=aerialPerspective;} else {var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {fragmentOutputs.color=vec4f(0.);return fragmentOutputs;}\nlet isAerialPerspectiveLut=atmosphere.clampedCameraRadius<atmosphere.atmosphereRadius;var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4f(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,0.);\n#endif\n}\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const compositeAerialPerspectivePixelShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"compositeAerialPerspective.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeAerialPerspective.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,MAAM,IAAI,GAAG,uCAAuC,CAAC;AACrD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAC7I,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,yCAAyC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { depthFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/depthFunctions\";\nimport { intersectionFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeAerialPerspectivePixelShader\";\nconst shader = `#include<atmosphereUboDeclaration>\n#if USE_AERIAL_PERSPECTIVE_LUT\nvar aerialPerspectiveLutSampler: sampler;var aerialPerspectiveLut: texture_2d_array<f32>;\n#endif\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;var transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;if (depth>=1.) {discard;}\nlet rayDirection=normalize(input.positionOnNearPlane);let distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;var aerialPerspective=vec4f(0.);if (sampleAerialPerspectiveLut(\ninput.vUV,\nfalse,\ndistanceToSurface,\nNumAerialPerspectiveLutLayers,\nAerialPerspectiveLutKMPerSlice,\nAerialPerspectiveLutRangeKM,\n&aerialPerspective)) {\n#ifndef APPLY_TRANSMITTANCE_BLENDING\naerialPerspective=vec4f(aerialPerspective.rgb,0.);\n#endif\nfragmentOutputs.color=aerialPerspective;} else {var intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {fragmentOutputs.color=vec4f(0.);return fragmentOutputs;}\nlet isAerialPerspectiveLut=atmosphere.clampedCameraRadius<atmosphere.atmosphereRadius;var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nisAerialPerspectiveLut,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(vec4f(radiance,transparency))));\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,0.);\n#endif\n}\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, depthFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const compositeAerialPerspectivePixelShaderWGSL = { name, shader };\n"]}
@@ -1,7 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
3
- import "../ShadersWGSL/ShadersInclude/depthFunctions.js";
4
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
5
1
  /** @internal */
6
2
  export declare const compositeGlobeAtmospherePixelShaderWGSL: {
7
3
  name: string;
@@ -1,9 +1,10 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
- import "../ShadersWGSL/ShadersInclude/depthFunctions.js";
6
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
+ import { helperFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
+ import { depthFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/depthFunctions.js";
6
+ import { intersectionFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/intersectionFunctions.js";
7
+ import { atmosphereFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
7
8
  const name = "compositeGlobeAtmospherePixelShader";
8
9
  const shader = `#define SAMPLE_SKY_VIEW_LUT
9
10
  #if USE_SKY_VIEW_LUT
@@ -92,6 +93,12 @@ fragmentOutputs.color=toGammaSpace(fragmentOutputs.color);
92
93
  if (!ShaderStore.ShadersStoreWGSL[name]) {
93
94
  ShaderStore.ShadersStoreWGSL[name] = shader;
94
95
  }
96
+ const includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, depthFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];
97
+ for (const inc of includes) {
98
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
99
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
100
+ }
101
+ }
95
102
  /** @internal */
96
103
  export const compositeGlobeAtmospherePixelShaderWGSL = { name, shader };
97
104
  //# sourceMappingURL=compositeGlobeAtmosphere.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compositeGlobeAtmosphere.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAChE,OAAO,iDAAiD,CAAC;AACzD,OAAO,8CAA8C,CAAC;AACtD,OAAO,mDAAmD,CAAC;AAE3D,MAAM,IAAI,GAAG,qCAAqC,CAAC;AACnD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uCAAuC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/depthFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeGlobeAtmospherePixelShader\";\nconst shader = `#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if HAS_DEPTH_TEXTURE\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;\n#endif\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);\n#if HAS_DEPTH_TEXTURE\nlet depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;\n#endif\nlet rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);fragmentOutputs.color=skyColor;if (isRayIntersectingGround) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\n#if HAS_DEPTH_TEXTURE\nlet distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;\n#else\nlet distanceToSurface=0.;\n#endif\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color=vec4f(radiance,transparency);if (distanceToSurface>0.) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const compositeGlobeAtmospherePixelShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"compositeGlobeAtmosphere.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeGlobeAtmosphere.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,MAAM,IAAI,GAAG,qCAAqC,CAAC;AACnD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAC7I,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,uCAAuC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { depthFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/depthFunctions\";\nimport { intersectionFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeGlobeAtmospherePixelShader\";\nconst shader = `#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if HAS_DEPTH_TEXTURE\nvar depthTextureSampler: sampler;var depthTexture: texture_2d<f32>;\n#endif\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<depthFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);\n#if HAS_DEPTH_TEXTURE\nlet depth=textureSampleLevel(depthTexture,depthTextureSampler,input.vUV,0.).r;\n#endif\nlet rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);fragmentOutputs.color=skyColor;if (isRayIntersectingGround) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\n#if HAS_DEPTH_TEXTURE\nlet distanceFromCamera =\nreconstructDistanceFromCamera(\ndepth,\nrayDirection,\natmosphere.cameraForward,\natmosphere.cameraNearPlane);let distanceToSurface=distanceFromCamera/1000.;\n#else\nlet distanceToSurface=0.;\n#endif\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\ndistanceToSurface,\n&transmittance);let transparency=1.-avg(transmittance);fragmentOutputs.color=vec4f(radiance,transparency);if (distanceToSurface>0.) {fragmentOutputs.color =\napplyAerialPerspectiveRadianceBias(\napplyAerialPerspectiveIntensity(\napplyAerialPerspectiveSaturation(fragmentOutputs.color)));\n#if HAS_DEPTH_TEXTURE\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,depth>=1.));\n#endif\n}\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, depthFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const compositeGlobeAtmospherePixelShaderWGSL = { name, shader };\n"]}
@@ -1,6 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
4
1
  /** @internal */
5
2
  export declare const compositeSkyPixelShaderWGSL: {
6
3
  name: string;
@@ -1,8 +1,9 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
+ import { helperFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
+ import { intersectionFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/intersectionFunctions.js";
6
+ import { atmosphereFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
6
7
  const name = "compositeSkyPixelShader";
7
8
  const shader = `#define SAMPLE_SKY_VIEW_LUT
8
9
  #if USE_SKY_VIEW_LUT
@@ -69,6 +70,12 @@ fragmentOutputs.color=toGammaSpace(fragmentOutputs.color);
69
70
  if (!ShaderStore.ShadersStoreWGSL[name]) {
70
71
  ShaderStore.ShadersStoreWGSL[name] = shader;
71
72
  }
73
+ const includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];
74
+ for (const inc of includes) {
75
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
76
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
77
+ }
78
+ }
72
79
  /** @internal */
73
80
  export const compositeSkyPixelShaderWGSL = { name, shader };
74
81
  //# sourceMappingURL=compositeSky.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compositeSky.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeSky.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAChE,OAAO,iDAAiD,CAAC;AACzD,OAAO,mDAAmD,CAAC;AAE3D,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Dd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeSkyPixelShader\";\nconst shader = `#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor=vec4f(skyColor.rgb,0.);\n#endif\nfragmentOutputs.color=skyColor;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,isRayIntersectingGround));\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nlet transparency=1.-avg(transmittance);\n#else\nlet transparency=0.;\n#endif\nfragmentOutputs.color=vec4f(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const compositeSkyPixelShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"compositeSky.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/compositeSky.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Dd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AACzH,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { intersectionFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\n\nconst name = \"compositeSkyPixelShader\";\nconst shader = `#define SAMPLE_SKY_VIEW_LUT\n#if USE_SKY_VIEW_LUT\n#define EXCLUDE_RAY_MARCHING_FUNCTIONS\n#endif\n#include<atmosphereUboDeclaration>\n#if USE_SKY_VIEW_LUT\nvar skyViewLutSampler: sampler;var skyViewLut: texture_2d<f32>;\n#else\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#endif\n#include<helperFunctions>\n#include<atmosphereFunctions>\nvarying vUV: vec2f;varying positionOnNearPlane: vec3f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);let rayDirection=normalize(input.positionOnNearPlane);\n#if USE_SKY_VIEW_LUT\nvar cosAngleBetweenViewAndZenith: f32;var isRayIntersectingGround: bool;var skyColor=sampleSkyViewLut(\nskyViewLut,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\natmosphere.directionToLight,\natmosphere.cosCameraHorizonAngleFromZenith,\n&cosAngleBetweenViewAndZenith,\n&isRayIntersectingGround);\n#ifndef APPLY_TRANSMITTANCE_BLENDING\nskyColor=vec4f(skyColor.rgb,0.);\n#endif\nfragmentOutputs.color=skyColor;fragmentOutputs.color=vec4f(fragmentOutputs.color.rgb,select(fragmentOutputs.color.a,1.,isRayIntersectingGround));\n#else\nvar intersectsAtmosphere=false;var cameraPositionGlobalClampedToTopOfAtmosphere=vec3f(0.);moveToTopAtmosphere(\natmosphere.clampedCameraPositionGlobal,\natmosphere.clampedCameraRadius,\natmosphere.cameraGeocentricNormal,\nrayDirection,\n&intersectsAtmosphere,\n&cameraPositionGlobalClampedToTopOfAtmosphere);if (!intersectsAtmosphere) {return fragmentOutputs;}\nvar transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\natmosphere.atmosphereExposure*atmosphere.lightIntensity,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\ncameraPositionGlobalClampedToTopOfAtmosphere,\nrayDirection,\natmosphere.directionToLight,\n100000000.,\natmosphere.skyViewLutSampleCount,\n-1.,\n&transmittance);\n#if APPLY_TRANSMITTANCE_BLENDING\nlet transparency=1.-avg(transmittance);\n#else\nlet transparency=0.;\n#endif\nfragmentOutputs.color=vec4f(radiance,transparency);\n#endif\n#if OUTPUT_TO_SRGB\nfragmentOutputs.color=toGammaSpace(fragmentOutputs.color);\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const compositeSkyPixelShaderWGSL = { name, shader };\n"]}
@@ -1,9 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/importanceSampling.js";
5
- import "@onerjs/core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js";
6
- import "@onerjs/core/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js";
7
1
  /** @internal */
8
2
  export declare const diffuseSkyIrradiancePixelShaderWGSL: {
9
3
  name: string;
@@ -1,11 +1,12 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
- import "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
- import "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
6
- import "@onerjs/core/ShadersWGSL/ShadersInclude/importanceSampling.js";
7
- import "@onerjs/core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js";
8
- import "@onerjs/core/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
+ import { helperFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/helperFunctions.js";
5
+ import { intersectionFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/intersectionFunctions.js";
6
+ import { atmosphereFunctionsWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereFunctions.js";
7
+ import { importanceSamplingWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/importanceSampling.js";
8
+ import { pbrBRDFFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js";
9
+ import { hdrFilteringFunctionsWGSL } from "@onerjs/core/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js";
9
10
  const name = "diffuseSkyIrradiancePixelShader";
10
11
  const shader = `#include<atmosphereUboDeclaration>
11
12
  var transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;
@@ -40,6 +41,12 @@ vec3f(1.));let averageIrradiance=getLuminanceUnclamped(irradianceResult);let new
40
41
  if (!ShaderStore.ShadersStoreWGSL[name]) {
41
42
  ShaderStore.ShadersStoreWGSL[name] = shader;
42
43
  }
44
+ const includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL, importanceSamplingWGSL, pbrBRDFFunctionsWGSL, hdrFilteringFunctionsWGSL];
45
+ for (const inc of includes) {
46
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
47
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
48
+ }
49
+ }
43
50
  /** @internal */
44
51
  export const diffuseSkyIrradiancePixelShaderWGSL = { name, shader };
45
52
  //# sourceMappingURL=diffuseSkyIrradiance.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diffuseSkyIrradiance.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAChE,OAAO,iDAAiD,CAAC;AACzD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,uDAAuD,CAAC;AAE/D,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\nimport \"core/ShadersWGSL/ShadersInclude/importanceSampling\";\nimport \"core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions\";\nimport \"core/ShadersWGSL/ShadersInclude/hdrFilteringFunctions\";\n\nconst name = \"diffuseSkyIrradiancePixelShader\";\nconst shader = `#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nfn integrateForIrradiance(directionToLightParam: vec3f,rayDirection: vec3f,rayOrigin: vec3f)->vec3f {var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLightParam.xzy,\n100000000.,\natmosphere.diffuseSkyIrradianceLutSampleCount,\n-1.,\n&transmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let unit=uvToUnit(input.vUV,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);let cosLightInclination=2.*unit.x-1.;let sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);let directionToLight=normalize(vec3f(0.,cosLightInclination,sinLightInclination));let radius=max(atmosphere.planetRadiusWithOffset,unit.y*atmosphere.atmosphereThickness+atmosphere.planetRadius);let swappedDirectionToLight=vec3f(directionToLight.x,directionToLight.z,directionToLight.y); \nvar irradianceResult=PI*irradiance(\nswappedDirectionToLight,\nvec2f(radius,0.),\n1.,\nvec3f(1.),\nvec3f(1.));let averageIrradiance=getLuminanceUnclamped(irradianceResult);let newIrradiance=mix(irradianceResult,vec3f(averageIrradiance),atmosphere.diffuseSkyIrradianceDesaturationFactor);let newIrradianceScale=getLuminanceUnclamped(newIrradiance);let rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradianceResult=newIrradiance*rescaling;fragmentOutputs.color=vec4f(irradianceResult,1.);}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const diffuseSkyIrradiancePixelShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"diffuseSkyIrradiance.fragment.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/diffuseSkyIrradiance.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAElG,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;AAClM,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { intersectionFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/intersectionFunctions\";\nimport { atmosphereFunctionsWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereFunctions\";\nimport { importanceSamplingWGSL } from \"core/ShadersWGSL/ShadersInclude/importanceSampling\";\nimport { pbrBRDFFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions\";\nimport { hdrFilteringFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/hdrFilteringFunctions\";\n\nconst name = \"diffuseSkyIrradiancePixelShader\";\nconst shader = `#include<atmosphereUboDeclaration>\nvar transmittanceLutSampler: sampler;var transmittanceLut: texture_2d<f32>;var multiScatteringLutSampler: sampler;var multiScatteringLut: texture_2d<f32>;\n#include<helperFunctions>\n#include<atmosphereFunctions>\nfn integrateForIrradiance(directionToLightParam: vec3f,rayDirection: vec3f,rayOrigin: vec3f)->vec3f {var transmittance: vec3f;let radiance=integrateScatteredRadiance(\nfalse,\n1.,\ntransmittanceLut,\nmultiScatteringLut,\natmosphere.multiScatteringIntensity,\nrayOrigin,\nrayDirection.xzy,\ndirectionToLightParam.xzy,\n100000000.,\natmosphere.diffuseSkyIrradianceLutSampleCount,\n-1.,\n&transmittance);return radiance;}\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nvarying vUV: vec2f;@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let unit=uvToUnit(input.vUV,DiffuseSkyIrradianceLutDomainInUVSpace,DiffuseSkyIrradianceLutHalfTexelSize);let cosLightInclination=2.*unit.x-1.;let sinLightInclination=sqrtClamped(1.-cosLightInclination*cosLightInclination);let directionToLight=normalize(vec3f(0.,cosLightInclination,sinLightInclination));let radius=max(atmosphere.planetRadiusWithOffset,unit.y*atmosphere.atmosphereThickness+atmosphere.planetRadius);let swappedDirectionToLight=vec3f(directionToLight.x,directionToLight.z,directionToLight.y); \nvar irradianceResult=PI*irradiance(\nswappedDirectionToLight,\nvec2f(radius,0.),\n1.,\nvec3f(1.),\nvec3f(1.));let averageIrradiance=getLuminanceUnclamped(irradianceResult);let newIrradiance=mix(irradianceResult,vec3f(averageIrradiance),atmosphere.diffuseSkyIrradianceDesaturationFactor);let newIrradianceScale=getLuminanceUnclamped(newIrradiance);let rescaling=averageIrradiance/max(0.000001,newIrradianceScale);irradianceResult=newIrradiance*rescaling;fragmentOutputs.color=vec4f(irradianceResult,1.);}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL, helperFunctionsWGSL, intersectionFunctionsWGSL, atmosphereFunctionsWGSL, importanceSamplingWGSL, pbrBRDFFunctionsWGSL, hdrFilteringFunctionsWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const diffuseSkyIrradiancePixelShaderWGSL = { name, shader };\n"]}
@@ -1,4 +1,3 @@
1
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
2
1
  /** @internal */
3
2
  export declare const fullscreenTriangleVertexShaderWGSL: {
4
3
  name: string;
@@ -1,6 +1,6 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@onerjs/core/Engines/shaderStore.js";
3
- import "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
3
+ import { atmosphereUboDeclarationWGSL } from "../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration.js";
4
4
  const name = "fullscreenTriangleVertexShader";
5
5
  const shader = `#include<atmosphereUboDeclaration>
6
6
  #if POSITION_VEC2
@@ -26,6 +26,12 @@ vertexOutputs.positionOnNearPlane=(atmosphere.inverseViewProjectionWithoutTransl
26
26
  if (!ShaderStore.ShadersStoreWGSL[name]) {
27
27
  ShaderStore.ShadersStoreWGSL[name] = shader;
28
28
  }
29
+ const includes = [atmosphereUboDeclarationWGSL];
30
+ for (const inc of includes) {
31
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
32
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
33
+ }
34
+ }
29
35
  /** @internal */
30
36
  export const fullscreenTriangleVertexShaderWGSL = { name, shader };
31
37
  //# sourceMappingURL=fullscreenTriangle.vertex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fullscreenTriangle.vertex.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,wDAAwD,CAAC;AAEhE,MAAM,IAAI,GAAG,gCAAgC,CAAC;AAC9C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\n\nconst name = \"fullscreenTriangleVertexShader\";\nconst shader = `#include<atmosphereUboDeclaration>\n#if POSITION_VEC2\nattribute position: vec2f;\n#else\nattribute position: vec3f;\n#endif\nuniform depth: f32;varying vUV: vec2f;\n#if COMPUTE_WORLD_RAY\nvarying positionOnNearPlane: vec3f;\n#endif\n#if COMPUTE_WORLD_RAY\nconst nearPlaneNDC: f32=-1.0;\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {vertexOutputs.position=vec4f(input.position.xy,uniforms.depth,1.0);vertexOutputs.vUV=input.position.xy*vec2f(0.5,0.5)+vec2f(0.5,0.5);\n#if COMPUTE_WORLD_RAY\nvertexOutputs.positionOnNearPlane=(atmosphere.inverseViewProjectionWithoutTranslation*vec4f(input.position.xy,nearPlaneNDC,1.0)).xyz;\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const fullscreenTriangleVertexShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"fullscreenTriangle.vertex.js","sourceRoot":"","sources":["../../../../../dev/addons/src/atmosphere/ShadersWGSL/fullscreenTriangle.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAEtG,MAAM,IAAI,GAAG,gCAAgC,CAAC;AAC9C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAChD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { atmosphereUboDeclarationWGSL } from \"../ShadersWGSL/ShadersInclude/atmosphereUboDeclaration\";\n\nconst name = \"fullscreenTriangleVertexShader\";\nconst shader = `#include<atmosphereUboDeclaration>\n#if POSITION_VEC2\nattribute position: vec2f;\n#else\nattribute position: vec3f;\n#endif\nuniform depth: f32;varying vUV: vec2f;\n#if COMPUTE_WORLD_RAY\nvarying positionOnNearPlane: vec3f;\n#endif\n#if COMPUTE_WORLD_RAY\nconst nearPlaneNDC: f32=-1.0;\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {vertexOutputs.position=vec4f(input.position.xy,uniforms.depth,1.0);vertexOutputs.vUV=input.position.xy*vec2f(0.5,0.5)+vec2f(0.5,0.5);\n#if COMPUTE_WORLD_RAY\nvertexOutputs.positionOnNearPlane=(atmosphere.inverseViewProjectionWithoutTranslation*vec4f(input.position.xy,nearPlaneNDC,1.0)).xyz;\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [atmosphereUboDeclarationWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const fullscreenTriangleVertexShaderWGSL = { name, shader };\n"]}