@woosh/meep-engine 2.116.0 → 2.116.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +60 -33
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +60 -33
- package/package.json +1 -1
- package/src/core/collection/array/array_replace_all.d.ts +2 -1
- package/src/core/collection/array/array_replace_all.d.ts.map +1 -1
- package/src/core/collection/array/array_replace_all.js +3 -0
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +4 -7
- package/src/core/collection/set/ArraySet.d.ts.map +1 -1
- package/src/core/collection/set/ArraySet.js +11 -1
- package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
- package/src/core/math/physics/brdf/brdf_burley.js +3 -14
- package/src/core/math/physics/bsdf/bsdf_schlick.js +1 -1
- package/src/core/math/physics/pdf/pdf_normal.d.ts +8 -0
- package/src/core/math/physics/pdf/pdf_normal.d.ts.map +1 -0
- package/src/core/math/physics/pdf/pdf_normal.js +11 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -1
- package/src/core/math/physics/reflectivity_to_ior.js +3 -1
- package/src/core/primitives/strings/computeStringHash.d.ts +9 -1
- package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
- package/src/core/primitives/strings/computeStringHash.js +10 -5
- package/src/engine/graphics/sh3/gi/material/common.glsl +3 -2
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -3
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -3
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +16 -12
- package/src/engine/graphics/shaders/DenoiseShader.d.ts.map +1 -1
- package/src/engine/graphics/shaders/DenoiseShader.js +3 -12
- package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputBinding.js +3 -2
- package/src/engine/input/ecs/components/InputController.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputController.js +18 -1
- package/src/engine/input/ecs/controllers/KeyboardCameraController.js +9 -9
package/build/meep.module.js
CHANGED
|
@@ -50988,9 +50988,11 @@ class Vector4 {
|
|
|
50988
50988
|
/**
|
|
50989
50989
|
*
|
|
50990
50990
|
* @param {string|null|undefined} string
|
|
50991
|
+
* @param {number} [start]
|
|
50992
|
+
* @param {number} [length] how many characters to hash, defaults to full string length
|
|
50991
50993
|
* @returns {number}
|
|
50992
50994
|
*/
|
|
50993
|
-
function computeStringHash(string) {
|
|
50995
|
+
function computeStringHash(string, start, length) {
|
|
50994
50996
|
if (string === null) {
|
|
50995
50997
|
return 0;
|
|
50996
50998
|
}
|
|
@@ -50999,11 +51001,14 @@ function computeStringHash(string) {
|
|
|
50999
51001
|
return 1;
|
|
51000
51002
|
}
|
|
51001
51003
|
|
|
51002
|
-
|
|
51004
|
+
let _start = start ?? 0;
|
|
51005
|
+
let _length = length ?? string.length - _start;
|
|
51003
51006
|
|
|
51004
|
-
let hash =
|
|
51007
|
+
let hash = _length;
|
|
51005
51008
|
|
|
51006
|
-
|
|
51009
|
+
const end = _start + _length;
|
|
51010
|
+
|
|
51011
|
+
for (let i = _start; i < end; i++) {
|
|
51007
51012
|
const code_point = string.charCodeAt(i);
|
|
51008
51013
|
|
|
51009
51014
|
/*
|
|
@@ -59530,6 +59535,26 @@ const AmbientOcclusionShader = function () {
|
|
|
59530
59535
|
}
|
|
59531
59536
|
};
|
|
59532
59537
|
|
|
59538
|
+
/**
|
|
59539
|
+
*
|
|
59540
|
+
* @param {number} sigma distance from mean
|
|
59541
|
+
* @param {number} v Variance
|
|
59542
|
+
* @returns {number}
|
|
59543
|
+
*/
|
|
59544
|
+
function gaussian$1(sigma, v) {
|
|
59545
|
+
return Math.exp(-(v * v) / (2 * sigma * sigma));
|
|
59546
|
+
}
|
|
59547
|
+
|
|
59548
|
+
/**
|
|
59549
|
+
* Normal Probability Distribution Function
|
|
59550
|
+
* @param {number} x
|
|
59551
|
+
* @param {number} sigma
|
|
59552
|
+
* @return {number}
|
|
59553
|
+
*/
|
|
59554
|
+
function pdf_normal(x, sigma) {
|
|
59555
|
+
return 0.39894 * gaussian$1(sigma, x) / sigma;
|
|
59556
|
+
}
|
|
59557
|
+
|
|
59533
59558
|
const KERNEL_SIZE = 15;
|
|
59534
59559
|
|
|
59535
59560
|
const fragment$1 = `
|
|
@@ -59589,16 +59614,6 @@ void main(void) {
|
|
|
59589
59614
|
}
|
|
59590
59615
|
`;
|
|
59591
59616
|
|
|
59592
|
-
/**
|
|
59593
|
-
* Normal Probability Distribution Function
|
|
59594
|
-
* @param {number} x
|
|
59595
|
-
* @param {number} sigma
|
|
59596
|
-
* @return {number}
|
|
59597
|
-
*/
|
|
59598
|
-
function normpdf(x, sigma) {
|
|
59599
|
-
return 0.39894 * Math.exp(-0.5 * x * x / (sigma * sigma)) / sigma;
|
|
59600
|
-
}
|
|
59601
|
-
|
|
59602
59617
|
/**
|
|
59603
59618
|
*
|
|
59604
59619
|
* @param {number} sigma
|
|
@@ -59607,13 +59622,13 @@ function normpdf(x, sigma) {
|
|
|
59607
59622
|
*/
|
|
59608
59623
|
function DenoiseShader(sigma = 10, filterSmoothness = 0.2) {
|
|
59609
59624
|
// compute zNorm
|
|
59610
|
-
const zNorm = 1 /
|
|
59625
|
+
const zNorm = 1 / pdf_normal(0, filterSmoothness);
|
|
59611
59626
|
|
|
59612
59627
|
// build kernel
|
|
59613
59628
|
const kernel = new Float32Array(KERNEL_SIZE);
|
|
59614
59629
|
const kSize = Math.floor((KERNEL_SIZE - 1) / 2);
|
|
59615
59630
|
for (let i = 0; i <= kSize; i++) {
|
|
59616
|
-
const v =
|
|
59631
|
+
const v = pdf_normal(i, sigma);
|
|
59617
59632
|
|
|
59618
59633
|
kernel[kSize + i] = v;
|
|
59619
59634
|
kernel[kSize - i] = v;
|
|
@@ -61501,8 +61516,7 @@ class List {
|
|
|
61501
61516
|
data = []
|
|
61502
61517
|
|
|
61503
61518
|
/**
|
|
61504
|
-
* @param {[]} [array]
|
|
61505
|
-
* @constructor
|
|
61519
|
+
* @param {T[]} [array]
|
|
61506
61520
|
*/
|
|
61507
61521
|
constructor(array) {
|
|
61508
61522
|
|
|
@@ -61744,12 +61758,10 @@ class List {
|
|
|
61744
61758
|
* @param {Array.<T>} elements
|
|
61745
61759
|
*/
|
|
61746
61760
|
addAllUnique(elements) {
|
|
61747
|
-
const
|
|
61748
|
-
|
|
61749
|
-
const length = data.length;
|
|
61761
|
+
const length = elements.length;
|
|
61750
61762
|
|
|
61751
61763
|
for (let i = 0; i < length; i++) {
|
|
61752
|
-
this.addUnique(
|
|
61764
|
+
this.addUnique(elements[i]);
|
|
61753
61765
|
}
|
|
61754
61766
|
}
|
|
61755
61767
|
|
|
@@ -61859,7 +61871,7 @@ class List {
|
|
|
61859
61871
|
/**
|
|
61860
61872
|
*
|
|
61861
61873
|
* @param {function(a:T, b:T):number} [compare_function]
|
|
61862
|
-
* @returns {
|
|
61874
|
+
* @returns {this}
|
|
61863
61875
|
*/
|
|
61864
61876
|
sort(compare_function) {
|
|
61865
61877
|
Array.prototype.sort.call(this.data, compare_function);
|
|
@@ -105503,7 +105515,7 @@ class InputBinding {
|
|
|
105503
105515
|
class InputController {
|
|
105504
105516
|
/**
|
|
105505
105517
|
*
|
|
105506
|
-
* @param {Array} bindings
|
|
105518
|
+
* @param {Array} [bindings]
|
|
105507
105519
|
* @constructor
|
|
105508
105520
|
*/
|
|
105509
105521
|
constructor(bindings = []) {
|
|
@@ -105519,6 +105531,21 @@ class InputController {
|
|
|
105519
105531
|
};
|
|
105520
105532
|
}
|
|
105521
105533
|
|
|
105534
|
+
/**
|
|
105535
|
+
*
|
|
105536
|
+
* @param {string} path
|
|
105537
|
+
* @param {function} action
|
|
105538
|
+
* @returns {InputBinding}
|
|
105539
|
+
*/
|
|
105540
|
+
bind(path, action) {
|
|
105541
|
+
|
|
105542
|
+
const binding = new InputBinding({ path, listener: action });
|
|
105543
|
+
|
|
105544
|
+
this.mapping.add(binding);
|
|
105545
|
+
|
|
105546
|
+
return binding;
|
|
105547
|
+
}
|
|
105548
|
+
|
|
105522
105549
|
/**
|
|
105523
105550
|
*
|
|
105524
105551
|
* @param {Array} bindings
|
|
@@ -114992,19 +115019,19 @@ class KeyboardCameraController {
|
|
|
114992
115019
|
function registerToggle(keys, object, propertyName) {
|
|
114993
115020
|
keys.forEach((keyName) => {
|
|
114994
115021
|
|
|
114995
|
-
inputController.
|
|
114996
|
-
|
|
114997
|
-
|
|
115022
|
+
inputController.bind(
|
|
115023
|
+
"keyboard/keys/" + keyName + "/down",
|
|
115024
|
+
() => {
|
|
114998
115025
|
object[propertyName] = true;
|
|
114999
115026
|
|
|
115000
115027
|
//send interaction event
|
|
115001
115028
|
ecd.sendEvent(cameraController.entity, 'user-input');
|
|
115002
115029
|
}
|
|
115003
|
-
|
|
115004
|
-
inputController.
|
|
115005
|
-
|
|
115006
|
-
|
|
115007
|
-
|
|
115030
|
+
);
|
|
115031
|
+
inputController.bind(
|
|
115032
|
+
"keyboard/keys/" + keyName + "/up",
|
|
115033
|
+
() => object[propertyName] = false
|
|
115034
|
+
);
|
|
115008
115035
|
});
|
|
115009
115036
|
}
|
|
115010
115037
|
|
|
@@ -115036,7 +115063,7 @@ class KeyboardCameraController {
|
|
|
115036
115063
|
return;
|
|
115037
115064
|
}
|
|
115038
115065
|
|
|
115039
|
-
|
|
115066
|
+
const displacement = cameraPanSpeed.clone().multiplyScalar(keyboardPanSpeed * timeDelta);
|
|
115040
115067
|
|
|
115041
115068
|
const camera_transform = ecd.getComponent(cameraController.entity, Transform);
|
|
115042
115069
|
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {T[]} array
|
|
4
4
|
* @param {T} victim
|
|
5
5
|
* @param {T} replacement
|
|
6
|
+
* @returns {T[]} input array after replacements
|
|
6
7
|
*/
|
|
7
|
-
export function array_replace_all<T>(array: T[], victim: T, replacement: T):
|
|
8
|
+
export function array_replace_all<T>(array: T[], victim: T, replacement: T): T[];
|
|
8
9
|
//# sourceMappingURL=array_replace_all.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_replace_all.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_replace_all.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"array_replace_all.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_replace_all.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iFAYC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {T[]} array
|
|
4
4
|
* @param {T} victim
|
|
5
5
|
* @param {T} replacement
|
|
6
|
+
* @returns {T[]} input array after replacements
|
|
6
7
|
*/
|
|
7
8
|
export function array_replace_all(array, victim, replacement) {
|
|
8
9
|
|
|
@@ -14,4 +15,6 @@ export function array_replace_all(array, victim, replacement) {
|
|
|
14
15
|
array[i] = replacement;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
return array;
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":";AAaA;;;;GAIG;AACH;IAuBI
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":"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"}
|
|
@@ -40,8 +40,7 @@ class List {
|
|
|
40
40
|
data = []
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* @param {[]} [array]
|
|
44
|
-
* @constructor
|
|
43
|
+
* @param {T[]} [array]
|
|
45
44
|
*/
|
|
46
45
|
constructor(array) {
|
|
47
46
|
|
|
@@ -291,12 +290,10 @@ class List {
|
|
|
291
290
|
* @param {Array.<T>} elements
|
|
292
291
|
*/
|
|
293
292
|
addAllUnique(elements) {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
const length = data.length;
|
|
293
|
+
const length = elements.length;
|
|
297
294
|
|
|
298
295
|
for (let i = 0; i < length; i++) {
|
|
299
|
-
this.addUnique(
|
|
296
|
+
this.addUnique(elements[i]);
|
|
300
297
|
}
|
|
301
298
|
}
|
|
302
299
|
|
|
@@ -414,7 +411,7 @@ class List {
|
|
|
414
411
|
/**
|
|
415
412
|
*
|
|
416
413
|
* @param {function(a:T, b:T):number} [compare_function]
|
|
417
|
-
* @returns {
|
|
414
|
+
* @returns {this}
|
|
418
415
|
*/
|
|
419
416
|
sort(compare_function) {
|
|
420
417
|
Array.prototype.sort.call(this.data, compare_function);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArraySet.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/ArraySet.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"ArraySet.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/ArraySet.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;IAyBI;;;;;;OAMG;IACH,yBAIC;IAnCD;;OAEG;IACH;;;MAGE;IAEF;;;OAGG;IACH,aAAU;IAEV,eAAW;IAEX;;;OAGG;IACH,mBAEC;IAeD;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,oBAWC;IAED;;;OAGG;IACH,uBAWC;IAED;;;;;OAKG;IACH,wBAIC;IAED;;;OAGG;IACH,WAFa,OAAO,CAInB;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,iBAFW,QAAS,QAQnB;IAED;;;OAGG;IACH,qBAFW,QAAS,QAuBnB;IAED;;;;OAIG;IACH,2CAIC;IAED;;;OAGG;IACH,WAFa,GAAG,CAIf;CACJ;mBA5KkB,+BAA+B"}
|
|
@@ -21,6 +21,14 @@ class ArraySet {
|
|
|
21
21
|
|
|
22
22
|
length = 0;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
get size(){
|
|
29
|
+
return this.length;
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
/**
|
|
25
33
|
*
|
|
26
34
|
* @param {Array.<T>} [array=[]]
|
|
@@ -110,7 +118,9 @@ class ArraySet {
|
|
|
110
118
|
* @param {Array.<T>} elements
|
|
111
119
|
*/
|
|
112
120
|
addAll(elements) {
|
|
113
|
-
|
|
121
|
+
const count = elements.length;
|
|
122
|
+
|
|
123
|
+
for (let i = 0; i < count; i++) {
|
|
114
124
|
this.add(elements[i]);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
2
|
-
import {
|
|
2
|
+
import { bsdf_schlick } from "../bsdf/bsdf_schlick.js";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param {number} u
|
|
7
|
-
* @param {number} f0
|
|
8
|
-
* @param {number} f90
|
|
9
|
-
* @return {number}
|
|
10
|
-
*/
|
|
11
|
-
function F_Schlick(u, f0, f90) {
|
|
12
|
-
|
|
13
|
-
return f0 + (f90 - f0) * fresnel_Schlick(u);
|
|
14
|
-
}
|
|
15
4
|
|
|
16
5
|
/**
|
|
17
6
|
* @see https://google.github.io/filament/Filament.md.html#listing_diffusebrdf
|
|
@@ -30,8 +19,8 @@ function F_Schlick(u, f0, f90) {
|
|
|
30
19
|
export function brdf_burley(NoV, NoL, LoH, roughness) {
|
|
31
20
|
const f90 = 0.5 + 2.0 * roughness * LoH * LoH;
|
|
32
21
|
|
|
33
|
-
const lightScatter =
|
|
34
|
-
const viewScatter =
|
|
22
|
+
const lightScatter = bsdf_schlick(1.0, f90, NoL);
|
|
23
|
+
const viewScatter = bsdf_schlick(1.0, f90, NoV);
|
|
35
24
|
|
|
36
25
|
return lightScatter * viewScatter * PI_RECIPROCAL;
|
|
37
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf_normal.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/pdf/pdf_normal.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,8BAJW,MAAM,SACN,MAAM,GACL,MAAM,CAIjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { gaussian } from "../../gaussian.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normal Probability Distribution Function
|
|
5
|
+
* @param {number} x
|
|
6
|
+
* @param {number} sigma
|
|
7
|
+
* @return {number}
|
|
8
|
+
*/
|
|
9
|
+
export function pdf_normal(x, sigma) {
|
|
10
|
+
return 0.39894 * gaussian(sigma, x) / sigma;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflectivity_to_ior.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/reflectivity_to_ior.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,
|
|
1
|
+
{"version":3,"file":"reflectivity_to_ior.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/reflectivity_to_ior.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAMjB"}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {string|null|undefined} string
|
|
4
|
+
* @param {number} [start]
|
|
5
|
+
* @param {number} [length] how many characters to hash, defaults to full string length
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function computeStringHash(string: string | null | undefined, start?: number, length?: number): number;
|
|
9
|
+
//# sourceMappingURL=computeStringHash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0CALW,MAAM,GAAC,IAAI,GAAC,SAAS,UACrB,MAAM,WACN,MAAM,GACJ,MAAM,CAiClB"}
|
|
@@ -3,9 +3,11 @@ import { assert } from "../../assert.js";
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {string|null|undefined} string
|
|
6
|
+
* @param {number} [start]
|
|
7
|
+
* @param {number} [length] how many characters to hash, defaults to full string length
|
|
6
8
|
* @returns {number}
|
|
7
9
|
*/
|
|
8
|
-
export function computeStringHash(string) {
|
|
10
|
+
export function computeStringHash(string, start, length) {
|
|
9
11
|
if (string === null) {
|
|
10
12
|
return 0;
|
|
11
13
|
}
|
|
@@ -14,13 +16,16 @@ export function computeStringHash(string) {
|
|
|
14
16
|
return 1;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
assert.isString(string,'string');
|
|
19
|
+
assert.isString(string, 'string');
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
let _start = start ?? 0;
|
|
22
|
+
let _length = length ?? string.length - _start;
|
|
20
23
|
|
|
21
|
-
let hash =
|
|
24
|
+
let hash = _length;
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
const end = _start + _length;
|
|
27
|
+
|
|
28
|
+
for (let i = _start; i < end; i++) {
|
|
24
29
|
const code_point = string.charCodeAt(i);
|
|
25
30
|
|
|
26
31
|
/*
|
|
@@ -447,12 +447,13 @@ vec4 lvp_mask_weights_by_visibility(in vec3 position, in vec3 normal, in vec3 vi
|
|
|
447
447
|
// room, the normals on the details might rule out all of the probes that have mutual
|
|
448
448
|
// visibility to the point. So, we instead use a "wrap shading" test below inspired by
|
|
449
449
|
// NPR work.
|
|
450
|
-
|
|
450
|
+
float backface_term = max(0.0001, dot(direction_to_probe, normal));
|
|
451
451
|
|
|
452
452
|
// The small offset at the end reduces the "going to zero" impact
|
|
453
453
|
// where this is really close to exactly opposite
|
|
454
454
|
// float backface_term = max(0.0001, (dot(direction_to_probe, normal) + 1.0) * 0.5);
|
|
455
|
-
|
|
455
|
+
weight *= backface_term * backface_term + 0.05;
|
|
456
|
+
// weight *= backface_term;
|
|
456
457
|
|
|
457
458
|
}
|
|
458
459
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAuBA;IACI,mBAA0B;IAC1B,yBAAqB;
|
|
1
|
+
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAuBA;IACI,mBAA0B;IAC1B,yBAAqB;IAGrB,qBAAoB;IACpB,qBAAyB;IAEzB,uBAA6B;IAE7B;;;;;;;;OAQG;IACH,kCAPW,MAAM,aACN,MAAM,YACN,MAAM,EAAE,mBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAchB;IAED,iFAuCC;IAKD,mBACC;IAED,4BAKC;CACJ;8BA/F6B,oBAAoB;2BAHvB,8BAA8B;gCADzB,mCAAmC"}
|
|
@@ -24,8 +24,9 @@ const sampled_irradiance = new Float32Array(3);
|
|
|
24
24
|
export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
25
25
|
tracer = new PathTracer();
|
|
26
26
|
max_bounce_count = 5;
|
|
27
|
-
sample_count =
|
|
28
|
-
// sample_count =
|
|
27
|
+
// sample_count = 192;
|
|
28
|
+
// sample_count = 1000;
|
|
29
|
+
sample_count = 4096;
|
|
29
30
|
random = seededRandom(0);
|
|
30
31
|
|
|
31
32
|
scene = new PathTracedScene()
|
|
@@ -49,7 +50,7 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
49
50
|
this.scene,
|
|
50
51
|
position, position_offset,
|
|
51
52
|
resolution, max_depth,
|
|
52
|
-
|
|
53
|
+
8
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,iFAPW,gBAAgB,GAKd,QAAQ,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,iFAPW,gBAAgB,GAKd,QAAQ,gBAAgB,CAAC,CAiGrC;iCA3GgC,uBAAuB"}
|
|
@@ -60,9 +60,6 @@ export async function build_probes_for_scene(
|
|
|
60
60
|
// );
|
|
61
61
|
// }
|
|
62
62
|
|
|
63
|
-
// make_justified_point_grid(model_bounds, probe_grid_spacing, (x, y, z) => {
|
|
64
|
-
// volume.add_point(x, y, z);
|
|
65
|
-
// });
|
|
66
63
|
|
|
67
64
|
// lpv.add_point(10, 1, -10);
|
|
68
65
|
|
|
@@ -74,6 +71,12 @@ export async function build_probes_for_scene(
|
|
|
74
71
|
//
|
|
75
72
|
// volume.build_mesh();
|
|
76
73
|
console.time('Grid Build')
|
|
74
|
+
//
|
|
75
|
+
// make_justified_point_grid(model_bounds, probe_grid_spacing, (x, y, z) => {
|
|
76
|
+
// volume.add_point(x, y, z);
|
|
77
|
+
// });
|
|
78
|
+
// volume.build_mesh();
|
|
79
|
+
//
|
|
77
80
|
volume.build_grid(model_bounds, new Vector3(
|
|
78
81
|
Math.ceil(model_bounds.width / probe_grid_spacing),
|
|
79
82
|
Math.ceil(model_bounds.height / probe_grid_spacing),
|
|
@@ -46,7 +46,6 @@ import TopDownCameraController from "../ecs/camera/topdown/TopDownCameraControll
|
|
|
46
46
|
import { Light } from "../ecs/light/Light.js";
|
|
47
47
|
import LightSystem from "../ecs/light/LightSystem.js";
|
|
48
48
|
import { LightType } from "../ecs/light/LightType.js";
|
|
49
|
-
import { SGMesh } from "../ecs/mesh-v2/aggregate/SGMesh.js";
|
|
50
49
|
import { SGMeshSystem } from "../ecs/mesh-v2/aggregate/SGMeshSystem.js";
|
|
51
50
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
52
51
|
import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
@@ -246,7 +245,7 @@ async function getVolume({
|
|
|
246
245
|
engine,
|
|
247
246
|
ecd,
|
|
248
247
|
bounds: mesh_bounds,
|
|
249
|
-
density:
|
|
248
|
+
density: 500
|
|
250
249
|
});
|
|
251
250
|
|
|
252
251
|
const buffer = new BinaryBuffer();
|
|
@@ -355,7 +354,7 @@ async function main(engine) {
|
|
|
355
354
|
sun: sun_color,
|
|
356
355
|
// sunIntensity: 1.7,
|
|
357
356
|
sunIntensity: 3,
|
|
358
|
-
sunDirection: new Vector3(0.2, -
|
|
357
|
+
sunDirection: new Vector3(0.2, -0.8, 1)
|
|
359
358
|
// sunDirection: new Vector3(1.2, -1, 0.2)
|
|
360
359
|
})
|
|
361
360
|
|
|
@@ -388,9 +387,10 @@ async function main(engine) {
|
|
|
388
387
|
// const path = 'data/models/samples/teapot.gltf';
|
|
389
388
|
// const path = 'data/models/samples/salle_de_bain/model.glb';
|
|
390
389
|
// const path = 'data/models/samples/conference/model-no-curtains.glb';
|
|
391
|
-
const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
390
|
+
// const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
392
391
|
// const path = 'data/models/samples/gi_box_01/model.glb';
|
|
393
392
|
// const path = 'data/models/samples/low_poly_classroom/no-glass/model.gltf';
|
|
393
|
+
const path = 'customer_data/halon_scene.glb';
|
|
394
394
|
|
|
395
395
|
const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
|
|
396
396
|
const gltf = mesh_asset.gltf;
|
|
@@ -401,12 +401,6 @@ async function main(engine) {
|
|
|
401
401
|
|
|
402
402
|
// make_cornel_box(ecd);
|
|
403
403
|
|
|
404
|
-
const mesh_entity = new Entity();
|
|
405
|
-
mesh_entity
|
|
406
|
-
.add(new Transform())
|
|
407
|
-
.add(SGMesh.fromURL(path))
|
|
408
|
-
;
|
|
409
|
-
|
|
410
404
|
|
|
411
405
|
const composition = three_object_to_entity_composition(gltf.scene);
|
|
412
406
|
|
|
@@ -419,8 +413,16 @@ async function main(engine) {
|
|
|
419
413
|
*/
|
|
420
414
|
const sg = n.entity.getComponent(ShadedGeometry);
|
|
421
415
|
|
|
422
|
-
if (sg
|
|
423
|
-
|
|
416
|
+
if (sg === null) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
sg.writeFlag(ShadedGeometryFlags.CastShadow | ShadedGeometryFlags.ReceiveShadow, true);
|
|
421
|
+
|
|
422
|
+
const material = sg.material;
|
|
423
|
+
if(material !== null){
|
|
424
|
+
material.depthTest = true;
|
|
425
|
+
material.depthWrite = true;
|
|
424
426
|
}
|
|
425
427
|
});
|
|
426
428
|
|
|
@@ -601,5 +603,7 @@ new EngineHarness().initialize({
|
|
|
601
603
|
config.addLoader('model/gltf+json', new GLTFAssetLoader());
|
|
602
604
|
|
|
603
605
|
config.addPlugin(GizmoRenderingPlugin);
|
|
606
|
+
|
|
607
|
+
// config.addPlugin(AmbientOcclusionPostProcessEffect);
|
|
604
608
|
}
|
|
605
609
|
}).then(main);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"AA8DA;;;;;GAKG;AACH,sCAJW,MAAM,qBACN,MAAM;;;;;;;;YAyBD;;eAEG;;;;;;;;;;;;;;;;;EAiBlB;;IA/CD;;;;;OAKG;IACH,oBAJW,MAAM,qBACN,MAAM,EA4ChB;;wBA7GuB,OAAO"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Vector2 } from "three";
|
|
2
|
+
import { pdf_normal } from "../../../core/math/physics/pdf/pdf_normal.js";
|
|
2
3
|
|
|
3
4
|
const KERNEL_SIZE = 15;
|
|
4
5
|
|
|
@@ -59,16 +60,6 @@ void main(void) {
|
|
|
59
60
|
}
|
|
60
61
|
`;
|
|
61
62
|
|
|
62
|
-
/**
|
|
63
|
-
* Normal Probability Distribution Function
|
|
64
|
-
* @param {number} x
|
|
65
|
-
* @param {number} sigma
|
|
66
|
-
* @return {number}
|
|
67
|
-
*/
|
|
68
|
-
function normpdf(x, sigma) {
|
|
69
|
-
return 0.39894 * Math.exp(-0.5 * x * x / (sigma * sigma)) / sigma;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
63
|
/**
|
|
73
64
|
*
|
|
74
65
|
* @param {number} sigma
|
|
@@ -77,13 +68,13 @@ function normpdf(x, sigma) {
|
|
|
77
68
|
*/
|
|
78
69
|
export function DenoiseShader(sigma = 10, filterSmoothness = 0.2) {
|
|
79
70
|
// compute zNorm
|
|
80
|
-
const zNorm = 1 /
|
|
71
|
+
const zNorm = 1 / pdf_normal(0, filterSmoothness);
|
|
81
72
|
|
|
82
73
|
// build kernel
|
|
83
74
|
const kernel = new Float32Array(KERNEL_SIZE);
|
|
84
75
|
const kSize = Math.floor((KERNEL_SIZE - 1) / 2);
|
|
85
76
|
for (let i = 0; i <= kSize; i++) {
|
|
86
|
-
const v =
|
|
77
|
+
const v = pdf_normal(i, sigma);
|
|
87
78
|
|
|
88
79
|
kernel[kSize + i] = v;
|
|
89
80
|
kernel[kSize - i] = v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,
|
|
1
|
+
{"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAwBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
|