@onerjs/core 8.28.4 → 8.28.5
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.d.ts +94 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +312 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +1 -7
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +0 -6
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -4
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +0 -8
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -5
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +13 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +25 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +76 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +147 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +14 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +29 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +2 -11
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +8 -9
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +6 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/openPbrMaterial.js +5 -5
- package/Materials/PBR/openPbrMaterial.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +21 -30
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +163 -256
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +1 -3
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/thinSSAO2RenderingPipeline.d.ts +130 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSAO2RenderingPipeline.js +193 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSAO2RenderingPipeline.js.map +1 -0
- package/PostProcesses/thinSSAO2BlurPostProcess.d.ts +26 -0
- package/PostProcesses/thinSSAO2BlurPostProcess.js +81 -0
- package/PostProcesses/thinSSAO2BlurPostProcess.js.map +1 -0
- package/PostProcesses/thinSSAO2CombinePostProcess.d.ts +15 -0
- package/PostProcesses/thinSSAO2CombinePostProcess.js +48 -0
- package/PostProcesses/thinSSAO2CombinePostProcess.js.map +1 -0
- package/PostProcesses/thinSSAO2PostProcess.d.ts +45 -0
- package/PostProcesses/thinSSAO2PostProcess.js +208 -0
- package/PostProcesses/thinSSAO2PostProcess.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Camera, Nullable, Scene } from "../../../index.js";
|
|
2
|
+
import { ThinSSAO2PostProcess } from "../../thinSSAO2PostProcess.js";
|
|
3
|
+
import { ThinSSAO2BlurPostProcess } from "../../thinSSAO2BlurPostProcess.js";
|
|
4
|
+
import { ThinSSAO2CombinePostProcess } from "../../thinSSAO2CombinePostProcess.js";
|
|
5
|
+
/**
|
|
6
|
+
* The SSAO2 rendering pipeline is used to generate ambient occlusion effects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ThinSSAO2RenderingPipeline {
|
|
9
|
+
/** @internal */
|
|
10
|
+
readonly _ssaoPostProcess: ThinSSAO2PostProcess;
|
|
11
|
+
/** @internal */
|
|
12
|
+
readonly _ssaoBlurXPostProcess: ThinSSAO2BlurPostProcess;
|
|
13
|
+
/** @internal */
|
|
14
|
+
readonly _ssaoBlurYPostProcess: ThinSSAO2BlurPostProcess;
|
|
15
|
+
/** @internal */
|
|
16
|
+
readonly _ssaoCombinePostProcess: ThinSSAO2CombinePostProcess;
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets the name of the rendering pipeline
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* The camera to which the rendering pipeline will be applied.
|
|
23
|
+
*/
|
|
24
|
+
get camera(): Nullable<Camera>;
|
|
25
|
+
set camera(camera: Nullable<Camera>);
|
|
26
|
+
/**
|
|
27
|
+
* Number of samples used for the SSAO calculations. Default value is 8.
|
|
28
|
+
*/
|
|
29
|
+
set samples(n: number);
|
|
30
|
+
get samples(): number;
|
|
31
|
+
/**
|
|
32
|
+
* The output strength of the SSAO post-process. Default value is 1.0.
|
|
33
|
+
*/
|
|
34
|
+
get totalStrength(): number;
|
|
35
|
+
set totalStrength(value: number);
|
|
36
|
+
/**
|
|
37
|
+
* The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0
|
|
38
|
+
*/
|
|
39
|
+
get radius(): number;
|
|
40
|
+
set radius(value: number);
|
|
41
|
+
/**
|
|
42
|
+
* Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.
|
|
43
|
+
*/
|
|
44
|
+
get maxZ(): number;
|
|
45
|
+
set maxZ(value: number);
|
|
46
|
+
/**
|
|
47
|
+
* In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much.
|
|
48
|
+
*/
|
|
49
|
+
get minZAspect(): number;
|
|
50
|
+
set minZAspect(value: number);
|
|
51
|
+
/**
|
|
52
|
+
* The base color of the SSAO post-process
|
|
53
|
+
* The final result is "base + ssao" between [0, 1]
|
|
54
|
+
*/
|
|
55
|
+
get base(): number;
|
|
56
|
+
set base(value: number);
|
|
57
|
+
/**
|
|
58
|
+
* Used in SSAO calculations to compensate for accuracy issues with depth values. Default 0.02.
|
|
59
|
+
*
|
|
60
|
+
* Normally you do not need to change this value, but you can experiment with it if you get a lot of in false self-occlusion on flat surfaces when using fewer than 16 samples. Useful range is normally [0..0.1] but higher values is allowed.
|
|
61
|
+
*/
|
|
62
|
+
get epsilon(): number;
|
|
63
|
+
set epsilon(n: number);
|
|
64
|
+
/**
|
|
65
|
+
* Skips the denoising (blur) stage of the SSAO calculations.
|
|
66
|
+
*
|
|
67
|
+
* Useful to temporarily set while experimenting with the other SSAO2 settings.
|
|
68
|
+
*/
|
|
69
|
+
set bypassBlur(b: boolean);
|
|
70
|
+
get bypassBlur(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Enables the configurable bilateral denoising (blurring) filter. Default is true.
|
|
73
|
+
* Set to false to instead use a legacy bilateral filter that can't be configured.
|
|
74
|
+
*
|
|
75
|
+
* The denoising filter runs after the SSAO calculations and is a very important step. Both options results in a so called bilateral being used, but the "expensive" one can be
|
|
76
|
+
* configured in several ways to fit your scene.
|
|
77
|
+
*/
|
|
78
|
+
set expensiveBlur(b: boolean);
|
|
79
|
+
get expensiveBlur(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The number of samples the bilateral filter uses in both dimensions when denoising the SSAO calculations. Default value is 16.
|
|
82
|
+
*
|
|
83
|
+
* A higher value should result in smoother shadows but will use more processing time in the shaders.
|
|
84
|
+
*
|
|
85
|
+
* A high value can cause the shadows to get to blurry or create visible artifacts (bands) near sharp details in the geometry. The artifacts can sometimes be mitigated by increasing the bilateralSoften setting.
|
|
86
|
+
*/
|
|
87
|
+
get bilateralSamples(): number;
|
|
88
|
+
set bilateralSamples(n: number);
|
|
89
|
+
/**
|
|
90
|
+
* Controls the shape of the denoising kernel used by the bilateral filter. Default value is 0.
|
|
91
|
+
*
|
|
92
|
+
* By default the bilateral filter acts like a box-filter, treating all samples on the same depth with equal weights. This is effective to maximize the denoising effect given a limited set of samples. However, it also often results in visible ghosting around sharp shadow regions and can spread out lines over large areas so they are no longer visible.
|
|
93
|
+
*
|
|
94
|
+
* Increasing this setting will make the filter pay less attention to samples further away from the center sample, reducing many artifacts but at the same time increasing noise.
|
|
95
|
+
*
|
|
96
|
+
* Useful value range is [0..1].
|
|
97
|
+
*/
|
|
98
|
+
get bilateralSoften(): number;
|
|
99
|
+
set bilateralSoften(n: number);
|
|
100
|
+
/**
|
|
101
|
+
* How forgiving the bilateral denoiser should be when rejecting samples. Default value is 0.
|
|
102
|
+
*
|
|
103
|
+
* A higher value results in the bilateral filter being more forgiving and thus doing a better job at denoising slanted and curved surfaces, but can lead to shadows spreading out around corners or between objects that are close to each other depth wise.
|
|
104
|
+
*
|
|
105
|
+
* Useful value range is normally [0..1], but higher values are allowed.
|
|
106
|
+
*/
|
|
107
|
+
get bilateralTolerance(): number;
|
|
108
|
+
set bilateralTolerance(n: number);
|
|
109
|
+
/**
|
|
110
|
+
* Indicates that the combine stage should use the current camera viewport to render the SSAO result on only a portion of the output texture (default: true).
|
|
111
|
+
*/
|
|
112
|
+
get useViewportInCombineStage(): boolean;
|
|
113
|
+
set useViewportInCombineStage(b: boolean);
|
|
114
|
+
/**
|
|
115
|
+
* Checks if all the post processes in the pipeline are ready.
|
|
116
|
+
* @returns true if all the post processes in the pipeline are ready
|
|
117
|
+
*/
|
|
118
|
+
isReady(): boolean;
|
|
119
|
+
private _scene;
|
|
120
|
+
/**
|
|
121
|
+
* Constructor of the SSR rendering pipeline
|
|
122
|
+
* @param name The rendering pipeline name
|
|
123
|
+
* @param scene The scene linked to this pipeline
|
|
124
|
+
*/
|
|
125
|
+
constructor(name: string, scene: Scene);
|
|
126
|
+
/**
|
|
127
|
+
* Disposes of the pipeline
|
|
128
|
+
*/
|
|
129
|
+
dispose(): void;
|
|
130
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ThinSSAO2PostProcess } from "../../thinSSAO2PostProcess.js";
|
|
2
|
+
import { ThinSSAO2BlurPostProcess } from "../../thinSSAO2BlurPostProcess.js";
|
|
3
|
+
import { ThinSSAO2CombinePostProcess } from "../../thinSSAO2CombinePostProcess.js";
|
|
4
|
+
/**
|
|
5
|
+
* The SSAO2 rendering pipeline is used to generate ambient occlusion effects.
|
|
6
|
+
*/
|
|
7
|
+
export class ThinSSAO2RenderingPipeline {
|
|
8
|
+
/**
|
|
9
|
+
* The camera to which the rendering pipeline will be applied.
|
|
10
|
+
*/
|
|
11
|
+
get camera() {
|
|
12
|
+
return this._ssaoPostProcess.camera;
|
|
13
|
+
}
|
|
14
|
+
set camera(camera) {
|
|
15
|
+
this._ssaoPostProcess.camera = camera;
|
|
16
|
+
this._ssaoCombinePostProcess.camera = camera;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Number of samples used for the SSAO calculations. Default value is 8.
|
|
20
|
+
*/
|
|
21
|
+
set samples(n) {
|
|
22
|
+
this._ssaoPostProcess.samples = n;
|
|
23
|
+
}
|
|
24
|
+
get samples() {
|
|
25
|
+
return this._ssaoPostProcess.samples;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The output strength of the SSAO post-process. Default value is 1.0.
|
|
29
|
+
*/
|
|
30
|
+
get totalStrength() {
|
|
31
|
+
return this._ssaoPostProcess.totalStrength;
|
|
32
|
+
}
|
|
33
|
+
set totalStrength(value) {
|
|
34
|
+
this._ssaoPostProcess.totalStrength = value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0
|
|
38
|
+
*/
|
|
39
|
+
get radius() {
|
|
40
|
+
return this._ssaoPostProcess.radius;
|
|
41
|
+
}
|
|
42
|
+
set radius(value) {
|
|
43
|
+
this._ssaoPostProcess.radius = value;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.
|
|
47
|
+
*/
|
|
48
|
+
get maxZ() {
|
|
49
|
+
return this._ssaoPostProcess.maxZ;
|
|
50
|
+
}
|
|
51
|
+
set maxZ(value) {
|
|
52
|
+
this._ssaoPostProcess.maxZ = value;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much.
|
|
56
|
+
*/
|
|
57
|
+
get minZAspect() {
|
|
58
|
+
return this._ssaoPostProcess.minZAspect;
|
|
59
|
+
}
|
|
60
|
+
set minZAspect(value) {
|
|
61
|
+
this._ssaoPostProcess.minZAspect = value;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The base color of the SSAO post-process
|
|
65
|
+
* The final result is "base + ssao" between [0, 1]
|
|
66
|
+
*/
|
|
67
|
+
get base() {
|
|
68
|
+
return this._ssaoPostProcess.base;
|
|
69
|
+
}
|
|
70
|
+
set base(value) {
|
|
71
|
+
this._ssaoPostProcess.base = value;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Used in SSAO calculations to compensate for accuracy issues with depth values. Default 0.02.
|
|
75
|
+
*
|
|
76
|
+
* Normally you do not need to change this value, but you can experiment with it if you get a lot of in false self-occlusion on flat surfaces when using fewer than 16 samples. Useful range is normally [0..0.1] but higher values is allowed.
|
|
77
|
+
*/
|
|
78
|
+
get epsilon() {
|
|
79
|
+
return this._ssaoPostProcess.epsilon;
|
|
80
|
+
}
|
|
81
|
+
set epsilon(n) {
|
|
82
|
+
this._ssaoPostProcess.epsilon = n;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Skips the denoising (blur) stage of the SSAO calculations.
|
|
86
|
+
*
|
|
87
|
+
* Useful to temporarily set while experimenting with the other SSAO2 settings.
|
|
88
|
+
*/
|
|
89
|
+
set bypassBlur(b) {
|
|
90
|
+
this._ssaoBlurXPostProcess.bypassBlur = b;
|
|
91
|
+
this._ssaoBlurYPostProcess.bypassBlur = b;
|
|
92
|
+
}
|
|
93
|
+
get bypassBlur() {
|
|
94
|
+
return this._ssaoBlurXPostProcess.bypassBlur;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Enables the configurable bilateral denoising (blurring) filter. Default is true.
|
|
98
|
+
* Set to false to instead use a legacy bilateral filter that can't be configured.
|
|
99
|
+
*
|
|
100
|
+
* The denoising filter runs after the SSAO calculations and is a very important step. Both options results in a so called bilateral being used, but the "expensive" one can be
|
|
101
|
+
* configured in several ways to fit your scene.
|
|
102
|
+
*/
|
|
103
|
+
set expensiveBlur(b) {
|
|
104
|
+
this._ssaoBlurXPostProcess.expensiveBlur = b;
|
|
105
|
+
this._ssaoBlurYPostProcess.expensiveBlur = b;
|
|
106
|
+
}
|
|
107
|
+
get expensiveBlur() {
|
|
108
|
+
return this._ssaoBlurXPostProcess.expensiveBlur;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The number of samples the bilateral filter uses in both dimensions when denoising the SSAO calculations. Default value is 16.
|
|
112
|
+
*
|
|
113
|
+
* A higher value should result in smoother shadows but will use more processing time in the shaders.
|
|
114
|
+
*
|
|
115
|
+
* A high value can cause the shadows to get to blurry or create visible artifacts (bands) near sharp details in the geometry. The artifacts can sometimes be mitigated by increasing the bilateralSoften setting.
|
|
116
|
+
*/
|
|
117
|
+
get bilateralSamples() {
|
|
118
|
+
return this._ssaoBlurXPostProcess.bilateralSamples;
|
|
119
|
+
}
|
|
120
|
+
set bilateralSamples(n) {
|
|
121
|
+
this._ssaoBlurXPostProcess.bilateralSamples = n;
|
|
122
|
+
this._ssaoBlurYPostProcess.bilateralSamples = n;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Controls the shape of the denoising kernel used by the bilateral filter. Default value is 0.
|
|
126
|
+
*
|
|
127
|
+
* By default the bilateral filter acts like a box-filter, treating all samples on the same depth with equal weights. This is effective to maximize the denoising effect given a limited set of samples. However, it also often results in visible ghosting around sharp shadow regions and can spread out lines over large areas so they are no longer visible.
|
|
128
|
+
*
|
|
129
|
+
* Increasing this setting will make the filter pay less attention to samples further away from the center sample, reducing many artifacts but at the same time increasing noise.
|
|
130
|
+
*
|
|
131
|
+
* Useful value range is [0..1].
|
|
132
|
+
*/
|
|
133
|
+
get bilateralSoften() {
|
|
134
|
+
return this._ssaoBlurXPostProcess.bilateralSoften;
|
|
135
|
+
}
|
|
136
|
+
set bilateralSoften(n) {
|
|
137
|
+
this._ssaoBlurXPostProcess.bilateralSoften = n;
|
|
138
|
+
this._ssaoBlurYPostProcess.bilateralSoften = n;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* How forgiving the bilateral denoiser should be when rejecting samples. Default value is 0.
|
|
142
|
+
*
|
|
143
|
+
* A higher value results in the bilateral filter being more forgiving and thus doing a better job at denoising slanted and curved surfaces, but can lead to shadows spreading out around corners or between objects that are close to each other depth wise.
|
|
144
|
+
*
|
|
145
|
+
* Useful value range is normally [0..1], but higher values are allowed.
|
|
146
|
+
*/
|
|
147
|
+
get bilateralTolerance() {
|
|
148
|
+
return this._ssaoBlurXPostProcess.bilateralTolerance;
|
|
149
|
+
}
|
|
150
|
+
set bilateralTolerance(n) {
|
|
151
|
+
this._ssaoBlurXPostProcess.bilateralTolerance = n;
|
|
152
|
+
this._ssaoBlurYPostProcess.bilateralTolerance = n;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Indicates that the combine stage should use the current camera viewport to render the SSAO result on only a portion of the output texture (default: true).
|
|
156
|
+
*/
|
|
157
|
+
get useViewportInCombineStage() {
|
|
158
|
+
return this._ssaoCombinePostProcess.useViewportInCombineStage;
|
|
159
|
+
}
|
|
160
|
+
set useViewportInCombineStage(b) {
|
|
161
|
+
this._ssaoCombinePostProcess.useViewportInCombineStage = b;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Checks if all the post processes in the pipeline are ready.
|
|
165
|
+
* @returns true if all the post processes in the pipeline are ready
|
|
166
|
+
*/
|
|
167
|
+
isReady() {
|
|
168
|
+
return this._ssaoPostProcess.isReady() && this._ssaoBlurXPostProcess.isReady() && this._ssaoBlurYPostProcess.isReady() && this._ssaoCombinePostProcess.isReady();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Constructor of the SSR rendering pipeline
|
|
172
|
+
* @param name The rendering pipeline name
|
|
173
|
+
* @param scene The scene linked to this pipeline
|
|
174
|
+
*/
|
|
175
|
+
constructor(name, scene) {
|
|
176
|
+
this.name = name;
|
|
177
|
+
this._scene = scene;
|
|
178
|
+
this._ssaoPostProcess = new ThinSSAO2PostProcess(this.name, this._scene);
|
|
179
|
+
this._ssaoBlurXPostProcess = new ThinSSAO2BlurPostProcess(this.name + " BlurX", this._scene.getEngine(), true);
|
|
180
|
+
this._ssaoBlurYPostProcess = new ThinSSAO2BlurPostProcess(this.name + " BlurY", this._scene.getEngine(), false);
|
|
181
|
+
this._ssaoCombinePostProcess = new ThinSSAO2CombinePostProcess(this.name + " Combiner", this._scene.getEngine());
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Disposes of the pipeline
|
|
185
|
+
*/
|
|
186
|
+
dispose() {
|
|
187
|
+
this._ssaoPostProcess?.dispose();
|
|
188
|
+
this._ssaoBlurXPostProcess?.dispose();
|
|
189
|
+
this._ssaoBlurYPostProcess?.dispose();
|
|
190
|
+
this._ssaoCombinePostProcess?.dispose();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=thinSSAO2RenderingPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinSSAO2RenderingPipeline.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/thinSSAO2RenderingPipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,sCAAgD;AAC/E,OAAO,EAAE,wBAAwB,EAAE,0CAAoD;AACvF,OAAO,EAAE,2BAA2B,EAAE,6CAAuD;AAE7F;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAenC;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;IACxC,CAAC;IAED,IAAW,MAAM,CAAC,MAAwB;QACtC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,MAAM,GAAG,MAAM,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAW,OAAO,CAAC,CAAS;QACxB,IAAI,CAAC,gBAAgB,CAAC,OAAO,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,g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tC,IAAI,CAAC,qBAAqB,EAAE,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { Camera, Nullable, Scene } from \"core/index\";\r\nimport { ThinSSAO2PostProcess } from \"core/PostProcesses/thinSSAO2PostProcess\";\r\nimport { ThinSSAO2BlurPostProcess } from \"core/PostProcesses/thinSSAO2BlurPostProcess\";\r\nimport { ThinSSAO2CombinePostProcess } from \"core/PostProcesses/thinSSAO2CombinePostProcess\";\r\n\r\n/**\r\n * The SSAO2 rendering pipeline is used to generate ambient occlusion effects.\r\n */\r\nexport class ThinSSAO2RenderingPipeline {\r\n /** @internal */\r\n public readonly _ssaoPostProcess: ThinSSAO2PostProcess;\r\n /** @internal */\r\n public readonly _ssaoBlurXPostProcess: ThinSSAO2BlurPostProcess;\r\n /** @internal */\r\n public readonly _ssaoBlurYPostProcess: ThinSSAO2BlurPostProcess;\r\n /** @internal */\r\n public readonly _ssaoCombinePostProcess: ThinSSAO2CombinePostProcess;\r\n\r\n /**\r\n * Gets or sets the name of the rendering pipeline\r\n */\r\n public name: string;\r\n\r\n /**\r\n * The camera to which the rendering pipeline will be applied.\r\n */\r\n public get camera() {\r\n return this._ssaoPostProcess.camera;\r\n }\r\n\r\n public set camera(camera: Nullable<Camera>) {\r\n this._ssaoPostProcess.camera = camera;\r\n this._ssaoCombinePostProcess.camera = camera;\r\n }\r\n\r\n /**\r\n * Number of samples used for the SSAO calculations. Default value is 8.\r\n */\r\n public set samples(n: number) {\r\n this._ssaoPostProcess.samples = n;\r\n }\r\n public get samples(): number {\r\n return this._ssaoPostProcess.samples;\r\n }\r\n\r\n /**\r\n * The output strength of the SSAO post-process. Default value is 1.0.\r\n */\r\n public get totalStrength() {\r\n return this._ssaoPostProcess.totalStrength;\r\n }\r\n\r\n public set totalStrength(value: number) {\r\n this._ssaoPostProcess.totalStrength = value;\r\n }\r\n\r\n /**\r\n * The radius around the analyzed pixel used by the SSAO post-process. Default value is 2.0\r\n */\r\n public get radius() {\r\n return this._ssaoPostProcess.radius;\r\n }\r\n\r\n public set radius(value: number) {\r\n this._ssaoPostProcess.radius = value;\r\n }\r\n\r\n /**\r\n * Maximum depth value to still render AO. A smooth falloff makes the dimming more natural, so there will be no abrupt shading change.\r\n */\r\n public get maxZ() {\r\n return this._ssaoPostProcess.maxZ;\r\n }\r\n\r\n public set maxZ(value: number) {\r\n this._ssaoPostProcess.maxZ = value;\r\n }\r\n\r\n /**\r\n * In order to save performances, SSAO radius is clamped on close geometry. This ratio changes by how much.\r\n */\r\n public get minZAspect() {\r\n return this._ssaoPostProcess.minZAspect;\r\n }\r\n\r\n public set minZAspect(value: number) {\r\n this._ssaoPostProcess.minZAspect = value;\r\n }\r\n\r\n /**\r\n * The base color of the SSAO post-process\r\n * The final result is \"base + ssao\" between [0, 1]\r\n */\r\n public get base() {\r\n return this._ssaoPostProcess.base;\r\n }\r\n\r\n public set base(value: number) {\r\n this._ssaoPostProcess.base = value;\r\n }\r\n\r\n /**\r\n * Used in SSAO calculations to compensate for accuracy issues with depth values. Default 0.02.\r\n *\r\n * Normally you do not need to change this value, but you can experiment with it if you get a lot of in false self-occlusion on flat surfaces when using fewer than 16 samples. Useful range is normally [0..0.1] but higher values is allowed.\r\n */\r\n public get epsilon(): number {\r\n return this._ssaoPostProcess.epsilon;\r\n }\r\n\r\n public set epsilon(n: number) {\r\n this._ssaoPostProcess.epsilon = n;\r\n }\r\n\r\n /**\r\n * Skips the denoising (blur) stage of the SSAO calculations.\r\n *\r\n * Useful to temporarily set while experimenting with the other SSAO2 settings.\r\n */\r\n public set bypassBlur(b: boolean) {\r\n this._ssaoBlurXPostProcess.bypassBlur = b;\r\n this._ssaoBlurYPostProcess.bypassBlur = b;\r\n }\r\n\r\n public get bypassBlur(): boolean {\r\n return this._ssaoBlurXPostProcess.bypassBlur;\r\n }\r\n\r\n /**\r\n * Enables the configurable bilateral denoising (blurring) filter. Default is true.\r\n * Set to false to instead use a legacy bilateral filter that can't be configured.\r\n *\r\n * The denoising filter runs after the SSAO calculations and is a very important step. Both options results in a so called bilateral being used, but the \"expensive\" one can be\r\n * configured in several ways to fit your scene.\r\n */\r\n public set expensiveBlur(b: boolean) {\r\n this._ssaoBlurXPostProcess.expensiveBlur = b;\r\n this._ssaoBlurYPostProcess.expensiveBlur = b;\r\n }\r\n\r\n public get expensiveBlur(): boolean {\r\n return this._ssaoBlurXPostProcess.expensiveBlur;\r\n }\r\n\r\n /**\r\n * The number of samples the bilateral filter uses in both dimensions when denoising the SSAO calculations. Default value is 16.\r\n *\r\n * A higher value should result in smoother shadows but will use more processing time in the shaders.\r\n *\r\n * A high value can cause the shadows to get to blurry or create visible artifacts (bands) near sharp details in the geometry. The artifacts can sometimes be mitigated by increasing the bilateralSoften setting.\r\n */\r\n public get bilateralSamples() {\r\n return this._ssaoBlurXPostProcess.bilateralSamples;\r\n }\r\n\r\n public set bilateralSamples(n: number) {\r\n this._ssaoBlurXPostProcess.bilateralSamples = n;\r\n this._ssaoBlurYPostProcess.bilateralSamples = n;\r\n }\r\n\r\n /**\r\n * Controls the shape of the denoising kernel used by the bilateral filter. Default value is 0.\r\n *\r\n * By default the bilateral filter acts like a box-filter, treating all samples on the same depth with equal weights. This is effective to maximize the denoising effect given a limited set of samples. However, it also often results in visible ghosting around sharp shadow regions and can spread out lines over large areas so they are no longer visible.\r\n *\r\n * Increasing this setting will make the filter pay less attention to samples further away from the center sample, reducing many artifacts but at the same time increasing noise.\r\n *\r\n * Useful value range is [0..1].\r\n */\r\n public get bilateralSoften() {\r\n return this._ssaoBlurXPostProcess.bilateralSoften;\r\n }\r\n\r\n public set bilateralSoften(n: number) {\r\n this._ssaoBlurXPostProcess.bilateralSoften = n;\r\n this._ssaoBlurYPostProcess.bilateralSoften = n;\r\n }\r\n\r\n /**\r\n * How forgiving the bilateral denoiser should be when rejecting samples. Default value is 0.\r\n *\r\n * A higher value results in the bilateral filter being more forgiving and thus doing a better job at denoising slanted and curved surfaces, but can lead to shadows spreading out around corners or between objects that are close to each other depth wise.\r\n *\r\n * Useful value range is normally [0..1], but higher values are allowed.\r\n */\r\n public get bilateralTolerance() {\r\n return this._ssaoBlurXPostProcess.bilateralTolerance;\r\n }\r\n\r\n public set bilateralTolerance(n: number) {\r\n this._ssaoBlurXPostProcess.bilateralTolerance = n;\r\n this._ssaoBlurYPostProcess.bilateralTolerance = n;\r\n }\r\n\r\n /**\r\n * Indicates that the combine stage should use the current camera viewport to render the SSAO result on only a portion of the output texture (default: true).\r\n */\r\n public get useViewportInCombineStage() {\r\n return this._ssaoCombinePostProcess.useViewportInCombineStage;\r\n }\r\n\r\n public set useViewportInCombineStage(b: boolean) {\r\n this._ssaoCombinePostProcess.useViewportInCombineStage = b;\r\n }\r\n\r\n /**\r\n * Checks if all the post processes in the pipeline are ready.\r\n * @returns true if all the post processes in the pipeline are ready\r\n */\r\n public isReady(): boolean {\r\n return this._ssaoPostProcess.isReady() && this._ssaoBlurXPostProcess.isReady() && this._ssaoBlurYPostProcess.isReady() && this._ssaoCombinePostProcess.isReady();\r\n }\r\n\r\n private _scene: Scene;\r\n\r\n /**\r\n * Constructor of the SSR rendering pipeline\r\n * @param name The rendering pipeline name\r\n * @param scene The scene linked to this pipeline\r\n */\r\n constructor(name: string, scene: Scene) {\r\n this.name = name;\r\n this._scene = scene;\r\n\r\n this._ssaoPostProcess = new ThinSSAO2PostProcess(this.name, this._scene);\r\n this._ssaoBlurXPostProcess = new ThinSSAO2BlurPostProcess(this.name + \" BlurX\", this._scene.getEngine(), true);\r\n this._ssaoBlurYPostProcess = new ThinSSAO2BlurPostProcess(this.name + \" BlurY\", this._scene.getEngine(), false);\r\n this._ssaoCombinePostProcess = new ThinSSAO2CombinePostProcess(this.name + \" Combiner\", this._scene.getEngine());\r\n }\r\n\r\n /**\r\n * Disposes of the pipeline\r\n */\r\n public dispose(): void {\r\n this._ssaoPostProcess?.dispose();\r\n this._ssaoBlurXPostProcess?.dispose();\r\n this._ssaoBlurYPostProcess?.dispose();\r\n this._ssaoCombinePostProcess?.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThinSSAO2BlurPostProcess extends EffectWrapper {
|
|
7
|
+
static readonly FragmentUrl = "ssao2";
|
|
8
|
+
static readonly Uniforms: string[];
|
|
9
|
+
static readonly Samplers: string[];
|
|
10
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
11
|
+
constructor(name: string, engine: Nullable<AbstractEngine> | undefined, isHorizontal: boolean, options?: EffectWrapperCreationOptions);
|
|
12
|
+
private readonly _isHorizontal;
|
|
13
|
+
private _bypassBlur;
|
|
14
|
+
textureSize: number;
|
|
15
|
+
bilateralSamples: number;
|
|
16
|
+
bilateralSoften: number;
|
|
17
|
+
bilateralTolerance: number;
|
|
18
|
+
set bypassBlur(b: boolean);
|
|
19
|
+
get bypassBlur(): boolean;
|
|
20
|
+
private _expensiveBlur;
|
|
21
|
+
set expensiveBlur(b: boolean);
|
|
22
|
+
get expensiveBlur(): boolean;
|
|
23
|
+
bind(noDefaultBindings?: boolean): void;
|
|
24
|
+
private _getSamplersForBlur;
|
|
25
|
+
private _getDefinesForBlur;
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
2
|
+
import { Engine } from "../Engines/engine.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export class ThinSSAO2BlurPostProcess extends EffectWrapper {
|
|
7
|
+
_gatherImports(useWebGPU, list) {
|
|
8
|
+
if (useWebGPU) {
|
|
9
|
+
this._webGPUReady = true;
|
|
10
|
+
list.push(import("../ShadersWGSL/ssao2.fragment.js"));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
list.push(import("../Shaders/ssao2.fragment.js"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
constructor(name, engine = null, isHorizontal, options) {
|
|
17
|
+
super({
|
|
18
|
+
...options,
|
|
19
|
+
name,
|
|
20
|
+
engine: engine || Engine.LastCreatedEngine,
|
|
21
|
+
useShaderStore: true,
|
|
22
|
+
useAsPostProcess: true,
|
|
23
|
+
fragmentShader: ThinSSAO2BlurPostProcess.FragmentUrl,
|
|
24
|
+
uniforms: ThinSSAO2BlurPostProcess.Uniforms,
|
|
25
|
+
samplers: ThinSSAO2BlurPostProcess.Samplers,
|
|
26
|
+
defines: "#define BLUR\n" + (isHorizontal ? "#define BLUR_H\n" : ""),
|
|
27
|
+
});
|
|
28
|
+
this._bypassBlur = false;
|
|
29
|
+
this.textureSize = 0;
|
|
30
|
+
this.bilateralSamples = 16;
|
|
31
|
+
this.bilateralSoften = 0;
|
|
32
|
+
this.bilateralTolerance = 0;
|
|
33
|
+
this._expensiveBlur = true;
|
|
34
|
+
this._isHorizontal = isHorizontal;
|
|
35
|
+
const defines = this._getDefinesForBlur(this.expensiveBlur, this.bypassBlur);
|
|
36
|
+
const samplers = this._getSamplersForBlur(this.bypassBlur);
|
|
37
|
+
this.updateEffect(defines, null, samplers);
|
|
38
|
+
}
|
|
39
|
+
set bypassBlur(b) {
|
|
40
|
+
const defines = this._getDefinesForBlur(this.expensiveBlur, b);
|
|
41
|
+
const samplers = this._getSamplersForBlur(b);
|
|
42
|
+
this.updateEffect(defines, null, samplers);
|
|
43
|
+
this._bypassBlur = b;
|
|
44
|
+
}
|
|
45
|
+
get bypassBlur() {
|
|
46
|
+
return this._bypassBlur;
|
|
47
|
+
}
|
|
48
|
+
set expensiveBlur(b) {
|
|
49
|
+
const defines = this._getDefinesForBlur(b, this._bypassBlur);
|
|
50
|
+
this.updateEffect(defines);
|
|
51
|
+
this._expensiveBlur = b;
|
|
52
|
+
}
|
|
53
|
+
get expensiveBlur() {
|
|
54
|
+
return this._expensiveBlur;
|
|
55
|
+
}
|
|
56
|
+
bind(noDefaultBindings = false) {
|
|
57
|
+
super.bind(noDefaultBindings);
|
|
58
|
+
const effect = this._drawWrapper.effect;
|
|
59
|
+
effect.setFloat("outSize", this.textureSize);
|
|
60
|
+
effect.setInt("samples", this.bilateralSamples);
|
|
61
|
+
effect.setFloat("soften", this.bilateralSoften);
|
|
62
|
+
effect.setFloat("tolerance", this.bilateralTolerance);
|
|
63
|
+
}
|
|
64
|
+
_getSamplersForBlur(disabled) {
|
|
65
|
+
return disabled ? ["textureSampler"] : ["textureSampler", "depthSampler"];
|
|
66
|
+
}
|
|
67
|
+
_getDefinesForBlur(bilateral, disabled) {
|
|
68
|
+
let define = "#define BLUR\n";
|
|
69
|
+
if (disabled) {
|
|
70
|
+
define += "#define BLUR_BYPASS\n";
|
|
71
|
+
}
|
|
72
|
+
if (!bilateral) {
|
|
73
|
+
define += "#define BLUR_LEGACY\n";
|
|
74
|
+
}
|
|
75
|
+
return this._isHorizontal ? define + "#define BLUR_H\n" : define;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
ThinSSAO2BlurPostProcess.FragmentUrl = "ssao2";
|
|
79
|
+
ThinSSAO2BlurPostProcess.Uniforms = ["outSize", "samples", "soften", "tolerance"];
|
|
80
|
+
ThinSSAO2BlurPostProcess.Samplers = ["textureSampler", "depthSampler"];
|
|
81
|
+
//# sourceMappingURL=thinSSAO2BlurPostProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinSSAO2BlurPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinSSAO2BlurPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GA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mBAAmB,CAAC,QAAiB;QACzC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAC9E,CAAC;IAEO,kBAAkB,CAAC,SAAkB,EAAE,QAAiB;QAC5D,IAAI,MAAM,GAAG,gBAAgB,CAAC;QAC9B,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,IAAI,uBAAuB,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,uBAAuB,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC;IACrE,CAAC;;AAhGsB,oCAAW,GAAG,OAAO,AAAV,CAAW;AAEtB,iCAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,AAAhD,CAAiD;AAEzD,iCAAQ,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,AAArC,CAAsC","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinSSAO2BlurPostProcess extends EffectWrapper {\r\n public static readonly FragmentUrl = \"ssao2\";\r\n\r\n public static readonly Uniforms = [\"outSize\", \"samples\", \"soften\", \"tolerance\"];\r\n\r\n public static readonly Samplers = [\"textureSampler\", \"depthSampler\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/ssao2.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/ssao2.fragment\"));\r\n }\r\n }\r\n\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, isHorizontal: boolean, options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinSSAO2BlurPostProcess.FragmentUrl,\r\n uniforms: ThinSSAO2BlurPostProcess.Uniforms,\r\n samplers: ThinSSAO2BlurPostProcess.Samplers,\r\n defines: \"#define BLUR\\n\" + (isHorizontal ? \"#define BLUR_H\\n\" : \"\"),\r\n });\r\n\r\n this._isHorizontal = isHorizontal;\r\n\r\n const defines = this._getDefinesForBlur(this.expensiveBlur, this.bypassBlur);\r\n const samplers = this._getSamplersForBlur(this.bypassBlur);\r\n\r\n this.updateEffect(defines, null, samplers);\r\n }\r\n\r\n private readonly _isHorizontal: boolean;\r\n private _bypassBlur: boolean = false;\r\n\r\n public textureSize: number = 0;\r\n\r\n public bilateralSamples: number = 16;\r\n\r\n public bilateralSoften: number = 0;\r\n\r\n public bilateralTolerance: number = 0;\r\n\r\n public set bypassBlur(b: boolean) {\r\n const defines = this._getDefinesForBlur(this.expensiveBlur, b);\r\n const samplers = this._getSamplersForBlur(b);\r\n\r\n this.updateEffect(defines, null, samplers);\r\n\r\n this._bypassBlur = b;\r\n }\r\n public get bypassBlur(): boolean {\r\n return this._bypassBlur;\r\n }\r\n\r\n private _expensiveBlur: boolean = true;\r\n\r\n public set expensiveBlur(b: boolean) {\r\n const defines = this._getDefinesForBlur(b, this._bypassBlur);\r\n\r\n this.updateEffect(defines);\r\n\r\n this._expensiveBlur = b;\r\n }\r\n public get expensiveBlur(): boolean {\r\n return this._expensiveBlur;\r\n }\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n effect.setFloat(\"outSize\", this.textureSize);\r\n effect.setInt(\"samples\", this.bilateralSamples);\r\n effect.setFloat(\"soften\", this.bilateralSoften);\r\n effect.setFloat(\"tolerance\", this.bilateralTolerance);\r\n }\r\n\r\n private _getSamplersForBlur(disabled: boolean): Array<string> {\r\n return disabled ? [\"textureSampler\"] : [\"textureSampler\", \"depthSampler\"];\r\n }\r\n\r\n private _getDefinesForBlur(bilateral: boolean, disabled: boolean): string {\r\n let define = \"#define BLUR\\n\";\r\n if (disabled) {\r\n define += \"#define BLUR_BYPASS\\n\";\r\n }\r\n if (!bilateral) {\r\n define += \"#define BLUR_LEGACY\\n\";\r\n }\r\n return this._isHorizontal ? define + \"#define BLUR_H\\n\" : define;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions, Camera } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThinSSAO2CombinePostProcess extends EffectWrapper {
|
|
7
|
+
static readonly FragmentUrl = "ssaoCombine";
|
|
8
|
+
static readonly Uniforms: string[];
|
|
9
|
+
static readonly Samplers: string[];
|
|
10
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
11
|
+
constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
|
|
12
|
+
camera: Nullable<Camera>;
|
|
13
|
+
useViewportInCombineStage: boolean;
|
|
14
|
+
bind(noDefaultBindings?: boolean): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
2
|
+
import { Engine } from "../Engines/engine.js";
|
|
3
|
+
import { TmpVectors } from "../Maths/math.vector.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export class ThinSSAO2CombinePostProcess extends EffectWrapper {
|
|
8
|
+
_gatherImports(useWebGPU, list) {
|
|
9
|
+
if (useWebGPU) {
|
|
10
|
+
this._webGPUReady = true;
|
|
11
|
+
list.push(import("../ShadersWGSL/ssaoCombine.fragment.js"));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
list.push(import("../Shaders/ssaoCombine.fragment.js"));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
constructor(name, engine = null, options) {
|
|
18
|
+
super({
|
|
19
|
+
...options,
|
|
20
|
+
name,
|
|
21
|
+
engine: engine || Engine.LastCreatedEngine,
|
|
22
|
+
useShaderStore: true,
|
|
23
|
+
useAsPostProcess: true,
|
|
24
|
+
fragmentShader: ThinSSAO2CombinePostProcess.FragmentUrl,
|
|
25
|
+
uniforms: ThinSSAO2CombinePostProcess.Uniforms,
|
|
26
|
+
samplers: ThinSSAO2CombinePostProcess.Samplers,
|
|
27
|
+
});
|
|
28
|
+
this.camera = null;
|
|
29
|
+
this.useViewportInCombineStage = true;
|
|
30
|
+
}
|
|
31
|
+
bind(noDefaultBindings = false) {
|
|
32
|
+
super.bind(noDefaultBindings);
|
|
33
|
+
const effect = this._drawWrapper.effect;
|
|
34
|
+
if (this.camera) {
|
|
35
|
+
const viewport = this.camera.viewport;
|
|
36
|
+
if (this.useViewportInCombineStage) {
|
|
37
|
+
effect.setVector4("viewport", TmpVectors.Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
effect.setVector4("viewport", TmpVectors.Vector4[0].copyFromFloats(0, 0, 1, 1));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
ThinSSAO2CombinePostProcess.FragmentUrl = "ssaoCombine";
|
|
46
|
+
ThinSSAO2CombinePostProcess.Uniforms = ["viewport"];
|
|
47
|
+
ThinSSAO2CombinePostProcess.Samplers = ["originalColor"];
|
|
48
|
+
//# sourceMappingURL=thinSSAO2CombinePostProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinSSAO2CombinePostProcess.js","s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AC;YACtC,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACjI,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACpF,CAAC;QACL,CAAC;IACL,CAAC;;AA7CsB,uCAAW,GAAG,aAAa,AAAhB,CAAiB;AAE5B,oCAAQ,GAAG,CAAC,UAAU,CAAC,AAAf,CAAgB;AAExB,oCAAQ,GAAG,CAAC,eAAe,CAAC,AAApB,CAAqB","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions, Camera } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { TmpVectors } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinSSAO2CombinePostProcess extends EffectWrapper {\r\n public static readonly FragmentUrl = \"ssaoCombine\";\r\n\r\n public static readonly Uniforms = [\"viewport\"];\r\n\r\n public static readonly Samplers = [\"originalColor\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/ssaoCombine.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/ssaoCombine.fragment\"));\r\n }\r\n }\r\n\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinSSAO2CombinePostProcess.FragmentUrl,\r\n uniforms: ThinSSAO2CombinePostProcess.Uniforms,\r\n samplers: ThinSSAO2CombinePostProcess.Samplers,\r\n });\r\n }\r\n\r\n public camera: Nullable<Camera> = null;\r\n\r\n public useViewportInCombineStage = true;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n if (this.camera) {\r\n const viewport = this.camera.viewport;\r\n if (this.useViewportInCombineStage) {\r\n effect.setVector4(\"viewport\", TmpVectors.Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));\r\n } else {\r\n effect.setVector4(\"viewport\", TmpVectors.Vector4[0].copyFromFloats(0, 0, 1, 1));\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Nullable, Scene, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
import { Camera } from "../Cameras/camera.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class ThinSSAO2PostProcess extends EffectWrapper {
|
|
8
|
+
private static readonly ORTHO_DEPTH_PROJECTION;
|
|
9
|
+
private static readonly PERSPECTIVE_DEPTH_PROJECTION;
|
|
10
|
+
static readonly FragmentUrl = "ssao2";
|
|
11
|
+
static readonly Uniforms: string[];
|
|
12
|
+
static readonly Samplers: string[];
|
|
13
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
14
|
+
camera: Nullable<Camera>;
|
|
15
|
+
private _textureWidth;
|
|
16
|
+
get textureWidth(): number;
|
|
17
|
+
set textureWidth(width: number);
|
|
18
|
+
private _textureHeight;
|
|
19
|
+
get textureHeight(): number;
|
|
20
|
+
set textureHeight(height: number);
|
|
21
|
+
private _samples;
|
|
22
|
+
set samples(n: number);
|
|
23
|
+
get samples(): number;
|
|
24
|
+
totalStrength: number;
|
|
25
|
+
radius: number;
|
|
26
|
+
maxZ: number;
|
|
27
|
+
minZAspect: number;
|
|
28
|
+
base: number;
|
|
29
|
+
private _epsilon;
|
|
30
|
+
set epsilon(n: number);
|
|
31
|
+
get epsilon(): number;
|
|
32
|
+
private _scene;
|
|
33
|
+
private _randomTexture;
|
|
34
|
+
private _sampleSphere;
|
|
35
|
+
constructor(name: string, scene: Scene, options?: EffectWrapperCreationOptions);
|
|
36
|
+
bind(noDefaultBindings?: boolean): void;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
private _createRandomTexture;
|
|
39
|
+
private _bits;
|
|
40
|
+
private _radicalInverseVdC;
|
|
41
|
+
private _hammersley;
|
|
42
|
+
private _hemisphereSampleUniform;
|
|
43
|
+
private _generateHemisphere;
|
|
44
|
+
private _getDefinesForSSAO;
|
|
45
|
+
}
|