@react-three/postprocessing 2.16.5 → 2.16.7

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.
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const THREE = require("three");
4
+ function _interopNamespaceDefault(e) {
5
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
6
+ if (e) {
7
+ for (const k in e) {
8
+ if (k !== "default") {
9
+ const d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: () => e[k]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ n.default = e;
18
+ return Object.freeze(n);
19
+ }
20
+ const THREE__namespace = /* @__PURE__ */ _interopNamespaceDefault(THREE);
21
+ const version = /* @__PURE__ */ (() => parseInt(THREE__namespace.REVISION.replace(/\D+/g, "")))();
22
+ const WebGLMultipleRenderTargets = version >= 162 ? class extends THREE__namespace.WebGLRenderTarget {
23
+ constructor(width = 1, height = 1, count = 1, options = {}) {
24
+ super(width, height, { ...options, count });
25
+ this.isWebGLMultipleRenderTargets = true;
26
+ }
27
+ get texture() {
28
+ return this.textures;
29
+ }
30
+ } : class extends THREE__namespace.WebGLRenderTarget {
31
+ constructor(width = 1, height = 1, count = 1, options = {}) {
32
+ super(width, height, options);
33
+ this.isWebGLMultipleRenderTargets = true;
34
+ const texture = this.texture;
35
+ this.texture = [];
36
+ for (let i = 0; i < count; i++) {
37
+ this.texture[i] = texture.clone();
38
+ this.texture[i].isRenderTargetTexture = true;
39
+ }
40
+ }
41
+ setSize(width, height, depth = 1) {
42
+ if (this.width !== width || this.height !== height || this.depth !== depth) {
43
+ this.width = width;
44
+ this.height = height;
45
+ this.depth = depth;
46
+ for (let i = 0, il = this.texture.length; i < il; i++) {
47
+ this.texture[i].image.width = width;
48
+ this.texture[i].image.height = height;
49
+ this.texture[i].image.depth = depth;
50
+ }
51
+ this.dispose();
52
+ }
53
+ this.viewport.set(0, 0, width, height);
54
+ this.scissor.set(0, 0, width, height);
55
+ }
56
+ copy(source) {
57
+ this.dispose();
58
+ this.width = source.width;
59
+ this.height = source.height;
60
+ this.depth = source.depth;
61
+ this.scissor.copy(source.scissor);
62
+ this.scissorTest = source.scissorTest;
63
+ this.viewport.copy(source.viewport);
64
+ this.depthBuffer = source.depthBuffer;
65
+ this.stencilBuffer = source.stencilBuffer;
66
+ if (source.depthTexture !== null)
67
+ this.depthTexture = source.depthTexture.clone();
68
+ this.texture.length = 0;
69
+ for (let i = 0, il = source.texture.length; i < il; i++) {
70
+ this.texture[i] = source.texture[i].clone();
71
+ this.texture[i].isRenderTargetTexture = true;
72
+ }
73
+ return this;
74
+ }
75
+ };
76
+ exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
77
+ //# sourceMappingURL=compat.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.cjs","sources":["../src/compat.js"],"sourcesContent":["import * as THREE from 'three'\n\nconst version = /* @__PURE__ */ (() => parseInt(THREE.REVISION.replace(/\\D+/g, '')))()\n\n// NOTE: WebGLMultipleRenderTargets is removed since r172, so we implement it ourselves.\n// https://github.com/mrdoob/three.js/pull/26427\nexport const WebGLMultipleRenderTargets =\n version >= 162\n ? class extends THREE.WebGLRenderTarget {\n constructor(width = 1, height = 1, count = 1, options = {}) {\n super(width, height, { ...options, count })\n\n this.isWebGLMultipleRenderTargets = true\n }\n\n get texture() {\n return this.textures\n }\n }\n : class extends THREE.WebGLRenderTarget {\n constructor(width = 1, height = 1, count = 1, options = {}) {\n super(width, height, options)\n\n this.isWebGLMultipleRenderTargets = true\n\n const texture = this.texture\n\n this.texture = []\n\n for (let i = 0; i < count; i++) {\n this.texture[i] = texture.clone()\n this.texture[i].isRenderTargetTexture = true\n }\n }\n\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width\n this.height = height\n this.depth = depth\n\n for (let i = 0, il = this.texture.length; i < il; i++) {\n this.texture[i].image.width = width\n this.texture[i].image.height = height\n this.texture[i].image.depth = depth\n }\n\n this.dispose()\n }\n\n this.viewport.set(0, 0, width, height)\n this.scissor.set(0, 0, width, height)\n }\n\n copy(source) {\n this.dispose()\n\n this.width = source.width\n this.height = source.height\n this.depth = source.depth\n\n this.scissor.copy(source.scissor)\n this.scissorTest = source.scissorTest\n\n this.viewport.copy(source.viewport)\n\n this.depthBuffer = source.depthBuffer\n this.stencilBuffer = source.stencilBuffer\n\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone()\n\n this.texture.length = 0\n\n for (let i = 0, il = source.texture.length; i < il; i++) {\n this.texture[i] = source.texture[i].clone()\n this.texture[i].isRenderTargetTexture = true\n }\n\n return this\n }\n }\n"],"names":["THREE"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAA2B,uBAAM,SAASA,iBAAM,SAAS,QAAQ,QAAQ,EAAE,CAAC,GAAI;AAI1E,MAAC,6BACX,WAAW,MACP,cAAcA,iBAAM,kBAAkB;AAAA,EACpC,YAAY,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,IAAI;AAC1D,UAAM,OAAO,QAAQ,EAAE,GAAG,SAAS,MAAK,CAAE;AAE1C,SAAK,+BAA+B;AAAA,EACrC;AAAA,EAED,IAAI,UAAU;AACZ,WAAO,KAAK;AAAA,EACb;AACF,IACD,cAAcA,iBAAM,kBAAkB;AAAA,EACpC,YAAY,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,IAAI;AAC1D,UAAM,OAAO,QAAQ,OAAO;AAE5B,SAAK,+BAA+B;AAEpC,UAAM,UAAU,KAAK;AAErB,SAAK,UAAU,CAAE;AAEjB,aAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,WAAK,QAAQ,CAAC,IAAI,QAAQ,MAAO;AACjC,WAAK,QAAQ,CAAC,EAAE,wBAAwB;AAAA,IACz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MultipleRenderTargets = version >= 162 ? class extends THREE.WebGLRenderTarget {
4
+ constructor(width = 1, height = 1, count = 1, options = {}) {
5
+ super(width, height, { ...options, count });
6
+ this.isWebGLMultipleRenderTargets = true;
7
+ }
8
+ get texture() {
9
+ return this.textures;
10
+ }
11
+ } : class extends THREE.WebGLRenderTarget {
12
+ constructor(width = 1, height = 1, count = 1, options = {}) {
13
+ super(width, height, options);
14
+ this.isWebGLMultipleRenderTargets = true;
15
+ const texture = this.texture;
16
+ this.texture = [];
17
+ for (let i = 0; i < count; i++) {
18
+ this.texture[i] = texture.clone();
19
+ this.texture[i].isRenderTargetTexture = true;
20
+ }
21
+ }
22
+ setSize(width, height, depth = 1) {
23
+ if (this.width !== width || this.height !== height || this.depth !== depth) {
24
+ this.width = width;
25
+ this.height = height;
26
+ this.depth = depth;
27
+ for (let i = 0, il = this.texture.length; i < il; i++) {
28
+ this.texture[i].image.width = width;
29
+ this.texture[i].image.height = height;
30
+ this.texture[i].image.depth = depth;
31
+ }
32
+ this.dispose();
33
+ }
34
+ this.viewport.set(0, 0, width, height);
35
+ this.scissor.set(0, 0, width, height);
36
+ }
37
+ copy(source) {
38
+ this.dispose();
39
+ this.width = source.width;
40
+ this.height = source.height;
41
+ this.depth = source.depth;
42
+ this.scissor.copy(source.scissor);
43
+ this.scissorTest = source.scissorTest;
44
+ this.viewport.copy(source.viewport);
45
+ this.depthBuffer = source.depthBuffer;
46
+ this.stencilBuffer = source.stencilBuffer;
47
+ if (source.depthTexture !== null)
48
+ this.depthTexture = source.depthTexture.clone();
49
+ this.texture.length = 0;
50
+ for (let i = 0, il = source.texture.length; i < il; i++) {
51
+ this.texture[i] = source.texture[i].clone();
52
+ this.texture[i].isRenderTargetTexture = true;
53
+ }
54
+ return this;
55
+ }
56
+ };
57
+ export {
58
+ WebGLMultipleRenderTargets
59
+ };
60
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sources":["../src/compat.js"],"sourcesContent":["import * as THREE from 'three'\n\nconst version = /* @__PURE__ */ (() => parseInt(THREE.REVISION.replace(/\\D+/g, '')))()\n\n// NOTE: WebGLMultipleRenderTargets is removed since r172, so we implement it ourselves.\n// https://github.com/mrdoob/three.js/pull/26427\nexport const WebGLMultipleRenderTargets =\n version >= 162\n ? class extends THREE.WebGLRenderTarget {\n constructor(width = 1, height = 1, count = 1, options = {}) {\n super(width, height, { ...options, count })\n\n this.isWebGLMultipleRenderTargets = true\n }\n\n get texture() {\n return this.textures\n }\n }\n : class extends THREE.WebGLRenderTarget {\n constructor(width = 1, height = 1, count = 1, options = {}) {\n super(width, height, options)\n\n this.isWebGLMultipleRenderTargets = true\n\n const texture = this.texture\n\n this.texture = []\n\n for (let i = 0; i < count; i++) {\n this.texture[i] = texture.clone()\n this.texture[i].isRenderTargetTexture = true\n }\n }\n\n setSize(width, height, depth = 1) {\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width\n this.height = height\n this.depth = depth\n\n for (let i = 0, il = this.texture.length; i < il; i++) {\n this.texture[i].image.width = width\n this.texture[i].image.height = height\n this.texture[i].image.depth = depth\n }\n\n this.dispose()\n }\n\n this.viewport.set(0, 0, width, height)\n this.scissor.set(0, 0, width, height)\n }\n\n copy(source) {\n this.dispose()\n\n this.width = source.width\n this.height = source.height\n this.depth = source.depth\n\n this.scissor.copy(source.scissor)\n this.scissorTest = source.scissorTest\n\n this.viewport.copy(source.viewport)\n\n this.depthBuffer = source.depthBuffer\n this.stencilBuffer = source.stencilBuffer\n\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone()\n\n this.texture.length = 0\n\n for (let i = 0, il = source.texture.length; i < il; i++) {\n this.texture[i] = source.texture[i].clone()\n this.texture[i].isRenderTargetTexture = true\n }\n\n return this\n }\n }\n"],"names":[],"mappings":";AAEA,MAAM,UAA2B,uBAAM,SAAS,MAAM,SAAS,QAAQ,QAAQ,EAAE,CAAC,GAAI;AAI1E,MAAC,6BACX,WAAW,MACP,cAA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Q,KAAK,OAAO,OAAO;AAChC,SAAK,cAAc,OAAO;AAE1B,SAAK,SAAS,KAAK,OAAO,QAAQ;AAElC,SAAK,cAAc,OAAO;AAC1B,SAAK,gBAAgB,OAAO;AAE5B,QAAI,OAAO,iBAAiB;AAAM,WAAK,eAAe,OAAO,aAAa,MAAO;AAEjF,SAAK,QAAQ,SAAS;AAEtB,aAAS,IAAI,GAAG,KAAK,OAAO,QAAQ,QAAQ,IAAI,IAAI,KAAK;AACvD,WAAK,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,EAAE,MAAO;AAC3C,WAAK,QAAQ,CAAC,EAAE,wBAAwB;AAAA,IACzC;AAED,WAAO;AAAA,EACR;AACT;"}
@@ -9,6 +9,7 @@ const EffectCompositer = require("./EffectCompositer.cjs");
9
9
  const PoissionBlur = require("./PoissionBlur.cjs");
10
10
  const DepthDownSample = require("./DepthDownSample.cjs");
11
11
  const BlueNoise = require("./BlueNoise.cjs");
12
+ const compat = require("../../compat.cjs");
12
13
  function _interopNamespaceDefault(e) {
13
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
15
  if (e) {
@@ -172,7 +173,7 @@ class N8AOPostPass extends postprocessing.Pass {
172
173
  format: THREE.RedFormat,
173
174
  type: THREE.FloatType
174
175
  });*/
175
- new THREE__namespace.WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2);
176
+ new compat.WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2);
176
177
  this.depthDownsampleTarget.texture[0].format = THREE__namespace.RedFormat;
177
178
  this.depthDownsampleTarget.texture[0].type = THREE__namespace.FloatType;
178
179
  this.depthDownsampleTarget.texture[0].minFilter = THREE__namespace.NearestFilter;
@@ -1 +1 @@
1
- {"version":3,"file":"N8AOPostPass.cjs","sources":["../../../src/effects/N8AO/N8AOPostPass.js"],"sourcesContent":["import * as THREE from 'three'\nimport { Pass } from 'postprocessing'\nimport { Buffer } from 'buffer'\nimport { FullScreenTriangle } from './FullScreenTriangle'\nimport { EffectShader } from './EffectShader'\nimport { EffectCompositer } from './EffectCompositer'\nimport { PoissionBlur } from './PoissionBlur'\nimport { DepthDownSample } from './DepthDownSample'\nimport BlueNoise from './BlueNoise'\n\nconst bluenoiseBits = Buffer.from(BlueNoise, 'base64')\n\n/**\n *\n * @param {*} timerQuery\n * @param {THREE.WebGLRenderer} gl\n * @param {N8AOPass} pass\n */\nfunction checkTimerQuery(timerQuery, gl, pass) {\n const available = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT_AVAILABLE)\n if (available) {\n const elapsedTimeInNs = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT)\n const elapsedTimeInMs = elapsedTimeInNs / 1000000\n pass.lastTime = elapsedTimeInMs\n } else {\n // If the result is not available yet, check again after a delay\n setTimeout(() => {\n checkTimerQuery(timerQuery, gl, pass)\n }, 1)\n }\n}\nclass N8AOPostPass extends Pass {\n /**\n *\n * @param {THREE.Scene} scene\n * @param {THREE.Camera} camera\n * @param {number} width\n * @param {number} height\n *\n * @property {THREE.Scene} scene\n * @property {THREE.Camera} camera\n * @property {number} width\n * @property {number} height\n */\n constructor(scene, camera, width = 512, height = 512) {\n super()\n this.width = width\n this.height = height\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n /**\n * @type {Proxy & {\n * aoSamples: number,\n * aoRadius: number,\n * denoiseSamples: number,\n * denoiseRadius: number,\n * distanceFalloff: number,\n * intensity: number,\n * denoiseIterations: number,\n * renderMode: 0 | 1 | 2 | 3 | 4,\n * color: THREE.Color,\n * gammaCorrection: boolean,\n * logarithmicDepthBuffer: boolean\n * screenSpaceRadius: boolean,\n * halfRes: boolean,\n * depthAwareUpsampling: boolean\n * colorMultiply: boolean\n * }\n */\n this.autosetGamma = true\n this.configuration = new Proxy(\n {\n aoSamples: 16,\n aoRadius: 5.0,\n denoiseSamples: 8,\n denoiseRadius: 12,\n distanceFalloff: 1.0,\n intensity: 5,\n denoiseIterations: 2.0,\n renderMode: 0,\n color: new THREE.Color(0, 0, 0),\n gammaCorrection: true,\n logarithmicDepthBuffer: false,\n screenSpaceRadius: false,\n halfRes: false,\n depthAwareUpsampling: true,\n colorMultiply: true,\n },\n {\n set: (target, propName, value) => {\n const oldProp = target[propName]\n target[propName] = value\n if (propName === 'aoSamples' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'denoiseSamples' && oldProp !== value) {\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'halfRes' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureHalfResTargets()\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.setSize(this.width, this.height)\n }\n if (propName === 'depthAwareUpsampling' && oldProp !== value) {\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'gammaCorrection') {\n this.autosetGamma = false\n }\n return true\n },\n }\n )\n /** @type {THREE.Vector3[]} */\n this.samples = []\n /** @type {number[]} */\n this.samplesR = []\n /** @type {THREE.Vector2[]} */\n this.samplesDenoise = []\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.configureSampleDependentPasses()\n this.configureHalfResTargets()\n // this.effectCompisterQuad = new FullScreenTriangle(new THREE.ShaderMaterial(EffectCompositer));\n this.copyQuad = new FullScreenTriangle(\n new THREE.ShaderMaterial({\n uniforms: {\n tDiffuse: {\n value: null,\n },\n },\n depthWrite: false,\n vertexShader: `\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }\n `,\n fragmentShader: `\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n gl_FragColor = texture2D(tDiffuse, vUv);\n }\n `,\n })\n )\n this.writeTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.readTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.outputTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n\n /** @type {THREE.DataTexture} */\n this.bluenoise = //bluenoise;\n new THREE.DataTexture(bluenoiseBits, 128, 128)\n this.bluenoise.colorSpace = THREE.NoColorSpace\n this.bluenoise.wrapS = THREE.RepeatWrapping\n this.bluenoise.wrapT = THREE.RepeatWrapping\n this.bluenoise.minFilter = THREE.NearestFilter\n this.bluenoise.magFilter = THREE.NearestFilter\n this.bluenoise.needsUpdate = true\n this.lastTime = 0\n this.needsDepthTexture = true\n this.needsSwap = true\n this._r = new THREE.Vector2()\n this._c = new THREE.Color()\n }\n configureHalfResTargets() {\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget =\n /*new THREE.WebGLRenderTarget(this.width / 2, this.height / 2, {\n minFilter: THREE.NearestFilter,\n magFilter: THREE.NearestFilter,\n depthBuffer: false,\n format: THREE.RedFormat,\n type: THREE.FloatType\n });*/\n new THREE.WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2)\n this.depthDownsampleTarget.texture[0].format = THREE.RedFormat\n this.depthDownsampleTarget.texture[0].type = THREE.FloatType\n this.depthDownsampleTarget.texture[0].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].depthBuffer = false\n this.depthDownsampleTarget.texture[1].format = THREE.RGBAFormat\n this.depthDownsampleTarget.texture[1].type = THREE.HalfFloatType\n this.depthDownsampleTarget.texture[1].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].depthBuffer = false\n\n this.depthDownsampleQuad = new FullScreenTriangle(new THREE.ShaderMaterial(DepthDownSample))\n } else {\n if (this.depthDownsampleTarget) {\n this.depthDownsampleTarget.dispose()\n this.depthDownsampleTarget = null\n }\n if (this.depthDownsampleQuad) {\n this.depthDownsampleQuad.dispose()\n this.depthDownsampleQuad = null\n }\n }\n }\n configureSampleDependentPasses() {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n configureAOPass(logarithmicDepthBuffer = false) {\n this.samples = this.generateHemisphereSamples(this.configuration.aoSamples)\n this.samplesR = this.generateHemisphereSamplesR(this.configuration.aoSamples)\n const e = { ...EffectShader }\n e.fragmentShader = e.fragmentShader\n .replace('16', this.configuration.aoSamples)\n .replace('16.0', this.configuration.aoSamples + '.0')\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectShaderQuad) {\n this.effectShaderQuad.material.dispose()\n this.effectShaderQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectShaderQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n configureDenoisePass(logarithmicDepthBuffer = false) {\n this.samplesDenoise = this.generateDenoiseSamples(this.configuration.denoiseSamples, 11)\n const p = { ...PoissionBlur }\n p.fragmentShader = p.fragmentShader.replace('16', this.configuration.denoiseSamples)\n if (logarithmicDepthBuffer) {\n p.fragmentShader = '#define LOGDEPTH\\n' + p.fragmentShader\n }\n if (this.poissonBlurQuad) {\n this.poissonBlurQuad.material.dispose()\n this.poissonBlurQuad.material = new THREE.ShaderMaterial(p)\n } else {\n this.poissonBlurQuad = new FullScreenTriangle(new THREE.ShaderMaterial(p))\n }\n }\n configureEffectCompositer(logarithmicDepthBuffer = false) {\n const e = { ...EffectCompositer }\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes && this.configuration.depthAwareUpsampling) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectCompositerQuad) {\n this.effectCompositerQuad.material.dispose()\n this.effectCompositerQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectCompositerQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n /**\n *\n * @param {Number} n\n * @returns {THREE.Vector3[]}\n */\n generateHemisphereSamples(n) {\n const points = []\n for (let k = 0; k < n; k++) {\n const theta = 2.399963 * k\n const r = Math.sqrt(k + 0.5) / Math.sqrt(n)\n const x = r * Math.cos(theta)\n const y = r * Math.sin(theta)\n // Project to hemisphere\n const z = Math.sqrt(1 - (x * x + y * y))\n points.push(new THREE.Vector3(x, y, z))\n }\n return points\n }\n /**\n *\n * @param {number} n\n * @returns {number[]}\n */\n generateHemisphereSamplesR(n) {\n let samplesR = []\n for (let i = 0; i < n; i++) {\n samplesR.push((i + 1) / n)\n }\n return samplesR\n }\n /**\n *\n * @param {number} numSamples\n * @param {number} numRings\n * @returns {THREE.Vector2[]}\n */\n generateDenoiseSamples(numSamples, numRings) {\n const angleStep = (2 * Math.PI * numRings) / numSamples\n const invNumSamples = 1.0 / numSamples\n const radiusStep = invNumSamples\n const samples = []\n let radius = invNumSamples\n let angle = 0\n for (let i = 0; i < numSamples; i++) {\n samples.push(new THREE.Vector2(Math.cos(angle), Math.sin(angle)).multiplyScalar(Math.pow(radius, 0.75)))\n radius += radiusStep\n angle += angleStep\n }\n return samples\n }\n setSize(width, height) {\n this.width = width\n this.height = height\n const c = this.configuration.halfRes ? 0.5 : 1\n this.writeTargetInternal.setSize(width * c, height * c)\n this.readTargetInternal.setSize(width * c, height * c)\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget.setSize(width * c, height * c)\n }\n this.outputTargetInternal.setSize(width, height)\n }\n setDepthTexture(depthTexture) {\n this.depthTexture = depthTexture\n }\n render(renderer, inputBuffer, outputBuffer) {\n const xrEnabled = renderer.xr.enabled\n renderer.xr.enabled = false\n\n // Copy inputBuffer to outputBuffer\n //renderer.setRenderTarget(outputBuffer);\n // this.copyQuad.material.uniforms.tDiffuse.value = inputBuffer.texture;\n // this.copyQuad.render(renderer);\n\n if (renderer.capabilities.logarithmicDepthBuffer !== this.configuration.logarithmicDepthBuffer) {\n this.configuration.logarithmicDepthBuffer = renderer.capabilities.logarithmicDepthBuffer\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (inputBuffer.texture.type !== this.outputTargetInternal.texture.type) {\n this.outputTargetInternal.texture.type = inputBuffer.texture.type\n this.outputTargetInternal.texture.needsUpdate = true\n }\n let gl\n let ext\n let timerQuery\n if (this.debugMode) {\n gl = renderer.getContext()\n ext = gl.getExtension('EXT_disjoint_timer_query_webgl2')\n if (ext === null) {\n console.error('EXT_disjoint_timer_query_webgl2 not available, disabling debug mode.')\n this.debugMode = false\n }\n }\n if (this.debugMode) {\n timerQuery = gl.createQuery()\n gl.beginQuery(ext.TIME_ELAPSED_EXT, timerQuery)\n }\n this.camera.updateMatrixWorld()\n this._r.set(this.width, this.height)\n let trueRadius = this.configuration.aoRadius\n if (this.configuration.halfRes && this.configuration.screenSpaceRadius) {\n trueRadius *= 0.5\n }\n if (this.configuration.halfRes) {\n renderer.setRenderTarget(this.depthDownsampleTarget)\n this.depthDownsampleQuad.material.uniforms.sceneDepth.value = this.depthTexture\n this.depthDownsampleQuad.material.uniforms.resolution.value = this._r\n this.depthDownsampleQuad.material.uniforms['near'].value = this.camera.near\n this.depthDownsampleQuad.material.uniforms['far'].value = this.camera.far\n this.depthDownsampleQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.depthDownsampleQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.depthDownsampleQuad.material.uniforms['logDepth'].value = this.configuration.logarithmicDepthBuffer\n this.depthDownsampleQuad.render(renderer)\n }\n this.effectShaderQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectShaderQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectShaderQuad.material.uniforms['sceneNormal'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[1]\n : null\n this.effectShaderQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.effectShaderQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.effectShaderQuad.material.uniforms['projViewMat'].value = this.camera.projectionMatrix\n .clone()\n .multiply(this.camera.matrixWorldInverse.clone())\n this.effectShaderQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectShaderQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectShaderQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectShaderQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.effectShaderQuad.material.uniforms['time'].value = performance.now() / 1000\n this.effectShaderQuad.material.uniforms['samples'].value = this.samples\n this.effectShaderQuad.material.uniforms['samplesR'].value = this.samplesR\n this.effectShaderQuad.material.uniforms['bluenoise'].value = this.bluenoise\n this.effectShaderQuad.material.uniforms['radius'].value = trueRadius\n this.effectShaderQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectShaderQuad.material.uniforms['near'].value = this.camera.near\n this.effectShaderQuad.material.uniforms['far'].value = this.camera.far\n this.effectShaderQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectShaderQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectShaderQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n // Start the AO\n renderer.setRenderTarget(this.writeTargetInternal)\n this.effectShaderQuad.render(renderer)\n // End the AO\n // Start the blur\n for (let i = 0; i < this.configuration.denoiseIterations; i++) {\n ;[this.writeTargetInternal, this.readTargetInternal] = [this.readTargetInternal, this.writeTargetInternal]\n this.poissonBlurQuad.material.uniforms['tDiffuse'].value = this.readTargetInternal.texture\n this.poissonBlurQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.poissonBlurQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.poissonBlurQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.poissonBlurQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.poissonBlurQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.poissonBlurQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.poissonBlurQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.poissonBlurQuad.material.uniforms['time'].value = performance.now() / 1000\n this.poissonBlurQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.poissonBlurQuad.material.uniforms['radius'].value =\n this.configuration.denoiseRadius * (this.configuration.halfRes ? 1 / 2 : 1)\n this.poissonBlurQuad.material.uniforms['worldRadius'].value = trueRadius\n this.poissonBlurQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.poissonBlurQuad.material.uniforms['index'].value = i\n this.poissonBlurQuad.material.uniforms['poissonDisk'].value = this.samplesDenoise\n this.poissonBlurQuad.material.uniforms['near'].value = this.camera.near\n this.poissonBlurQuad.material.uniforms['far'].value = this.camera.far\n this.poissonBlurQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.poissonBlurQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n renderer.setRenderTarget(this.writeTargetInternal)\n this.poissonBlurQuad.render(renderer)\n }\n // Now, we have the blurred AO in writeTargetInternal\n // End the blur\n // Start the composition\n this.effectCompositerQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectCompositerQuad.material.uniforms['sceneDepth'].value = this.depthTexture\n this.effectCompositerQuad.material.uniforms['near'].value = this.camera.near\n this.effectCompositerQuad.material.uniforms['far'].value = this.camera.far\n this.effectCompositerQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectCompositerQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectCompositerQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectCompositerQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectCompositerQuad.material.uniforms['downsampledDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectCompositerQuad.material.uniforms['resolution'].value = this._r\n this.effectCompositerQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.effectCompositerQuad.material.uniforms['intensity'].value = this.configuration.intensity\n this.effectCompositerQuad.material.uniforms['renderMode'].value = this.configuration.renderMode\n this.effectCompositerQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n this.effectCompositerQuad.material.uniforms['radius'].value = trueRadius\n this.effectCompositerQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectCompositerQuad.material.uniforms['gammaCorrection'].value = this.autosetGamma\n ? this.renderToScreen\n : this.configuration.gammaCorrection\n this.effectCompositerQuad.material.uniforms['tDiffuse'].value = this.writeTargetInternal.texture\n this.effectCompositerQuad.material.uniforms['color'].value = this._c\n .copy(this.configuration.color)\n .convertSRGBToLinear()\n this.effectCompositerQuad.material.uniforms['colorMultiply'].value = this.configuration.colorMultiply\n this.effectCompositerQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectCompositerQuad.material.uniforms['fog'].value = !!this.scene.fog\n if (this.scene.fog) {\n if (this.scene.fog.isFog) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = false\n this.effectCompositerQuad.material.uniforms['fogNear'].value = this.scene.fog.near\n this.effectCompositerQuad.material.uniforms['fogFar'].value = this.scene.fog.far\n } else if (this.scene.fog.isFogExp2) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = true\n this.effectCompositerQuad.material.uniforms['fogDensity'].value = this.scene.fog.density\n } else {\n console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)\n }\n }\n renderer.setRenderTarget(\n /* this.renderToScreen ? null :\n outputBuffer*/\n this.outputTargetInternal\n )\n this.effectCompositerQuad.render(renderer)\n renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer)\n this.copyQuad.material.uniforms['tDiffuse'].value = this.outputTargetInternal.texture\n this.copyQuad.render(renderer)\n if (this.debugMode) {\n gl.endQuery(ext.TIME_ELAPSED_EXT)\n checkTimerQuery(timerQuery, gl, this)\n }\n\n renderer.xr.enabled = xrEnabled\n }\n /**\n * Enables the debug mode of the AO, meaning the lastTime value will be updated.\n */\n enableDebugMode() {\n this.debugMode = true\n }\n /**\n * Disables the debug mode of the AO, meaning the lastTime value will not be updated.\n */\n disableDebugMode() {\n this.debugMode = false\n }\n /**\n * Sets the display mode of the AO\n * @param {\"Combined\" | \"AO\" | \"No AO\" | \"Split\" | \"Split AO\"} mode - The display mode.\n */\n setDisplayMode(mode) {\n this.configuration.renderMode = ['Combined', 'AO', 'No AO', 'Split', 'Split AO'].indexOf(mode)\n }\n /**\n *\n * @param {\"Performance\" | \"Low\" | \"Medium\" | \"High\" | \"Ultra\"} mode\n */\n setQualityMode(mode) {\n if (mode === 'Performance') {\n this.configuration.aoSamples = 8\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Low') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Medium') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 12\n } else if (mode === 'High') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 6\n } else if (mode === 'Ultra') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 16\n this.configuration.denoiseRadius = 6\n }\n }\n}\nexport { N8AOPostPass }\n"],"names":["Buffer","Pass","THREE","FullScreenTriangle","DepthDownSample","EffectShader","PoissionBlur","EffectCompositer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,gBAAgBA,OAAM,OAAC,KAAK,WAAW,QAAQ;AAQrD,SAAS,gBAAgB,YAAY,IAAI,MAAM;AAC7C,QAAM,YAAY,GAAG,kBAAkB,YAAY,GAAG,sBAAsB;AAC5E,MAAI,WAAW;AACb,UAAM,kBAAkB,GAAG,kBAAkB,YAAY,GAAG,YAAY;AACxE,UAAM,kBAAkB,kBAAkB;AAC1C,SAAK,WAAW;AAAA,EACpB,OAAS;AAEL,eAAW,MAAM;AACf,sBAAgB,YAAY,IAAI,IAAI;AAAA,IACrC,GAAE,CAAC;AAAA,EACL;AACH;AACA,MAAM,qBAAqBC,eAAAA,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YAAY,OAAO,QAAQ,QAAQ,KAAK,SAAS,KAAK;AACpD,UAAO;AACP,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,QAAQ;AAEb,SAAK,SAAS;AACd,SAAK,QAAQ;AAoBb,SAAK,eAAe;AACpB,SAAK,gBAAgB,IAAI;AAAA,MACvB;AAAA,QACE,WAAW;AAAA,QACX,UAAU;AAAA,QACV,gBAAgB;AAAA,QAChB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,mBAAmB;AAAA,QACnB,YAAY;AAAA,QACZ,OAAO,IAAIC,iBAAM,MAAM,GAAG,GAAG,CAAC;AAAA,QAC9B,iBAAiB;AAAA,QACjB,wBAAwB;AAAA,QACxB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A;AAAA;AAAA;AAAA,EAID,kBAAkB;AAChB,SAAK,YAAY;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAID,mBAAmB;AACjB,SAAK,YAAY;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,SAAK,cAAc,aAAa,CAAC,YAAY,MAAM,SAAS,SAAS,UAAU,EAAE,QAAQ,IAAI;AAAA,EAC9F;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,QAAI,SAAS,eAAe;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,OAAO;AACzB,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,UAAU;AAC5B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,QAAQ;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,SAAS;AAC3B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACpC;AAAA,EACF;AACH;;"}
1
+ {"version":3,"file":"N8AOPostPass.cjs","sources":["../../../src/effects/N8AO/N8AOPostPass.js"],"sourcesContent":["import * as THREE from 'three'\nimport { Pass } from 'postprocessing'\nimport { Buffer } from 'buffer'\nimport { FullScreenTriangle } from './FullScreenTriangle'\nimport { EffectShader } from './EffectShader'\nimport { EffectCompositer } from './EffectCompositer'\nimport { PoissionBlur } from './PoissionBlur'\nimport { DepthDownSample } from './DepthDownSample'\nimport BlueNoise from './BlueNoise'\nimport { WebGLMultipleRenderTargets } from '../../compat'\n\nconst bluenoiseBits = Buffer.from(BlueNoise, 'base64')\n\n/**\n *\n * @param {*} timerQuery\n * @param {THREE.WebGLRenderer} gl\n * @param {N8AOPass} pass\n */\nfunction checkTimerQuery(timerQuery, gl, pass) {\n const available = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT_AVAILABLE)\n if (available) {\n const elapsedTimeInNs = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT)\n const elapsedTimeInMs = elapsedTimeInNs / 1000000\n pass.lastTime = elapsedTimeInMs\n } else {\n // If the result is not available yet, check again after a delay\n setTimeout(() => {\n checkTimerQuery(timerQuery, gl, pass)\n }, 1)\n }\n}\nclass N8AOPostPass extends Pass {\n /**\n *\n * @param {THREE.Scene} scene\n * @param {THREE.Camera} camera\n * @param {number} width\n * @param {number} height\n *\n * @property {THREE.Scene} scene\n * @property {THREE.Camera} camera\n * @property {number} width\n * @property {number} height\n */\n constructor(scene, camera, width = 512, height = 512) {\n super()\n this.width = width\n this.height = height\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n /**\n * @type {Proxy & {\n * aoSamples: number,\n * aoRadius: number,\n * denoiseSamples: number,\n * denoiseRadius: number,\n * distanceFalloff: number,\n * intensity: number,\n * denoiseIterations: number,\n * renderMode: 0 | 1 | 2 | 3 | 4,\n * color: THREE.Color,\n * gammaCorrection: boolean,\n * logarithmicDepthBuffer: boolean\n * screenSpaceRadius: boolean,\n * halfRes: boolean,\n * depthAwareUpsampling: boolean\n * colorMultiply: boolean\n * }\n */\n this.autosetGamma = true\n this.configuration = new Proxy(\n {\n aoSamples: 16,\n aoRadius: 5.0,\n denoiseSamples: 8,\n denoiseRadius: 12,\n distanceFalloff: 1.0,\n intensity: 5,\n denoiseIterations: 2.0,\n renderMode: 0,\n color: new THREE.Color(0, 0, 0),\n gammaCorrection: true,\n logarithmicDepthBuffer: false,\n screenSpaceRadius: false,\n halfRes: false,\n depthAwareUpsampling: true,\n colorMultiply: true,\n },\n {\n set: (target, propName, value) => {\n const oldProp = target[propName]\n target[propName] = value\n if (propName === 'aoSamples' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'denoiseSamples' && oldProp !== value) {\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'halfRes' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureHalfResTargets()\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.setSize(this.width, this.height)\n }\n if (propName === 'depthAwareUpsampling' && oldProp !== value) {\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'gammaCorrection') {\n this.autosetGamma = false\n }\n return true\n },\n }\n )\n /** @type {THREE.Vector3[]} */\n this.samples = []\n /** @type {number[]} */\n this.samplesR = []\n /** @type {THREE.Vector2[]} */\n this.samplesDenoise = []\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.configureSampleDependentPasses()\n this.configureHalfResTargets()\n // this.effectCompisterQuad = new FullScreenTriangle(new THREE.ShaderMaterial(EffectCompositer));\n this.copyQuad = new FullScreenTriangle(\n new THREE.ShaderMaterial({\n uniforms: {\n tDiffuse: {\n value: null,\n },\n },\n depthWrite: false,\n vertexShader: `\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }\n `,\n fragmentShader: `\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n gl_FragColor = texture2D(tDiffuse, vUv);\n }\n `,\n })\n )\n this.writeTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.readTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.outputTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n\n /** @type {THREE.DataTexture} */\n this.bluenoise = //bluenoise;\n new THREE.DataTexture(bluenoiseBits, 128, 128)\n this.bluenoise.colorSpace = THREE.NoColorSpace\n this.bluenoise.wrapS = THREE.RepeatWrapping\n this.bluenoise.wrapT = THREE.RepeatWrapping\n this.bluenoise.minFilter = THREE.NearestFilter\n this.bluenoise.magFilter = THREE.NearestFilter\n this.bluenoise.needsUpdate = true\n this.lastTime = 0\n this.needsDepthTexture = true\n this.needsSwap = true\n this._r = new THREE.Vector2()\n this._c = new THREE.Color()\n }\n configureHalfResTargets() {\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget =\n /*new THREE.WebGLRenderTarget(this.width / 2, this.height / 2, {\n minFilter: THREE.NearestFilter,\n magFilter: THREE.NearestFilter,\n depthBuffer: false,\n format: THREE.RedFormat,\n type: THREE.FloatType\n });*/\n new WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2)\n this.depthDownsampleTarget.texture[0].format = THREE.RedFormat\n this.depthDownsampleTarget.texture[0].type = THREE.FloatType\n this.depthDownsampleTarget.texture[0].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].depthBuffer = false\n this.depthDownsampleTarget.texture[1].format = THREE.RGBAFormat\n this.depthDownsampleTarget.texture[1].type = THREE.HalfFloatType\n this.depthDownsampleTarget.texture[1].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].depthBuffer = false\n\n this.depthDownsampleQuad = new FullScreenTriangle(new THREE.ShaderMaterial(DepthDownSample))\n } else {\n if (this.depthDownsampleTarget) {\n this.depthDownsampleTarget.dispose()\n this.depthDownsampleTarget = null\n }\n if (this.depthDownsampleQuad) {\n this.depthDownsampleQuad.dispose()\n this.depthDownsampleQuad = null\n }\n }\n }\n configureSampleDependentPasses() {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n configureAOPass(logarithmicDepthBuffer = false) {\n this.samples = this.generateHemisphereSamples(this.configuration.aoSamples)\n this.samplesR = this.generateHemisphereSamplesR(this.configuration.aoSamples)\n const e = { ...EffectShader }\n e.fragmentShader = e.fragmentShader\n .replace('16', this.configuration.aoSamples)\n .replace('16.0', this.configuration.aoSamples + '.0')\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectShaderQuad) {\n this.effectShaderQuad.material.dispose()\n this.effectShaderQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectShaderQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n configureDenoisePass(logarithmicDepthBuffer = false) {\n this.samplesDenoise = this.generateDenoiseSamples(this.configuration.denoiseSamples, 11)\n const p = { ...PoissionBlur }\n p.fragmentShader = p.fragmentShader.replace('16', this.configuration.denoiseSamples)\n if (logarithmicDepthBuffer) {\n p.fragmentShader = '#define LOGDEPTH\\n' + p.fragmentShader\n }\n if (this.poissonBlurQuad) {\n this.poissonBlurQuad.material.dispose()\n this.poissonBlurQuad.material = new THREE.ShaderMaterial(p)\n } else {\n this.poissonBlurQuad = new FullScreenTriangle(new THREE.ShaderMaterial(p))\n }\n }\n configureEffectCompositer(logarithmicDepthBuffer = false) {\n const e = { ...EffectCompositer }\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes && this.configuration.depthAwareUpsampling) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectCompositerQuad) {\n this.effectCompositerQuad.material.dispose()\n this.effectCompositerQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectCompositerQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n /**\n *\n * @param {Number} n\n * @returns {THREE.Vector3[]}\n */\n generateHemisphereSamples(n) {\n const points = []\n for (let k = 0; k < n; k++) {\n const theta = 2.399963 * k\n const r = Math.sqrt(k + 0.5) / Math.sqrt(n)\n const x = r * Math.cos(theta)\n const y = r * Math.sin(theta)\n // Project to hemisphere\n const z = Math.sqrt(1 - (x * x + y * y))\n points.push(new THREE.Vector3(x, y, z))\n }\n return points\n }\n /**\n *\n * @param {number} n\n * @returns {number[]}\n */\n generateHemisphereSamplesR(n) {\n let samplesR = []\n for (let i = 0; i < n; i++) {\n samplesR.push((i + 1) / n)\n }\n return samplesR\n }\n /**\n *\n * @param {number} numSamples\n * @param {number} numRings\n * @returns {THREE.Vector2[]}\n */\n generateDenoiseSamples(numSamples, numRings) {\n const angleStep = (2 * Math.PI * numRings) / numSamples\n const invNumSamples = 1.0 / numSamples\n const radiusStep = invNumSamples\n const samples = []\n let radius = invNumSamples\n let angle = 0\n for (let i = 0; i < numSamples; i++) {\n samples.push(new THREE.Vector2(Math.cos(angle), Math.sin(angle)).multiplyScalar(Math.pow(radius, 0.75)))\n radius += radiusStep\n angle += angleStep\n }\n return samples\n }\n setSize(width, height) {\n this.width = width\n this.height = height\n const c = this.configuration.halfRes ? 0.5 : 1\n this.writeTargetInternal.setSize(width * c, height * c)\n this.readTargetInternal.setSize(width * c, height * c)\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget.setSize(width * c, height * c)\n }\n this.outputTargetInternal.setSize(width, height)\n }\n setDepthTexture(depthTexture) {\n this.depthTexture = depthTexture\n }\n render(renderer, inputBuffer, outputBuffer) {\n const xrEnabled = renderer.xr.enabled\n renderer.xr.enabled = false\n\n // Copy inputBuffer to outputBuffer\n //renderer.setRenderTarget(outputBuffer);\n // this.copyQuad.material.uniforms.tDiffuse.value = inputBuffer.texture;\n // this.copyQuad.render(renderer);\n\n if (renderer.capabilities.logarithmicDepthBuffer !== this.configuration.logarithmicDepthBuffer) {\n this.configuration.logarithmicDepthBuffer = renderer.capabilities.logarithmicDepthBuffer\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (inputBuffer.texture.type !== this.outputTargetInternal.texture.type) {\n this.outputTargetInternal.texture.type = inputBuffer.texture.type\n this.outputTargetInternal.texture.needsUpdate = true\n }\n let gl\n let ext\n let timerQuery\n if (this.debugMode) {\n gl = renderer.getContext()\n ext = gl.getExtension('EXT_disjoint_timer_query_webgl2')\n if (ext === null) {\n console.error('EXT_disjoint_timer_query_webgl2 not available, disabling debug mode.')\n this.debugMode = false\n }\n }\n if (this.debugMode) {\n timerQuery = gl.createQuery()\n gl.beginQuery(ext.TIME_ELAPSED_EXT, timerQuery)\n }\n this.camera.updateMatrixWorld()\n this._r.set(this.width, this.height)\n let trueRadius = this.configuration.aoRadius\n if (this.configuration.halfRes && this.configuration.screenSpaceRadius) {\n trueRadius *= 0.5\n }\n if (this.configuration.halfRes) {\n renderer.setRenderTarget(this.depthDownsampleTarget)\n this.depthDownsampleQuad.material.uniforms.sceneDepth.value = this.depthTexture\n this.depthDownsampleQuad.material.uniforms.resolution.value = this._r\n this.depthDownsampleQuad.material.uniforms['near'].value = this.camera.near\n this.depthDownsampleQuad.material.uniforms['far'].value = this.camera.far\n this.depthDownsampleQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.depthDownsampleQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.depthDownsampleQuad.material.uniforms['logDepth'].value = this.configuration.logarithmicDepthBuffer\n this.depthDownsampleQuad.render(renderer)\n }\n this.effectShaderQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectShaderQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectShaderQuad.material.uniforms['sceneNormal'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[1]\n : null\n this.effectShaderQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.effectShaderQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.effectShaderQuad.material.uniforms['projViewMat'].value = this.camera.projectionMatrix\n .clone()\n .multiply(this.camera.matrixWorldInverse.clone())\n this.effectShaderQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectShaderQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectShaderQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectShaderQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.effectShaderQuad.material.uniforms['time'].value = performance.now() / 1000\n this.effectShaderQuad.material.uniforms['samples'].value = this.samples\n this.effectShaderQuad.material.uniforms['samplesR'].value = this.samplesR\n this.effectShaderQuad.material.uniforms['bluenoise'].value = this.bluenoise\n this.effectShaderQuad.material.uniforms['radius'].value = trueRadius\n this.effectShaderQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectShaderQuad.material.uniforms['near'].value = this.camera.near\n this.effectShaderQuad.material.uniforms['far'].value = this.camera.far\n this.effectShaderQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectShaderQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectShaderQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n // Start the AO\n renderer.setRenderTarget(this.writeTargetInternal)\n this.effectShaderQuad.render(renderer)\n // End the AO\n // Start the blur\n for (let i = 0; i < this.configuration.denoiseIterations; i++) {\n ;[this.writeTargetInternal, this.readTargetInternal] = [this.readTargetInternal, this.writeTargetInternal]\n this.poissonBlurQuad.material.uniforms['tDiffuse'].value = this.readTargetInternal.texture\n this.poissonBlurQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.poissonBlurQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.poissonBlurQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.poissonBlurQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.poissonBlurQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.poissonBlurQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.poissonBlurQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.poissonBlurQuad.material.uniforms['time'].value = performance.now() / 1000\n this.poissonBlurQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.poissonBlurQuad.material.uniforms['radius'].value =\n this.configuration.denoiseRadius * (this.configuration.halfRes ? 1 / 2 : 1)\n this.poissonBlurQuad.material.uniforms['worldRadius'].value = trueRadius\n this.poissonBlurQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.poissonBlurQuad.material.uniforms['index'].value = i\n this.poissonBlurQuad.material.uniforms['poissonDisk'].value = this.samplesDenoise\n this.poissonBlurQuad.material.uniforms['near'].value = this.camera.near\n this.poissonBlurQuad.material.uniforms['far'].value = this.camera.far\n this.poissonBlurQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.poissonBlurQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n renderer.setRenderTarget(this.writeTargetInternal)\n this.poissonBlurQuad.render(renderer)\n }\n // Now, we have the blurred AO in writeTargetInternal\n // End the blur\n // Start the composition\n this.effectCompositerQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectCompositerQuad.material.uniforms['sceneDepth'].value = this.depthTexture\n this.effectCompositerQuad.material.uniforms['near'].value = this.camera.near\n this.effectCompositerQuad.material.uniforms['far'].value = this.camera.far\n this.effectCompositerQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectCompositerQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectCompositerQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectCompositerQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectCompositerQuad.material.uniforms['downsampledDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectCompositerQuad.material.uniforms['resolution'].value = this._r\n this.effectCompositerQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.effectCompositerQuad.material.uniforms['intensity'].value = this.configuration.intensity\n this.effectCompositerQuad.material.uniforms['renderMode'].value = this.configuration.renderMode\n this.effectCompositerQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n this.effectCompositerQuad.material.uniforms['radius'].value = trueRadius\n this.effectCompositerQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectCompositerQuad.material.uniforms['gammaCorrection'].value = this.autosetGamma\n ? this.renderToScreen\n : this.configuration.gammaCorrection\n this.effectCompositerQuad.material.uniforms['tDiffuse'].value = this.writeTargetInternal.texture\n this.effectCompositerQuad.material.uniforms['color'].value = this._c\n .copy(this.configuration.color)\n .convertSRGBToLinear()\n this.effectCompositerQuad.material.uniforms['colorMultiply'].value = this.configuration.colorMultiply\n this.effectCompositerQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectCompositerQuad.material.uniforms['fog'].value = !!this.scene.fog\n if (this.scene.fog) {\n if (this.scene.fog.isFog) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = false\n this.effectCompositerQuad.material.uniforms['fogNear'].value = this.scene.fog.near\n this.effectCompositerQuad.material.uniforms['fogFar'].value = this.scene.fog.far\n } else if (this.scene.fog.isFogExp2) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = true\n this.effectCompositerQuad.material.uniforms['fogDensity'].value = this.scene.fog.density\n } else {\n console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)\n }\n }\n renderer.setRenderTarget(\n /* this.renderToScreen ? null :\n outputBuffer*/\n this.outputTargetInternal\n )\n this.effectCompositerQuad.render(renderer)\n renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer)\n this.copyQuad.material.uniforms['tDiffuse'].value = this.outputTargetInternal.texture\n this.copyQuad.render(renderer)\n if (this.debugMode) {\n gl.endQuery(ext.TIME_ELAPSED_EXT)\n checkTimerQuery(timerQuery, gl, this)\n }\n\n renderer.xr.enabled = xrEnabled\n }\n /**\n * Enables the debug mode of the AO, meaning the lastTime value will be updated.\n */\n enableDebugMode() {\n this.debugMode = true\n }\n /**\n * Disables the debug mode of the AO, meaning the lastTime value will not be updated.\n */\n disableDebugMode() {\n this.debugMode = false\n }\n /**\n * Sets the display mode of the AO\n * @param {\"Combined\" | \"AO\" | \"No AO\" | \"Split\" | \"Split AO\"} mode - The display mode.\n */\n setDisplayMode(mode) {\n this.configuration.renderMode = ['Combined', 'AO', 'No AO', 'Split', 'Split AO'].indexOf(mode)\n }\n /**\n *\n * @param {\"Performance\" | \"Low\" | \"Medium\" | \"High\" | \"Ultra\"} mode\n */\n setQualityMode(mode) {\n if (mode === 'Performance') {\n this.configuration.aoSamples = 8\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Low') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Medium') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 12\n } else if (mode === 'High') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 6\n } else if (mode === 'Ultra') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 16\n this.configuration.denoiseRadius = 6\n }\n }\n}\nexport { N8AOPostPass }\n"],"names":["Buffer","Pass","THREE","FullScreenTriangle","WebGLMultipleRenderTargets","DepthDownSample","EffectShader","PoissionBlur","EffectCompositer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,gBAAgBA,OAAM,OAAC,KAAK,WAAW,QAAQ;AAQrD,SAAS,gBAAgB,YAAY,IAAI,MAAM;AAC7C,QAAM,YAAY,GAAG,kBAAkB,YAAY,GAAG,sBAAsB;AAC5E,MAAI,WAAW;AACb,UAAM,kBAAkB,GAAG,kBAAkB,YAAY,GAAG,YAAY;AACxE,UAAM,kBAAkB,kBAAkB;AAC1C,SAAK,WAAW;AAAA,EACpB,OAAS;AAEL,eAAW,MAAM;AACf,sBAAgB,YAAY,IAAI,IAAI;AAAA,IACrC,GAAE,CAAC;AAAA,EACL;AACH;AACA,MAAM,qBAAqBC,eAAAA,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YAAY,OAAO,QAAQ,QAAQ,KAAK,SAAS,KAAK;AACpD,UAAO;AACP,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,QAAQ;AAEb,SAAK,SAAS;AACd,SAAK,QAAQ;AAoBb,SAAK,eAAe;AACpB,SAAK,gBAAgB,IAAI;AAAA,MACvB;AAAA,QACE,WAAW;AAAA,QACX,UAAU;AAAA,QACV,gBAAgB;AAAA,QAChB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,mBAAmB;AAAA,QACnB,YAAY;AAAA,QACZ,OAAO,IAAIC,iBAAM,MAAM,GAAG,GAAG,CAAC;AAAA,QAC9B,iBAAiB;AAAA,QACjB,wBAAwB;AAAA,QACxB,mBAAmB;AAAA,QACnB,SAAS;AAAA,QACT,sBAAsB;AAAA,QACtB,eAAe;AAAA,MAChB;AAAA,MACD;AAAA,QACE,KAAK,CAAC,QAAQ,UAAU,UAAU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;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,SAAK,cAAc,aAAa,CAAC,YAAY,MAAM,SAAS,SAAS,UAAU,EAAE,QAAQ,IAAI;AAAA,EAC9F;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,QAAI,SAAS,eAAe;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,OAAO;AACzB,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,UAAU;AAC5B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,QAAQ;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,SAAS;AAC3B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACpC;AAAA,EACF;AACH;;"}
@@ -7,6 +7,7 @@ import { EffectCompositer } from "./EffectCompositer.js";
7
7
  import { PoissionBlur } from "./PoissionBlur.js";
8
8
  import { DepthDownSample } from "./DepthDownSample.js";
9
9
  import BlueNoise from "./BlueNoise.js";
10
+ import { WebGLMultipleRenderTargets } from "../../compat.js";
10
11
  const bluenoiseBits = Buffer.from(BlueNoise, "base64");
11
12
  function checkTimerQuery(timerQuery, gl, pass) {
12
13
  const available = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT_AVAILABLE);
@@ -153,7 +154,7 @@ class N8AOPostPass extends Pass {
153
154
  format: THREE.RedFormat,
154
155
  type: THREE.FloatType
155
156
  });*/
156
- new THREE.WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2);
157
+ new WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2);
157
158
  this.depthDownsampleTarget.texture[0].format = THREE.RedFormat;
