@shapediver/viewer.rendering-engine.rendering-engine-threejs 3.2.7 → 3.3.0
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/dist/RenderingEngine.d.ts.map +1 -1
- package/dist/RenderingEngine.js +4 -0
- package/dist/RenderingEngine.js.map +1 -1
- package/dist/loaders/MaterialLoader.d.ts.map +1 -1
- package/dist/loaders/MaterialLoader.js +3 -9
- package/dist/loaders/MaterialLoader.js.map +1 -1
- package/dist/managers/PostProcessingManager.d.ts +3 -2
- package/dist/managers/PostProcessingManager.d.ts.map +1 -1
- package/dist/managers/PostProcessingManager.js +25 -11
- package/dist/managers/PostProcessingManager.js.map +1 -1
- package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.d.ts +1 -0
- package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.d.ts.map +1 -1
- package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.js +38 -16
- package/dist/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.js.map +1 -1
- package/package.json +17 -17
- package/src/RenderingEngine.ts +4 -0
- package/src/loaders/MaterialLoader.ts +4 -10
- package/src/managers/PostProcessingManager.ts +28 -16
- package/src/managers/postprocessing/ao/poissionDenoise/PoissionDenoisePass.ts +31 -18
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
WebGLRenderer,
|
|
14
14
|
WebGLRenderTarget
|
|
15
15
|
} from 'three';
|
|
16
|
-
import {
|
|
16
|
+
import { HttpClient, Logger } from '@shapediver/viewer.shared.services';
|
|
17
17
|
import { Pass } from 'postprocessing';
|
|
18
18
|
import { poissionDenoise as fragmentShader } from './shader/poissionDenoise';
|
|
19
19
|
import { sampleBlueNoise } from '../utils/shader/sampleBlueNoise';
|
|
@@ -54,23 +54,8 @@ export class PoissionDenoisePass extends Pass {
|
|
|
54
54
|
constructor(camera: Camera, inputTexture: Texture, depthTexture: Texture, options: { [key: string]: unknown } = defaultPoissonBlurOptions) {
|
|
55
55
|
super('PoissionBlurPass');
|
|
56
56
|
|
|
57
|
-
if (PoissionDenoisePass.blueNoiseTexture === undefined)
|
|
58
|
-
|
|
59
|
-
const url = URL.createObjectURL(result.data.blob);
|
|
60
|
-
new TextureLoader().load(url, texture => {
|
|
61
|
-
URL.revokeObjectURL(url);
|
|
62
|
-
PoissionDenoisePass.blueNoiseTexture = texture;
|
|
63
|
-
PoissionDenoisePass.blueNoiseTexture.minFilter = NearestFilter;
|
|
64
|
-
PoissionDenoisePass.blueNoiseTexture.magFilter = NearestFilter;
|
|
65
|
-
PoissionDenoisePass.blueNoiseTexture.wrapS = RepeatWrapping;
|
|
66
|
-
PoissionDenoisePass.blueNoiseTexture.wrapT = RepeatWrapping;
|
|
67
|
-
PoissionDenoisePass.blueNoiseTexture.colorSpace = NoColorSpace;
|
|
68
|
-
PoissionDenoisePass.blueNoiseTexture.needsUpdate = true;
|
|
69
|
-
|
|
70
|
-
(this.fullscreenMaterial as ShaderMaterial).uniforms.blueNoiseTexture.value = PoissionDenoisePass.blueNoiseTexture;
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
57
|
+
if (PoissionDenoisePass.blueNoiseTexture === undefined)
|
|
58
|
+
this.loadBlueNoiseTexture();
|
|
74
59
|
|
|
75
60
|
options = { ...defaultPoissonBlurOptions, ...options };
|
|
76
61
|
|
|
@@ -132,6 +117,34 @@ export class PoissionDenoisePass extends Pass {
|
|
|
132
117
|
}
|
|
133
118
|
}
|
|
134
119
|
|
|
120
|
+
private async loadBlueNoiseTexture() {
|
|
121
|
+
const result = await HttpClient.instance.loadTexture('https://viewer.shapediver.com/v3/graphics/LDR_RGBA_0.png');
|
|
122
|
+
|
|
123
|
+
if (result) {
|
|
124
|
+
const url = URL.createObjectURL(result.data.blob);
|
|
125
|
+
new TextureLoader().load(url, texture => {
|
|
126
|
+
URL.revokeObjectURL(url);
|
|
127
|
+
PoissionDenoisePass.blueNoiseTexture = texture;
|
|
128
|
+
PoissionDenoisePass.blueNoiseTexture.minFilter = NearestFilter;
|
|
129
|
+
PoissionDenoisePass.blueNoiseTexture.magFilter = NearestFilter;
|
|
130
|
+
PoissionDenoisePass.blueNoiseTexture.wrapS = RepeatWrapping;
|
|
131
|
+
PoissionDenoisePass.blueNoiseTexture.wrapT = RepeatWrapping;
|
|
132
|
+
PoissionDenoisePass.blueNoiseTexture.colorSpace = NoColorSpace;
|
|
133
|
+
PoissionDenoisePass.blueNoiseTexture.needsUpdate = true;
|
|
134
|
+
|
|
135
|
+
(this.fullscreenMaterial as ShaderMaterial).uniforms.blueNoiseTexture.value = PoissionDenoisePass.blueNoiseTexture;
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
Logger.instance.warn('The blue noise texture could not be loaded. This may result in a suboptimal denoising quality. Retrying in 1 second...');
|
|
139
|
+
|
|
140
|
+
// if there was an issue loading the texture
|
|
141
|
+
// set a timeout with 1 second to try again
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
this.loadBlueNoiseTexture();
|
|
144
|
+
}, 1000);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
135
148
|
// #endregion Constructors (1)
|
|
136
149
|
|
|
137
150
|
// #region Public Getters And Setters (1)
|