@needle-tools/engine 2.67.4-pre → 2.67.6-pre
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/CHANGELOG.md +8 -0
- package/dist/needle-engine.js +5376 -5344
- package/dist/needle-engine.umd.cjs +227 -227
- package/lib/engine/engine_gizmos.js +7 -0
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_setup.js +5 -5
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +1 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +0 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +3 -3
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +3 -2
- package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +70 -22
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.js +20 -10
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/postprocessing/VolumeParameter.js +1 -1
- package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_gizmos.ts +7 -0
- package/src/engine/engine_setup.ts +4 -5
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +0 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +2 -2
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +3 -2
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +75 -29
- package/src/engine-components/postprocessing/Volume.ts +213 -201
- package/src/engine-components/postprocessing/VolumeParameter.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Volume.js","sourceRoot":"","sources":["../../../../src/engine-components/postprocessing/Volume.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Volume.js","sourceRoot":"","sources":["../../../../src/engine-components/postprocessing/Volume.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;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AAE,CAAC;YACjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC,EAAE,GAAG,CAAC,CAAC;IACZ,CAAC;CAEJ;AAhMG;IADC,aAAa,CAAC,aAAa,CAAC;6CACC;AAkMlC,6CAA6C;AAC7C,MAAM,sBAAsB,GAA0B,IAAI,GAAG,EAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolumeParameter.js","sourceRoot":"","sources":["../../../../src/engine-components/postprocessing/VolumeParameter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAKjE,MAAM,OAAO,eAAe;IAGxB,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD,IAAI,aAAa,CAAC,GAAY;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG;YAAE,OAAO;QACjC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;QAClE,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IACO,OAAO,GAAY,
|
|
1
|
+
{"version":3,"file":"VolumeParameter.js","sourceRoot":"","sources":["../../../../src/engine-components/postprocessing/VolumeParameter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAKjE,MAAM,OAAO,eAAe;IAGxB,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD,IAAI,aAAa,CAAC,GAAY;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG;YAAE,OAAO;QACjC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,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CAAC,cAAc;gBACnC,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;SACrB;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;SAC5C;IACL,CAAC;IAEO,kBAAkB,CAAC,QAAa;QAEpC,IAAI,IAAI,CAAC,mBAAmB,KAAK,QAAQ;YACrC,OAAO,KAAK,CAAC;QAEjB,0IAA0I;QAE1I,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA5EG;IADC,YAAY,EAAE;oDAGd;AAYD;IADC,YAAY,EAAE;4CAGd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "2.67.
|
|
3
|
+
"version": "2.67.6-pre",
|
|
4
4
|
"description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
|
|
5
5
|
"main": "dist/needle-engine.umd.cjs",
|
|
6
6
|
"module": "lib/needle-engine.js",
|
|
@@ -21,6 +21,7 @@ export class Gizmos {
|
|
|
21
21
|
positions.needsUpdate = true;
|
|
22
22
|
obj.material["color"].set(color);
|
|
23
23
|
obj.material["depthTest"] = depthTest;
|
|
24
|
+
obj.material["depthWrite"] = false;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
static DrawDirection(pt: Vec3, direction: Vec3 | Vec4, color: ColorRepresentation = defaultColor, duration: number = 0, depthTest: boolean = true, lengthFactor: number = 1) {
|
|
@@ -40,6 +41,7 @@ export class Gizmos {
|
|
|
40
41
|
positions.needsUpdate = true;
|
|
41
42
|
obj.material["color"].set(color);
|
|
42
43
|
obj.material["depthTest"] = depthTest;
|
|
44
|
+
obj.material["depthWrite"] = false;
|
|
43
45
|
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -52,6 +54,7 @@ export class Gizmos {
|
|
|
52
54
|
positions.needsUpdate = true;
|
|
53
55
|
obj.material["color"].set(color);
|
|
54
56
|
obj.material["depthTest"] = depthTest;
|
|
57
|
+
obj.material["depthWrite"] = false;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
static DrawWireSphere(center: Vec3, radius: number, color: ColorRepresentation = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
@@ -59,6 +62,7 @@ export class Gizmos {
|
|
|
59
62
|
setWorldPositionXYZ(obj, center.x, center.y, center.z);
|
|
60
63
|
obj.material["color"].set(color);
|
|
61
64
|
obj.material["depthTest"] = depthTest;
|
|
65
|
+
obj.material["depthWrite"] = false;
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
static DrawSphere(center: Vec3, radius: number, color: ColorRepresentation = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
@@ -66,6 +70,7 @@ export class Gizmos {
|
|
|
66
70
|
setWorldPositionXYZ(obj, center.x, center.y, center.z);
|
|
67
71
|
obj.material["color"].set(color);
|
|
68
72
|
obj.material["depthTest"] = depthTest;
|
|
73
|
+
obj.material["depthWrite"] = false;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
static DrawBox(center: Vec3, size: Vec3, color: ColorRepresentation = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
@@ -75,6 +80,7 @@ export class Gizmos {
|
|
|
75
80
|
obj.material["color"].set(color);
|
|
76
81
|
obj.material["depthTest"] = depthTest;
|
|
77
82
|
obj.material["wireframe"] = true;
|
|
83
|
+
obj.material["depthWrite"] = false;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
static DrawBox3(box: Box3, color: ColorRepresentation = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
@@ -84,6 +90,7 @@ export class Gizmos {
|
|
|
84
90
|
obj.material["color"].set(color);
|
|
85
91
|
obj.material["depthTest"] = depthTest;
|
|
86
92
|
obj.material["wireframe"] = true;
|
|
93
|
+
obj.material["depthWrite"] = false;
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
private static _up = new Vector3(0, 1, 0);
|
|
@@ -244,8 +244,9 @@ export class Context implements IContext {
|
|
|
244
244
|
this.isManagedExternally = true;
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
this.renderer = new WebGLRenderer({
|
|
248
|
+
antialias: true
|
|
249
|
+
});
|
|
249
250
|
|
|
250
251
|
// some tonemapping other than "NONE" is required for adjusting exposure with EXR environments
|
|
251
252
|
this.renderer.toneMappingExposure = 1; // range [0...inf] instead of the usual -15..15
|
|
@@ -261,8 +262,6 @@ export class Context implements IContext {
|
|
|
261
262
|
this.renderer.setSize(this.domWidth, this.domHeight);
|
|
262
263
|
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
263
264
|
this.renderer.physicallyCorrectLights = true;
|
|
264
|
-
|
|
265
|
-
this.composer = useComposer ? new EffectComposer(this.renderer) : null;
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
this.scene = new THREE.Scene();
|
|
@@ -764,7 +763,7 @@ export class Context implements IContext {
|
|
|
764
763
|
// }
|
|
765
764
|
// }
|
|
766
765
|
if (this.composer && !this.isInXR) {
|
|
767
|
-
this.composer.render();
|
|
766
|
+
this.composer.render(this.time.deltaTime);
|
|
768
767
|
}
|
|
769
768
|
else if (camera) {
|
|
770
769
|
this.renderer.render(this.scene, camera);
|
|
@@ -37,7 +37,7 @@ export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
|
|
|
37
37
|
const normalPass = new NormalPass(this.context.scene, cam);
|
|
38
38
|
const depthDownsamplingPass = new DepthDownsamplingPass({
|
|
39
39
|
normalBuffer: normalPass.texture,
|
|
40
|
-
resolutionScale:
|
|
40
|
+
resolutionScale: .5
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const ssao = this._ssao = new SSAOEffect(cam!, normalPass.texture, {
|
|
@@ -47,7 +47,7 @@ export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
|
|
|
47
47
|
worldProximityThreshold: .1,
|
|
48
48
|
worldProximityFalloff: 2,
|
|
49
49
|
intensity: 1,
|
|
50
|
-
|
|
50
|
+
blendFunction: BlendFunction.MULTIPLY,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
this.intensity.onValueChanged = newValue => {
|
|
@@ -83,12 +83,13 @@ export abstract class PostProcessingEffect extends Component implements IEffectP
|
|
|
83
83
|
if (typeof data === "object") {
|
|
84
84
|
const types = this["$serializedTypes"];
|
|
85
85
|
if (types) {
|
|
86
|
-
for (const fieldName
|
|
86
|
+
for (const fieldName of Object.keys(types)) {
|
|
87
87
|
const type = types[fieldName];
|
|
88
88
|
if (type === VolumeParameter) {
|
|
89
89
|
const value = data[fieldName];
|
|
90
90
|
if (value !== undefined) {
|
|
91
|
-
this[fieldName]
|
|
91
|
+
const parameter = this[fieldName];
|
|
92
|
+
parameter.value = value;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { HalfFloatType, sRGBEncoding, WebGLRenderTarget } from "three";
|
|
2
2
|
import { Context } from "../../engine/engine_setup";
|
|
3
|
-
import { getParam } from "../../engine/engine_utils";
|
|
4
|
-
import { Effect, EffectComposer, EffectPass, Pass, RenderPass } from "postprocessing";
|
|
3
|
+
import { getParam, isMobileDevice } from "../../engine/engine_utils";
|
|
4
|
+
import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, DepthDownsamplingPass, DepthOfFieldEffect, Effect, EffectComposer, EffectPass, HueSaturationEffect, NormalPass, Pass, PixelationEffect, RenderPass, SelectiveBloomEffect, SSAOEffect, VignetteEffect } from "postprocessing";
|
|
5
5
|
import { showBalloonWarning } from "../../engine/debug/debug";
|
|
6
6
|
import { Camera } from "../Camera";
|
|
7
7
|
import { PostProcessingEffect } from "./PostProcessingEffect";
|
|
8
|
+
import { Constructor } from "../../engine/engine_serialization_core";
|
|
8
9
|
|
|
9
10
|
const debug = getParam("debugpost");
|
|
10
11
|
|
|
@@ -98,7 +99,6 @@ export class PostProcessingHandler {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
this.applyEffects(context);
|
|
101
|
-
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
|
|
@@ -106,11 +106,11 @@ export class PostProcessingHandler {
|
|
|
106
106
|
private applyEffects(context: Context) {
|
|
107
107
|
|
|
108
108
|
const effectsOrPasses = this._effects;
|
|
109
|
-
const camera = context.mainCameraComponent as Camera;
|
|
110
|
-
const renderer = context.renderer;
|
|
111
|
-
|
|
112
109
|
if (effectsOrPasses.length <= 0) return;
|
|
113
110
|
|
|
111
|
+
const camera = context.mainCameraComponent as Camera;
|
|
112
|
+
const renderer = context.renderer;
|
|
113
|
+
const scene = context.scene;
|
|
114
114
|
const cam = camera.cam;
|
|
115
115
|
|
|
116
116
|
// create composer and set active on context
|
|
@@ -118,45 +118,91 @@ export class PostProcessingHandler {
|
|
|
118
118
|
// const hdrRenderTarget = new WebGLRenderTarget(window.innerWidth, window.innerHeight, { type: HalfFloatType });
|
|
119
119
|
this._composer = new EffectComposer(renderer, {
|
|
120
120
|
frameBufferType: HalfFloatType,
|
|
121
|
-
|
|
121
|
+
stencilBuffer: true,
|
|
122
|
+
multisampling: isMobileDevice() ? 0 : 8,
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
context.composer = this._composer;
|
|
125
126
|
const composer = context.composer;
|
|
126
127
|
composer.setMainCamera(cam);
|
|
127
128
|
composer.setRenderer(renderer);
|
|
129
|
+
composer.setMainScene(scene);
|
|
130
|
+
|
|
128
131
|
for (const prev of composer.passes)
|
|
129
132
|
prev.dispose();
|
|
130
133
|
composer.removeAllPasses();
|
|
131
|
-
composer.addPass(new RenderPass(context.scene, cam));
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (debug)
|
|
135
|
-
console.log("Set effects or passes", camera, effectsOrPasses, composer);
|
|
136
|
-
|
|
137
|
-
// TODO: enforce correct order of effects (e.g. DOF before Bloom)
|
|
138
134
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
135
|
+
// Render to screen pass
|
|
136
|
+
const screenpass = new RenderPass(scene, cam);
|
|
137
|
+
screenpass.mainScene = scene;
|
|
138
|
+
composer.addPass(screenpass);
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
this.orderEffects();
|
|
142
|
+
|
|
143
|
+
const effects: Array<Effect> = [];
|
|
144
|
+
|
|
145
|
+
for (const ef of effectsOrPasses) {
|
|
146
|
+
if (ef instanceof Effect)
|
|
147
|
+
effects.push(ef as Effect);
|
|
148
|
+
else if (ef instanceof Pass) {
|
|
149
|
+
const pass = new EffectPass(cam, ...effects);
|
|
150
|
+
pass.mainScene = scene;
|
|
151
|
+
pass.name = effects.map(e => e.constructor.name).join(", ");
|
|
152
|
+
pass.enabled = true;
|
|
153
|
+
// composer.addPass(pass);
|
|
154
|
+
effects.length = 0;
|
|
155
|
+
composer.addPass(ef as Pass);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// create and apply uber pass
|
|
160
|
+
if (effects.length > 0) {
|
|
145
161
|
const pass = new EffectPass(cam, ...effects);
|
|
146
|
-
pass.
|
|
162
|
+
pass.mainScene = scene;
|
|
147
163
|
pass.enabled = true;
|
|
148
164
|
composer.addPass(pass);
|
|
149
|
-
effects.length = 0;
|
|
150
|
-
composer.addPass(ef as Pass);
|
|
151
165
|
}
|
|
152
166
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
pass.enabled = true;
|
|
158
|
-
composer.addPass(pass);
|
|
167
|
+
catch(e) {
|
|
168
|
+
console.error("Error while applying postprocessing effects", e);
|
|
169
|
+
composer.removeAllPasses();
|
|
170
|
+
composer.addPass(screenpass);
|
|
159
171
|
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if (debug)
|
|
175
|
+
console.log("PostProcessing Passes", effectsOrPasses, "->", composer.passes);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private orderEffects() {
|
|
179
|
+
if (debug) console.log("Before ordering effects", [...this._effects]);
|
|
180
|
+
// TODO: enforce correct order of effects (e.g. DOF before Bloom)
|
|
181
|
+
const effects = this._effects;
|
|
182
|
+
effects.sort((a, b) => {
|
|
183
|
+
const aidx = effectsOrder.indexOf(a.constructor as any);
|
|
184
|
+
const bidx = effectsOrder.indexOf(b.constructor as any);
|
|
185
|
+
// Unknown effects should be rendered first
|
|
186
|
+
if (aidx < 0 && bidx < 0) return -1;
|
|
187
|
+
if (aidx < 0) return 1;
|
|
188
|
+
if (bidx < 0) return -1;
|
|
189
|
+
return aidx - bidx;
|
|
190
|
+
});
|
|
191
|
+
if (debug) console.log("After ordering effects", [...this._effects]);
|
|
160
192
|
}
|
|
161
193
|
}
|
|
162
194
|
|
|
195
|
+
|
|
196
|
+
const effectsOrder: Array<Constructor<Effect | Pass>> = [
|
|
197
|
+
NormalPass,
|
|
198
|
+
DepthDownsamplingPass,
|
|
199
|
+
SSAOEffect,
|
|
200
|
+
DepthOfFieldEffect,
|
|
201
|
+
BloomEffect,
|
|
202
|
+
SelectiveBloomEffect,
|
|
203
|
+
VignetteEffect,
|
|
204
|
+
HueSaturationEffect,
|
|
205
|
+
ChromaticAberrationEffect,
|
|
206
|
+
BrightnessContrastEffect,
|
|
207
|
+
PixelationEffect,
|
|
208
|
+
];
|