158
159
  this.depthDownsampleTarget.texture[0].type = THREE.FloatType;
159
160
  this.depthDownsampleTarget.texture[0].minFilter = THREE.NearestFilter;
@@ -1 +1 @@
1
- {"version":3,"file":"N8AOPostPass.js","sources":["../../../src/effects/N8AO/N8AOPostPass.js"],"sourcesContent":["import * as THREE from 'three'\nimport { Pass } from 'postprocessing'\nimport { Buffer } from 'buffer'\nimport { FullScreenTriangle } from './FullScreenTriangle'\nimport { EffectShader } from './EffectShader'\nimport { EffectCompositer } from './EffectCompositer'\nimport { PoissionBlur } from './PoissionBlur'\nimport { DepthDownSample } from './DepthDownSample'\nimport BlueNoise from './BlueNoise'\n\nconst bluenoiseBits = Buffer.from(BlueNoise, 'base64')\n\n/**\n *\n * @param {*} timerQuery\n * @param {THREE.WebGLRenderer} gl\n * @param {N8AOPass} pass\n */\nfunction checkTimerQuery(timerQuery, gl, pass) {\n const available = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT_AVAILABLE)\n if (available) {\n const elapsedTimeInNs = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT)\n const elapsedTimeInMs = elapsedTimeInNs / 1000000\n pass.lastTime = elapsedTimeInMs\n } else {\n // If the result is not available yet, check again after a delay\n setTimeout(() => {\n checkTimerQuery(timerQuery, gl, pass)\n }, 1)\n }\n}\nclass N8AOPostPass extends Pass {\n /**\n *\n * @param {THREE.Scene} scene\n * @param {THREE.Camera} camera\n * @param {number} width\n * @param {number} height\n *\n * @property {THREE.Scene} scene\n * @property {THREE.Camera} camera\n * @property {number} width\n * @property {number} height\n */\n constructor(scene, camera, width = 512, height = 512) {\n super()\n this.width = width\n this.height = height\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n /**\n * @type {Proxy & {\n * aoSamples: number,\n * aoRadius: number,\n * denoiseSamples: number,\n * denoiseRadius: number,\n * distanceFalloff: number,\n * intensity: number,\n * denoiseIterations: number,\n * renderMode: 0 | 1 | 2 | 3 | 4,\n * color: THREE.Color,\n * gammaCorrection: boolean,\n * logarithmicDepthBuffer: boolean\n * screenSpaceRadius: boolean,\n * halfRes: boolean,\n * depthAwareUpsampling: boolean\n * colorMultiply: boolean\n * }\n */\n this.autosetGamma = true\n this.configuration = new Proxy(\n {\n aoSamples: 16,\n aoRadius: 5.0,\n denoiseSamples: 8,\n denoiseRadius: 12,\n distanceFalloff: 1.0,\n intensity: 5,\n denoiseIterations: 2.0,\n renderMode: 0,\n color: new THREE.Color(0, 0, 0),\n gammaCorrection: true,\n logarithmicDepthBuffer: false,\n screenSpaceRadius: false,\n halfRes: false,\n depthAwareUpsampling: true,\n colorMultiply: true,\n },\n {\n set: (target, propName, value) => {\n const oldProp = target[propName]\n target[propName] = value\n if (propName === 'aoSamples' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'denoiseSamples' && oldProp !== value) {\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'halfRes' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureHalfResTargets()\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.setSize(this.width, this.height)\n }\n if (propName === 'depthAwareUpsampling' && oldProp !== value) {\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'gammaCorrection') {\n this.autosetGamma = false\n }\n return true\n },\n }\n )\n /** @type {THREE.Vector3[]} */\n this.samples = []\n /** @type {number[]} */\n this.samplesR = []\n /** @type {THREE.Vector2[]} */\n this.samplesDenoise = []\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.configureSampleDependentPasses()\n this.configureHalfResTargets()\n // this.effectCompisterQuad = new FullScreenTriangle(new THREE.ShaderMaterial(EffectCompositer));\n this.copyQuad = new FullScreenTriangle(\n new THREE.ShaderMaterial({\n uniforms: {\n tDiffuse: {\n value: null,\n },\n },\n depthWrite: false,\n vertexShader: `\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }\n `,\n fragmentShader: `\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n gl_FragColor = texture2D(tDiffuse, vUv);\n }\n `,\n })\n )\n this.writeTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.readTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.outputTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n\n /** @type {THREE.DataTexture} */\n this.bluenoise = //bluenoise;\n new THREE.DataTexture(bluenoiseBits, 128, 128)\n this.bluenoise.colorSpace = THREE.NoColorSpace\n this.bluenoise.wrapS = THREE.RepeatWrapping\n this.bluenoise.wrapT = THREE.RepeatWrapping\n this.bluenoise.minFilter = THREE.NearestFilter\n this.bluenoise.magFilter = THREE.NearestFilter\n this.bluenoise.needsUpdate = true\n this.lastTime = 0\n this.needsDepthTexture = true\n this.needsSwap = true\n this._r = new THREE.Vector2()\n this._c = new THREE.Color()\n }\n configureHalfResTargets() {\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget =\n /*new THREE.WebGLRenderTarget(this.width / 2, this.height / 2, {\n minFilter: THREE.NearestFilter,\n magFilter: THREE.NearestFilter,\n depthBuffer: false,\n format: THREE.RedFormat,\n type: THREE.FloatType\n });*/\n new THREE.WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2)\n this.depthDownsampleTarget.texture[0].format = THREE.RedFormat\n this.depthDownsampleTarget.texture[0].type = THREE.FloatType\n this.depthDownsampleTarget.texture[0].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].depthBuffer = false\n this.depthDownsampleTarget.texture[1].format = THREE.RGBAFormat\n this.depthDownsampleTarget.texture[1].type = THREE.HalfFloatType\n this.depthDownsampleTarget.texture[1].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].depthBuffer = false\n\n this.depthDownsampleQuad = new FullScreenTriangle(new THREE.ShaderMaterial(DepthDownSample))\n } else {\n if (this.depthDownsampleTarget) {\n this.depthDownsampleTarget.dispose()\n this.depthDownsampleTarget = null\n }\n if (this.depthDownsampleQuad) {\n this.depthDownsampleQuad.dispose()\n this.depthDownsampleQuad = null\n }\n }\n }\n configureSampleDependentPasses() {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n configureAOPass(logarithmicDepthBuffer = false) {\n this.samples = this.generateHemisphereSamples(this.configuration.aoSamples)\n this.samplesR = this.generateHemisphereSamplesR(this.configuration.aoSamples)\n const e = { ...EffectShader }\n e.fragmentShader = e.fragmentShader\n .replace('16', this.configuration.aoSamples)\n .replace('16.0', this.configuration.aoSamples + '.0')\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectShaderQuad) {\n this.effectShaderQuad.material.dispose()\n this.effectShaderQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectShaderQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n configureDenoisePass(logarithmicDepthBuffer = false) {\n this.samplesDenoise = this.generateDenoiseSamples(this.configuration.denoiseSamples, 11)\n const p = { ...PoissionBlur }\n p.fragmentShader = p.fragmentShader.replace('16', this.configuration.denoiseSamples)\n if (logarithmicDepthBuffer) {\n p.fragmentShader = '#define LOGDEPTH\\n' + p.fragmentShader\n }\n if (this.poissonBlurQuad) {\n this.poissonBlurQuad.material.dispose()\n this.poissonBlurQuad.material = new THREE.ShaderMaterial(p)\n } else {\n this.poissonBlurQuad = new FullScreenTriangle(new THREE.ShaderMaterial(p))\n }\n }\n configureEffectCompositer(logarithmicDepthBuffer = false) {\n const e = { ...EffectCompositer }\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes && this.configuration.depthAwareUpsampling) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectCompositerQuad) {\n this.effectCompositerQuad.material.dispose()\n this.effectCompositerQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectCompositerQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n /**\n *\n * @param {Number} n\n * @returns {THREE.Vector3[]}\n */\n generateHemisphereSamples(n) {\n const points = []\n for (let k = 0; k < n; k++) {\n const theta = 2.399963 * k\n const r = Math.sqrt(k + 0.5) / Math.sqrt(n)\n const x = r * Math.cos(theta)\n const y = r * Math.sin(theta)\n // Project to hemisphere\n const z = Math.sqrt(1 - (x * x + y * y))\n points.push(new THREE.Vector3(x, y, z))\n }\n return points\n }\n /**\n *\n * @param {number} n\n * @returns {number[]}\n */\n generateHemisphereSamplesR(n) {\n let samplesR = []\n for (let i = 0; i < n; i++) {\n samplesR.push((i + 1) / n)\n }\n return samplesR\n }\n /**\n *\n * @param {number} numSamples\n * @param {number} numRings\n * @returns {THREE.Vector2[]}\n */\n generateDenoiseSamples(numSamples, numRings) {\n const angleStep = (2 * Math.PI * numRings) / numSamples\n const invNumSamples = 1.0 / numSamples\n const radiusStep = invNumSamples\n const samples = []\n let radius = invNumSamples\n let angle = 0\n for (let i = 0; i < numSamples; i++) {\n samples.push(new THREE.Vector2(Math.cos(angle), Math.sin(angle)).multiplyScalar(Math.pow(radius, 0.75)))\n radius += radiusStep\n angle += angleStep\n }\n return samples\n }\n setSize(width, height) {\n this.width = width\n this.height = height\n const c = this.configuration.halfRes ? 0.5 : 1\n this.writeTargetInternal.setSize(width * c, height * c)\n this.readTargetInternal.setSize(width * c, height * c)\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget.setSize(width * c, height * c)\n }\n this.outputTargetInternal.setSize(width, height)\n }\n setDepthTexture(depthTexture) {\n this.depthTexture = depthTexture\n }\n render(renderer, inputBuffer, outputBuffer) {\n const xrEnabled = renderer.xr.enabled\n renderer.xr.enabled = false\n\n // Copy inputBuffer to outputBuffer\n //renderer.setRenderTarget(outputBuffer);\n // this.copyQuad.material.uniforms.tDiffuse.value = inputBuffer.texture;\n // this.copyQuad.render(renderer);\n\n if (renderer.capabilities.logarithmicDepthBuffer !== this.configuration.logarithmicDepthBuffer) {\n this.configuration.logarithmicDepthBuffer = renderer.capabilities.logarithmicDepthBuffer\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (inputBuffer.texture.type !== this.outputTargetInternal.texture.type) {\n this.outputTargetInternal.texture.type = inputBuffer.texture.type\n this.outputTargetInternal.texture.needsUpdate = true\n }\n let gl\n let ext\n let timerQuery\n if (this.debugMode) {\n gl = renderer.getContext()\n ext = gl.getExtension('EXT_disjoint_timer_query_webgl2')\n if (ext === null) {\n console.error('EXT_disjoint_timer_query_webgl2 not available, disabling debug mode.')\n this.debugMode = false\n }\n }\n if (this.debugMode) {\n timerQuery = gl.createQuery()\n gl.beginQuery(ext.TIME_ELAPSED_EXT, timerQuery)\n }\n this.camera.updateMatrixWorld()\n this._r.set(this.width, this.height)\n let trueRadius = this.configuration.aoRadius\n if (this.configuration.halfRes && this.configuration.screenSpaceRadius) {\n trueRadius *= 0.5\n }\n if (this.configuration.halfRes) {\n renderer.setRenderTarget(this.depthDownsampleTarget)\n this.depthDownsampleQuad.material.uniforms.sceneDepth.value = this.depthTexture\n this.depthDownsampleQuad.material.uniforms.resolution.value = this._r\n this.depthDownsampleQuad.material.uniforms['near'].value = this.camera.near\n this.depthDownsampleQuad.material.uniforms['far'].value = this.camera.far\n this.depthDownsampleQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.depthDownsampleQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.depthDownsampleQuad.material.uniforms['logDepth'].value = this.configuration.logarithmicDepthBuffer\n this.depthDownsampleQuad.render(renderer)\n }\n this.effectShaderQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectShaderQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectShaderQuad.material.uniforms['sceneNormal'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[1]\n : null\n this.effectShaderQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.effectShaderQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.effectShaderQuad.material.uniforms['projViewMat'].value = this.camera.projectionMatrix\n .clone()\n .multiply(this.camera.matrixWorldInverse.clone())\n this.effectShaderQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectShaderQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectShaderQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectShaderQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.effectShaderQuad.material.uniforms['time'].value = performance.now() / 1000\n this.effectShaderQuad.material.uniforms['samples'].value = this.samples\n this.effectShaderQuad.material.uniforms['samplesR'].value = this.samplesR\n this.effectShaderQuad.material.uniforms['bluenoise'].value = this.bluenoise\n this.effectShaderQuad.material.uniforms['radius'].value = trueRadius\n this.effectShaderQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectShaderQuad.material.uniforms['near'].value = this.camera.near\n this.effectShaderQuad.material.uniforms['far'].value = this.camera.far\n this.effectShaderQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectShaderQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectShaderQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n // Start the AO\n renderer.setRenderTarget(this.writeTargetInternal)\n this.effectShaderQuad.render(renderer)\n // End the AO\n // Start the blur\n for (let i = 0; i < this.configuration.denoiseIterations; i++) {\n ;[this.writeTargetInternal, this.readTargetInternal] = [this.readTargetInternal, this.writeTargetInternal]\n this.poissonBlurQuad.material.uniforms['tDiffuse'].value = this.readTargetInternal.texture\n this.poissonBlurQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.poissonBlurQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.poissonBlurQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.poissonBlurQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.poissonBlurQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.poissonBlurQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.poissonBlurQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.poissonBlurQuad.material.uniforms['time'].value = performance.now() / 1000\n this.poissonBlurQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.poissonBlurQuad.material.uniforms['radius'].value =\n this.configuration.denoiseRadius * (this.configuration.halfRes ? 1 / 2 : 1)\n this.poissonBlurQuad.material.uniforms['worldRadius'].value = trueRadius\n this.poissonBlurQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.poissonBlurQuad.material.uniforms['index'].value = i\n this.poissonBlurQuad.material.uniforms['poissonDisk'].value = this.samplesDenoise\n this.poissonBlurQuad.material.uniforms['near'].value = this.camera.near\n this.poissonBlurQuad.material.uniforms['far'].value = this.camera.far\n this.poissonBlurQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.poissonBlurQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n renderer.setRenderTarget(this.writeTargetInternal)\n this.poissonBlurQuad.render(renderer)\n }\n // Now, we have the blurred AO in writeTargetInternal\n // End the blur\n // Start the composition\n this.effectCompositerQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectCompositerQuad.material.uniforms['sceneDepth'].value = this.depthTexture\n this.effectCompositerQuad.material.uniforms['near'].value = this.camera.near\n this.effectCompositerQuad.material.uniforms['far'].value = this.camera.far\n this.effectCompositerQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectCompositerQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectCompositerQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectCompositerQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectCompositerQuad.material.uniforms['downsampledDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectCompositerQuad.material.uniforms['resolution'].value = this._r\n this.effectCompositerQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.effectCompositerQuad.material.uniforms['intensity'].value = this.configuration.intensity\n this.effectCompositerQuad.material.uniforms['renderMode'].value = this.configuration.renderMode\n this.effectCompositerQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n this.effectCompositerQuad.material.uniforms['radius'].value = trueRadius\n this.effectCompositerQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectCompositerQuad.material.uniforms['gammaCorrection'].value = this.autosetGamma\n ? this.renderToScreen\n : this.configuration.gammaCorrection\n this.effectCompositerQuad.material.uniforms['tDiffuse'].value = this.writeTargetInternal.texture\n this.effectCompositerQuad.material.uniforms['color'].value = this._c\n .copy(this.configuration.color)\n .convertSRGBToLinear()\n this.effectCompositerQuad.material.uniforms['colorMultiply'].value = this.configuration.colorMultiply\n this.effectCompositerQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectCompositerQuad.material.uniforms['fog'].value = !!this.scene.fog\n if (this.scene.fog) {\n if (this.scene.fog.isFog) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = false\n this.effectCompositerQuad.material.uniforms['fogNear'].value = this.scene.fog.near\n this.effectCompositerQuad.material.uniforms['fogFar'].value = this.scene.fog.far\n } else if (this.scene.fog.isFogExp2) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = true\n this.effectCompositerQuad.material.uniforms['fogDensity'].value = this.scene.fog.density\n } else {\n console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)\n }\n }\n renderer.setRenderTarget(\n /* this.renderToScreen ? null :\n outputBuffer*/\n this.outputTargetInternal\n )\n this.effectCompositerQuad.render(renderer)\n renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer)\n this.copyQuad.material.uniforms['tDiffuse'].value = this.outputTargetInternal.texture\n this.copyQuad.render(renderer)\n if (this.debugMode) {\n gl.endQuery(ext.TIME_ELAPSED_EXT)\n checkTimerQuery(timerQuery, gl, this)\n }\n\n renderer.xr.enabled = xrEnabled\n }\n /**\n * Enables the debug mode of the AO, meaning the lastTime value will be updated.\n */\n enableDebugMode() {\n this.debugMode = true\n }\n /**\n * Disables the debug mode of the AO, meaning the lastTime value will not be updated.\n */\n disableDebugMode() {\n this.debugMode = false\n }\n /**\n * Sets the display mode of the AO\n * @param {\"Combined\" | \"AO\" | \"No AO\" | \"Split\" | \"Split AO\"} mode - The display mode.\n */\n setDisplayMode(mode) {\n this.configuration.renderMode = ['Combined', 'AO', 'No AO', 'Split', 'Split AO'].indexOf(mode)\n }\n /**\n *\n * @param {\"Performance\" | \"Low\" | \"Medium\" | \"High\" | \"Ultra\"} mode\n */\n setQualityMode(mode) {\n if (mode === 'Performance') {\n this.configuration.aoSamples = 8\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Low') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Medium') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 12\n } else if (mode === 'High') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 6\n } else if (mode === 'Ultra') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 16\n this.configuration.denoiseRadius = 6\n }\n }\n}\nexport { N8AOPostPass }\n"],"names":[],"mappings":";;;;;;;;;AAUA,MAAM,gBAAgB,OAAO,KAAK,WAAW,QAAQ;AAQrD,SAAS,gBAAgB,YAAY,IAAI,MAAM;AAC7C,QAAM,YAAY,GAAG,kBAAkB,YAAY,GAAG,sBAAsB;AAC5E,MAAI,WAAW;AACb,UAAM,kBAAkB,GAAG,kBAAkB,YAAY,GAAG,YAAY;AACxE,UAAM,kBAAkB,kBAAkB;AAC1C,SAAK,WAAW;AAAA,EACpB,OAAS;AAEL,eAAW,MAAM;AACf,sBAAgB,YAAY,IAAI,IAAI;AAAA,IACrC,GAAE,CAAC;AAAA,EACL;AACH;AACA,MAAM,qBAAqB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YAAY,OAAO,QAAQ,QAAQ,KAAK,SAAS,KAAK;AACpD,UAAO;AACP,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,QAAQ;AAEb,SAAK,SAAS;AACd,SAAK,QAAQ;AAoBb,SAAK,eAAe;AACpB,SAAK,gBAAgB,IAAI;AAAA,MACvB;AAAA,QACE,WAAW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I,gBAAgB;AAChC,sBAAgB,YAAY,IAAI,IAAI;AAAA,IACrC;AAED,aAAS,GAAG,UAAU;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA,EAID,kBAAkB;AAChB,SAAK,YAAY;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAID,mBAAmB;AACjB,SAAK,YAAY;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,SAAK,cAAc,aAAa,CAAC,YAAY,MAAM,SAAS,SAAS,UAAU,EAAE,QAAQ,IAAI;AAAA,EAC9F;AAAA;AAAA;AAAA;AAAA;AAAA,EAKD,eAAe,MAAM;AACnB,QAAI,SAAS,eAAe;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,OAAO;AACzB,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,UAAU;AAC5B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,QAAQ;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,SAAS;AAC3B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACpC;AAAA,EACF;AACH;"}
1
+ {"version":3,"file":"N8AOPostPass.js","sources":["../../../src/effects/N8AO/N8AOPostPass.js"],"sourcesContent":["import * as THREE from 'three'\nimport { Pass } from 'postprocessing'\nimport { Buffer } from 'buffer'\nimport { FullScreenTriangle } from './FullScreenTriangle'\nimport { EffectShader } from './EffectShader'\nimport { EffectCompositer } from './EffectCompositer'\nimport { PoissionBlur } from './PoissionBlur'\nimport { DepthDownSample } from './DepthDownSample'\nimport BlueNoise from './BlueNoise'\nimport { WebGLMultipleRenderTargets } from '../../compat'\n\nconst bluenoiseBits = Buffer.from(BlueNoise, 'base64')\n\n/**\n *\n * @param {*} timerQuery\n * @param {THREE.WebGLRenderer} gl\n * @param {N8AOPass} pass\n */\nfunction checkTimerQuery(timerQuery, gl, pass) {\n const available = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT_AVAILABLE)\n if (available) {\n const elapsedTimeInNs = gl.getQueryParameter(timerQuery, gl.QUERY_RESULT)\n const elapsedTimeInMs = elapsedTimeInNs / 1000000\n pass.lastTime = elapsedTimeInMs\n } else {\n // If the result is not available yet, check again after a delay\n setTimeout(() => {\n checkTimerQuery(timerQuery, gl, pass)\n }, 1)\n }\n}\nclass N8AOPostPass extends Pass {\n /**\n *\n * @param {THREE.Scene} scene\n * @param {THREE.Camera} camera\n * @param {number} width\n * @param {number} height\n *\n * @property {THREE.Scene} scene\n * @property {THREE.Camera} camera\n * @property {number} width\n * @property {number} height\n */\n constructor(scene, camera, width = 512, height = 512) {\n super()\n this.width = width\n this.height = height\n\n this.clear = true\n\n this.camera = camera\n this.scene = scene\n /**\n * @type {Proxy & {\n * aoSamples: number,\n * aoRadius: number,\n * denoiseSamples: number,\n * denoiseRadius: number,\n * distanceFalloff: number,\n * intensity: number,\n * denoiseIterations: number,\n * renderMode: 0 | 1 | 2 | 3 | 4,\n * color: THREE.Color,\n * gammaCorrection: boolean,\n * logarithmicDepthBuffer: boolean\n * screenSpaceRadius: boolean,\n * halfRes: boolean,\n * depthAwareUpsampling: boolean\n * colorMultiply: boolean\n * }\n */\n this.autosetGamma = true\n this.configuration = new Proxy(\n {\n aoSamples: 16,\n aoRadius: 5.0,\n denoiseSamples: 8,\n denoiseRadius: 12,\n distanceFalloff: 1.0,\n intensity: 5,\n denoiseIterations: 2.0,\n renderMode: 0,\n color: new THREE.Color(0, 0, 0),\n gammaCorrection: true,\n logarithmicDepthBuffer: false,\n screenSpaceRadius: false,\n halfRes: false,\n depthAwareUpsampling: true,\n colorMultiply: true,\n },\n {\n set: (target, propName, value) => {\n const oldProp = target[propName]\n target[propName] = value\n if (propName === 'aoSamples' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'denoiseSamples' && oldProp !== value) {\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'halfRes' && oldProp !== value) {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureHalfResTargets()\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.setSize(this.width, this.height)\n }\n if (propName === 'depthAwareUpsampling' && oldProp !== value) {\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (propName === 'gammaCorrection') {\n this.autosetGamma = false\n }\n return true\n },\n }\n )\n /** @type {THREE.Vector3[]} */\n this.samples = []\n /** @type {number[]} */\n this.samplesR = []\n /** @type {THREE.Vector2[]} */\n this.samplesDenoise = []\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n this.configureSampleDependentPasses()\n this.configureHalfResTargets()\n // this.effectCompisterQuad = new FullScreenTriangle(new THREE.ShaderMaterial(EffectCompositer));\n this.copyQuad = new FullScreenTriangle(\n new THREE.ShaderMaterial({\n uniforms: {\n tDiffuse: {\n value: null,\n },\n },\n depthWrite: false,\n vertexShader: `\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }\n `,\n fragmentShader: `\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n gl_FragColor = texture2D(tDiffuse, vUv);\n }\n `,\n })\n )\n this.writeTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.readTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n this.outputTargetInternal = new THREE.WebGLRenderTarget(this.width, this.height, {\n minFilter: THREE.LinearFilter,\n magFilter: THREE.LinearFilter,\n depthBuffer: false,\n })\n\n /** @type {THREE.DataTexture} */\n this.bluenoise = //bluenoise;\n new THREE.DataTexture(bluenoiseBits, 128, 128)\n this.bluenoise.colorSpace = THREE.NoColorSpace\n this.bluenoise.wrapS = THREE.RepeatWrapping\n this.bluenoise.wrapT = THREE.RepeatWrapping\n this.bluenoise.minFilter = THREE.NearestFilter\n this.bluenoise.magFilter = THREE.NearestFilter\n this.bluenoise.needsUpdate = true\n this.lastTime = 0\n this.needsDepthTexture = true\n this.needsSwap = true\n this._r = new THREE.Vector2()\n this._c = new THREE.Color()\n }\n configureHalfResTargets() {\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget =\n /*new THREE.WebGLRenderTarget(this.width / 2, this.height / 2, {\n minFilter: THREE.NearestFilter,\n magFilter: THREE.NearestFilter,\n depthBuffer: false,\n format: THREE.RedFormat,\n type: THREE.FloatType\n });*/\n new WebGLMultipleRenderTargets(this.width / 2, this.height / 2, 2)\n this.depthDownsampleTarget.texture[0].format = THREE.RedFormat\n this.depthDownsampleTarget.texture[0].type = THREE.FloatType\n this.depthDownsampleTarget.texture[0].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[0].depthBuffer = false\n this.depthDownsampleTarget.texture[1].format = THREE.RGBAFormat\n this.depthDownsampleTarget.texture[1].type = THREE.HalfFloatType\n this.depthDownsampleTarget.texture[1].minFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].magFilter = THREE.NearestFilter\n this.depthDownsampleTarget.texture[1].depthBuffer = false\n\n this.depthDownsampleQuad = new FullScreenTriangle(new THREE.ShaderMaterial(DepthDownSample))\n } else {\n if (this.depthDownsampleTarget) {\n this.depthDownsampleTarget.dispose()\n this.depthDownsampleTarget = null\n }\n if (this.depthDownsampleQuad) {\n this.depthDownsampleQuad.dispose()\n this.depthDownsampleQuad = null\n }\n }\n }\n configureSampleDependentPasses() {\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n }\n configureAOPass(logarithmicDepthBuffer = false) {\n this.samples = this.generateHemisphereSamples(this.configuration.aoSamples)\n this.samplesR = this.generateHemisphereSamplesR(this.configuration.aoSamples)\n const e = { ...EffectShader }\n e.fragmentShader = e.fragmentShader\n .replace('16', this.configuration.aoSamples)\n .replace('16.0', this.configuration.aoSamples + '.0')\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectShaderQuad) {\n this.effectShaderQuad.material.dispose()\n this.effectShaderQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectShaderQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n configureDenoisePass(logarithmicDepthBuffer = false) {\n this.samplesDenoise = this.generateDenoiseSamples(this.configuration.denoiseSamples, 11)\n const p = { ...PoissionBlur }\n p.fragmentShader = p.fragmentShader.replace('16', this.configuration.denoiseSamples)\n if (logarithmicDepthBuffer) {\n p.fragmentShader = '#define LOGDEPTH\\n' + p.fragmentShader\n }\n if (this.poissonBlurQuad) {\n this.poissonBlurQuad.material.dispose()\n this.poissonBlurQuad.material = new THREE.ShaderMaterial(p)\n } else {\n this.poissonBlurQuad = new FullScreenTriangle(new THREE.ShaderMaterial(p))\n }\n }\n configureEffectCompositer(logarithmicDepthBuffer = false) {\n const e = { ...EffectCompositer }\n if (logarithmicDepthBuffer) {\n e.fragmentShader = '#define LOGDEPTH\\n' + e.fragmentShader\n }\n if (this.configuration.halfRes && this.configuration.depthAwareUpsampling) {\n e.fragmentShader = '#define HALFRES\\n' + e.fragmentShader\n }\n if (this.effectCompositerQuad) {\n this.effectCompositerQuad.material.dispose()\n this.effectCompositerQuad.material = new THREE.ShaderMaterial(e)\n } else {\n this.effectCompositerQuad = new FullScreenTriangle(new THREE.ShaderMaterial(e))\n }\n }\n /**\n *\n * @param {Number} n\n * @returns {THREE.Vector3[]}\n */\n generateHemisphereSamples(n) {\n const points = []\n for (let k = 0; k < n; k++) {\n const theta = 2.399963 * k\n const r = Math.sqrt(k + 0.5) / Math.sqrt(n)\n const x = r * Math.cos(theta)\n const y = r * Math.sin(theta)\n // Project to hemisphere\n const z = Math.sqrt(1 - (x * x + y * y))\n points.push(new THREE.Vector3(x, y, z))\n }\n return points\n }\n /**\n *\n * @param {number} n\n * @returns {number[]}\n */\n generateHemisphereSamplesR(n) {\n let samplesR = []\n for (let i = 0; i < n; i++) {\n samplesR.push((i + 1) / n)\n }\n return samplesR\n }\n /**\n *\n * @param {number} numSamples\n * @param {number} numRings\n * @returns {THREE.Vector2[]}\n */\n generateDenoiseSamples(numSamples, numRings) {\n const angleStep = (2 * Math.PI * numRings) / numSamples\n const invNumSamples = 1.0 / numSamples\n const radiusStep = invNumSamples\n const samples = []\n let radius = invNumSamples\n let angle = 0\n for (let i = 0; i < numSamples; i++) {\n samples.push(new THREE.Vector2(Math.cos(angle), Math.sin(angle)).multiplyScalar(Math.pow(radius, 0.75)))\n radius += radiusStep\n angle += angleStep\n }\n return samples\n }\n setSize(width, height) {\n this.width = width\n this.height = height\n const c = this.configuration.halfRes ? 0.5 : 1\n this.writeTargetInternal.setSize(width * c, height * c)\n this.readTargetInternal.setSize(width * c, height * c)\n if (this.configuration.halfRes) {\n this.depthDownsampleTarget.setSize(width * c, height * c)\n }\n this.outputTargetInternal.setSize(width, height)\n }\n setDepthTexture(depthTexture) {\n this.depthTexture = depthTexture\n }\n render(renderer, inputBuffer, outputBuffer) {\n const xrEnabled = renderer.xr.enabled\n renderer.xr.enabled = false\n\n // Copy inputBuffer to outputBuffer\n //renderer.setRenderTarget(outputBuffer);\n // this.copyQuad.material.uniforms.tDiffuse.value = inputBuffer.texture;\n // this.copyQuad.render(renderer);\n\n if (renderer.capabilities.logarithmicDepthBuffer !== this.configuration.logarithmicDepthBuffer) {\n this.configuration.logarithmicDepthBuffer = renderer.capabilities.logarithmicDepthBuffer\n this.configureAOPass(this.configuration.logarithmicDepthBuffer)\n this.configureDenoisePass(this.configuration.logarithmicDepthBuffer)\n this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)\n }\n if (inputBuffer.texture.type !== this.outputTargetInternal.texture.type) {\n this.outputTargetInternal.texture.type = inputBuffer.texture.type\n this.outputTargetInternal.texture.needsUpdate = true\n }\n let gl\n let ext\n let timerQuery\n if (this.debugMode) {\n gl = renderer.getContext()\n ext = gl.getExtension('EXT_disjoint_timer_query_webgl2')\n if (ext === null) {\n console.error('EXT_disjoint_timer_query_webgl2 not available, disabling debug mode.')\n this.debugMode = false\n }\n }\n if (this.debugMode) {\n timerQuery = gl.createQuery()\n gl.beginQuery(ext.TIME_ELAPSED_EXT, timerQuery)\n }\n this.camera.updateMatrixWorld()\n this._r.set(this.width, this.height)\n let trueRadius = this.configuration.aoRadius\n if (this.configuration.halfRes && this.configuration.screenSpaceRadius) {\n trueRadius *= 0.5\n }\n if (this.configuration.halfRes) {\n renderer.setRenderTarget(this.depthDownsampleTarget)\n this.depthDownsampleQuad.material.uniforms.sceneDepth.value = this.depthTexture\n this.depthDownsampleQuad.material.uniforms.resolution.value = this._r\n this.depthDownsampleQuad.material.uniforms['near'].value = this.camera.near\n this.depthDownsampleQuad.material.uniforms['far'].value = this.camera.far\n this.depthDownsampleQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.depthDownsampleQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.depthDownsampleQuad.material.uniforms['logDepth'].value = this.configuration.logarithmicDepthBuffer\n this.depthDownsampleQuad.render(renderer)\n }\n this.effectShaderQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectShaderQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectShaderQuad.material.uniforms['sceneNormal'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[1]\n : null\n this.effectShaderQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.effectShaderQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.effectShaderQuad.material.uniforms['projViewMat'].value = this.camera.projectionMatrix\n .clone()\n .multiply(this.camera.matrixWorldInverse.clone())\n this.effectShaderQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectShaderQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectShaderQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectShaderQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.effectShaderQuad.material.uniforms['time'].value = performance.now() / 1000\n this.effectShaderQuad.material.uniforms['samples'].value = this.samples\n this.effectShaderQuad.material.uniforms['samplesR'].value = this.samplesR\n this.effectShaderQuad.material.uniforms['bluenoise'].value = this.bluenoise\n this.effectShaderQuad.material.uniforms['radius'].value = trueRadius\n this.effectShaderQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectShaderQuad.material.uniforms['near'].value = this.camera.near\n this.effectShaderQuad.material.uniforms['far'].value = this.camera.far\n this.effectShaderQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectShaderQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectShaderQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n // Start the AO\n renderer.setRenderTarget(this.writeTargetInternal)\n this.effectShaderQuad.render(renderer)\n // End the AO\n // Start the blur\n for (let i = 0; i < this.configuration.denoiseIterations; i++) {\n ;[this.writeTargetInternal, this.readTargetInternal] = [this.readTargetInternal, this.writeTargetInternal]\n this.poissonBlurQuad.material.uniforms['tDiffuse'].value = this.readTargetInternal.texture\n this.poissonBlurQuad.material.uniforms['sceneDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.poissonBlurQuad.material.uniforms['projMat'].value = this.camera.projectionMatrix\n this.poissonBlurQuad.material.uniforms['viewMat'].value = this.camera.matrixWorldInverse\n this.poissonBlurQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.poissonBlurQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.poissonBlurQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.poissonBlurQuad.material.uniforms['resolution'].value = this.configuration.halfRes\n ? this._r\n .clone()\n .multiplyScalar(1 / 2)\n .floor()\n : this._r\n this.poissonBlurQuad.material.uniforms['time'].value = performance.now() / 1000\n this.poissonBlurQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.poissonBlurQuad.material.uniforms['radius'].value =\n this.configuration.denoiseRadius * (this.configuration.halfRes ? 1 / 2 : 1)\n this.poissonBlurQuad.material.uniforms['worldRadius'].value = trueRadius\n this.poissonBlurQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.poissonBlurQuad.material.uniforms['index'].value = i\n this.poissonBlurQuad.material.uniforms['poissonDisk'].value = this.samplesDenoise\n this.poissonBlurQuad.material.uniforms['near'].value = this.camera.near\n this.poissonBlurQuad.material.uniforms['far'].value = this.camera.far\n this.poissonBlurQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.poissonBlurQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n renderer.setRenderTarget(this.writeTargetInternal)\n this.poissonBlurQuad.render(renderer)\n }\n // Now, we have the blurred AO in writeTargetInternal\n // End the blur\n // Start the composition\n this.effectCompositerQuad.material.uniforms['sceneDiffuse'].value = inputBuffer.texture\n this.effectCompositerQuad.material.uniforms['sceneDepth'].value = this.depthTexture\n this.effectCompositerQuad.material.uniforms['near'].value = this.camera.near\n this.effectCompositerQuad.material.uniforms['far'].value = this.camera.far\n this.effectCompositerQuad.material.uniforms['projectionMatrixInv'].value = this.camera.projectionMatrixInverse\n this.effectCompositerQuad.material.uniforms['viewMatrixInv'].value = this.camera.matrixWorld\n this.effectCompositerQuad.material.uniforms['logDepth'].value = renderer.capabilities.logarithmicDepthBuffer\n this.effectCompositerQuad.material.uniforms['ortho'].value = this.camera.isOrthographicCamera\n this.effectCompositerQuad.material.uniforms['downsampledDepth'].value = this.configuration.halfRes\n ? this.depthDownsampleTarget.texture[0]\n : this.depthTexture\n this.effectCompositerQuad.material.uniforms['resolution'].value = this._r\n this.effectCompositerQuad.material.uniforms['blueNoise'].value = this.bluenoise\n this.effectCompositerQuad.material.uniforms['intensity'].value = this.configuration.intensity\n this.effectCompositerQuad.material.uniforms['renderMode'].value = this.configuration.renderMode\n this.effectCompositerQuad.material.uniforms['screenSpaceRadius'].value = this.configuration.screenSpaceRadius\n this.effectCompositerQuad.material.uniforms['radius'].value = trueRadius\n this.effectCompositerQuad.material.uniforms['distanceFalloff'].value = this.configuration.distanceFalloff\n this.effectCompositerQuad.material.uniforms['gammaCorrection'].value = this.autosetGamma\n ? this.renderToScreen\n : this.configuration.gammaCorrection\n this.effectCompositerQuad.material.uniforms['tDiffuse'].value = this.writeTargetInternal.texture\n this.effectCompositerQuad.material.uniforms['color'].value = this._c\n .copy(this.configuration.color)\n .convertSRGBToLinear()\n this.effectCompositerQuad.material.uniforms['colorMultiply'].value = this.configuration.colorMultiply\n this.effectCompositerQuad.material.uniforms['cameraPos'].value = this.camera.getWorldPosition(new THREE.Vector3())\n this.effectCompositerQuad.material.uniforms['fog'].value = !!this.scene.fog\n if (this.scene.fog) {\n if (this.scene.fog.isFog) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = false\n this.effectCompositerQuad.material.uniforms['fogNear'].value = this.scene.fog.near\n this.effectCompositerQuad.material.uniforms['fogFar'].value = this.scene.fog.far\n } else if (this.scene.fog.isFogExp2) {\n this.effectCompositerQuad.material.uniforms['fogExp'].value = true\n this.effectCompositerQuad.material.uniforms['fogDensity'].value = this.scene.fog.density\n } else {\n console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)\n }\n }\n renderer.setRenderTarget(\n /* this.renderToScreen ? null :\n outputBuffer*/\n this.outputTargetInternal\n )\n this.effectCompositerQuad.render(renderer)\n renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer)\n this.copyQuad.material.uniforms['tDiffuse'].value = this.outputTargetInternal.texture\n this.copyQuad.render(renderer)\n if (this.debugMode) {\n gl.endQuery(ext.TIME_ELAPSED_EXT)\n checkTimerQuery(timerQuery, gl, this)\n }\n\n renderer.xr.enabled = xrEnabled\n }\n /**\n * Enables the debug mode of the AO, meaning the lastTime value will be updated.\n */\n enableDebugMode() {\n this.debugMode = true\n }\n /**\n * Disables the debug mode of the AO, meaning the lastTime value will not be updated.\n */\n disableDebugMode() {\n this.debugMode = false\n }\n /**\n * Sets the display mode of the AO\n * @param {\"Combined\" | \"AO\" | \"No AO\" | \"Split\" | \"Split AO\"} mode - The display mode.\n */\n setDisplayMode(mode) {\n this.configuration.renderMode = ['Combined', 'AO', 'No AO', 'Split', 'Split AO'].indexOf(mode)\n }\n /**\n *\n * @param {\"Performance\" | \"Low\" | \"Medium\" | \"High\" | \"Ultra\"} mode\n */\n setQualityMode(mode) {\n if (mode === 'Performance') {\n this.configuration.aoSamples = 8\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Low') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 4\n this.configuration.denoiseRadius = 12\n } else if (mode === 'Medium') {\n this.configuration.aoSamples = 16\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 12\n } else if (mode === 'High') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 8\n this.configuration.denoiseRadius = 6\n } else if (mode === 'Ultra') {\n this.configuration.aoSamples = 64\n this.configuration.denoiseSamples = 16\n this.configuration.denoiseRadius = 6\n }\n }\n}\nexport { N8AOPostPass }\n"],"names":[],"mappings":";;;;;;;;;;AAWA,MAAM,gBAAgB,OAAO,KAAK,WAAW,QAAQ;AAQrD,SAAS,gBAAgB,YAAY,IAAI,MAAM;AAC7C,QAAM,YAAY,GAAG,kBAAkB,YAAY,GAAG,sBAAsB;AAC5E,MAAI,WAAW;AACb,UAAM,kBAAkB,GAAG,kBAAkB,YAAY,GAAG,YAAY;AACxE,UAAM,kBAAkB,kBAAkB;AAC1C,SAAK,WAAW;AAAA,EACpB,OAAS;AAEL,eAAW,MAAM;AACf,sBAAgB,YAAY,IAAI,IAAI;AAAA,IACrC,GAAE,CAAC;AAAA,EACL;AACH;AACA,MAAM,qBAAqB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa9B,YAAY,OAAO,QAAQ,QAAQ,KAAK,SAAS,KAAK;AACpD,UAAO;AACP,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,QAAQ;AAEb,SAAK,SAAS;AACd,SAAK,QAAQ;AAoBb,SAAK,eAAe;AACpB,SAAK,gBAAgB,IAAI;AAAA,MACvB;AAAA,QACE,WAAW;AAAA,QACX,UAAU;AAAA,QACV,gBAAgB;AAAA,QAChB,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,mBAAmB;AAAA,QACnB,YAAY;AAAA,QACZ,OAAO,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC;AAAA,QAC9B,iBAAiB;AAAA,QACjB,wBAAwB;AAAA,QACxB,mBAAmB;AAAA,QACnB,SAAS;AAAA,QACT,sBAAsB;AAAA,QACtB,eAAe;AAAA,MAChB;AAAA,MACD;AAAA,QACE,KAAK,CAAC,QAAQ,UAAU,UAAU;AAChC,gBAAM,UAAU,OAAO,QAAQ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Ae,MAAM;AACnB,QAAI,SAAS,eAAe;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,OAAO;AACzB,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,UAAU;AAC5B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,QAAQ;AAC1B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACzC,WAAe,SAAS,SAAS;AAC3B,WAAK,cAAc,YAAY;AAC/B,WAAK,cAAc,iBAAiB;AACpC,WAAK,cAAc,gBAAgB;AAAA,IACpC;AAAA,EACF;AACH;"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const postprocessing = require("postprocessing");
4
4
  const THREE = require("three");
5
+ const compat = require("../../compat.cjs");
5
6
  const boxBlur = (
6
7
  /* glsl */
7
8
  `
@@ -663,7 +664,7 @@ class ReflectionsPass extends postprocessing.Pass {
663
664
  this.renderPass = new postprocessing.RenderPass(this._scene, this._camera);
664
665
  this.USE_MRT = isWebGL2Available();
665
666
  if (this.USE_MRT) {
666
- this.gBuffersRenderTarget = new THREE.WebGLMultipleRenderTargets(width, height, 2, {
667
+ this.gBuffersRenderTarget = new compat.WebGLMultipleRenderTargets(width, height, 2, {
667
668
  minFilter: THREE.LinearFilter,
668
669
  magFilter: THREE.LinearFilter
669
670
  });