@babylonjs/core 7.52.2 → 7.53.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/AudioV2/abstractAudio/abstractAudioBus.d.ts +11 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js +10 -0
- package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +10 -3
- package/AudioV2/abstractAudio/abstractSound.js +10 -0
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/audioBus.d.ts +4 -4
- package/AudioV2/abstractAudio/audioBus.js.map +1 -1
- package/AudioV2/abstractAudio/mainAudioBus.d.ts +2 -2
- package/AudioV2/abstractAudio/mainAudioBus.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +5 -5
- package/AudioV2/abstractAudio/staticSound.js +3 -3
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
- package/AudioV2/abstractAudio/streamingSound.js +1 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +30 -9
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +52 -26
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +24 -0
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js +30 -0
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.d.ts +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js +1 -0
- package/AudioV2/abstractAudio/subNodes/audioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.d.ts +86 -0
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js +29 -0
- package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +35 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +96 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -0
- package/AudioV2/abstractAudio/subProperties/index.d.ts +1 -0
- package/AudioV2/abstractAudio/subProperties/index.js +1 -0
- package/AudioV2/abstractAudio/subProperties/index.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +10 -5
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +37 -0
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +85 -0
- package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +5 -3
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +25 -2
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +2 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +33 -18
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +0 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -57
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +6 -0
- package/Engines/abstractEngine.js +3 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.common.js +4 -0
- package/Engines/engine.common.js.map +1 -1
- package/Engines/nativeEngine.d.ts +1 -0
- package/Engines/nativeEngine.js +3 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +1 -0
- package/Engines/nullEngine.js +1 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -0
- package/Engines/thinEngine.js +7 -4
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -1
- package/Engines/webgpuEngine.js +12 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +3 -12
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -36
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +5 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +17 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.d.ts +48 -0
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js +54 -0
- package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +3 -11
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +5 -14
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/index.d.ts +1 -0
- package/FlowGraph/Blocks/Data/index.js +1 -0
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +19 -13
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -5
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +2 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +1 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +2 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphInteger.d.ts +1 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.js +3 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +2 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +6 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -0
- package/FlowGraph/flowGraphExecutionBlock.js +4 -0
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/utils.d.ts +2 -1
- package/FlowGraph/utils.js +7 -2
- package/FlowGraph/utils.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.d.ts +126 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +497 -0
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +30 -4
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.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/PostProcesses/bloomTask.d.ts +2 -3
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -4
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +2 -2
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +2 -3
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +4 -5
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +6 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +14 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +11 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +18 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +76 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +170 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +45 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +10 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +29 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +7 -3
- package/FrameGraph/frameGraph.js +10 -4
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +2 -1
- package/FrameGraph/frameGraphTextureManager.js +4 -3
- package/FrameGraph/frameGraphTextureManager.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/nodeMaterial.js +3 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/material.js +5 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +7 -5
- package/Materials/materialHelper.geometryrendering.js +8 -3
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +2 -0
- package/Meshes/Builders/shapeBuilder.js +7 -4
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/geometry.js +4 -0
- package/Meshes/geometry.js.map +1 -1
- package/Particles/particleSystemComponent.d.ts +2 -1
- package/Particles/particleSystemComponent.js +2 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +23 -30
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +226 -411
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.d.ts +222 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js +373 -0
- package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js.map +1 -0
- package/PostProcesses/postProcess.d.ts +5 -0
- package/PostProcesses/postProcess.js +10 -2
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinDepthOfFieldEffect.d.ts +4 -4
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
- package/PostProcesses/thinSSRBlurCombinerPostProcess.d.ts +41 -0
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js +185 -0
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -0
- package/PostProcesses/thinSSRBlurPostProcess.d.ts +18 -0
- package/PostProcesses/thinSSRBlurPostProcess.js +47 -0
- package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinSSRPostProcess.d.ts +94 -0
- package/PostProcesses/thinSSRPostProcess.js +416 -0
- package/PostProcesses/thinSSRPostProcess.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +2 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +1 -1
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
- package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +1 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
- package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { Vector2 } from "../../../Maths/math.vector.js";
|
|
2
|
+
import { ThinSSRPostProcess } from "../../thinSSRPostProcess.js";
|
|
3
|
+
import { ThinSSRBlurPostProcess } from "../../thinSSRBlurPostProcess.js";
|
|
4
|
+
import { ThinSSRBlurCombinerPostProcess } from "../../thinSSRBlurCombinerPostProcess.js";
|
|
5
|
+
/**
|
|
6
|
+
* The SSR rendering pipeline is used to generate a reflection based on a flat mirror model.
|
|
7
|
+
*/
|
|
8
|
+
export class ThinSSRRenderingPipeline {
|
|
9
|
+
/**
|
|
10
|
+
* Gets or sets a boolean indicating if the SSR rendering pipeline is supported
|
|
11
|
+
*/
|
|
12
|
+
get isSSRSupported() {
|
|
13
|
+
return this._ssrPostProcess.isSSRSupported;
|
|
14
|
+
}
|
|
15
|
+
set isSSRSupported(supported) {
|
|
16
|
+
this._ssrPostProcess.isSSRSupported = supported;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets or sets the maxDistance used to define how far we look for reflection during the ray-marching on the reflected ray (default: 1000).
|
|
20
|
+
* Note that this value is a view (camera) space distance (not pixels!).
|
|
21
|
+
*/
|
|
22
|
+
get maxDistance() {
|
|
23
|
+
return this._ssrPostProcess.maxDistance;
|
|
24
|
+
}
|
|
25
|
+
set maxDistance(distance) {
|
|
26
|
+
this._ssrPostProcess.maxDistance = distance;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets or sets the step size used to iterate until the effect finds the color of the reflection's pixel. Should be an integer \>= 1 as it is the number of pixels we advance at each step (default: 1).
|
|
30
|
+
* Use higher values to improve performances (but at the expense of quality).
|
|
31
|
+
*/
|
|
32
|
+
get step() {
|
|
33
|
+
return this._ssrPostProcess.step;
|
|
34
|
+
}
|
|
35
|
+
set step(step) {
|
|
36
|
+
this._ssrPostProcess.step = step;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets or sets the thickness value used as tolerance when computing the intersection between the reflected ray and the scene (default: 0.5).
|
|
40
|
+
* If setting "enableAutomaticThicknessComputation" to true, you can use lower values for "thickness" (even 0), as the geometry thickness
|
|
41
|
+
* is automatically computed thank to the regular depth buffer + the backface depth buffer
|
|
42
|
+
*/
|
|
43
|
+
get thickness() {
|
|
44
|
+
return this._ssrPostProcess.thickness;
|
|
45
|
+
}
|
|
46
|
+
set thickness(thickness) {
|
|
47
|
+
this._ssrPostProcess.thickness = thickness;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets or sets the current reflection strength. 1.0 is an ideal value but can be increased/decreased for particular results (default: 1).
|
|
51
|
+
*/
|
|
52
|
+
get strength() {
|
|
53
|
+
return this._ssrPostProcess.strength;
|
|
54
|
+
}
|
|
55
|
+
set strength(strength) {
|
|
56
|
+
this._ssrPostProcess.strength = strength;
|
|
57
|
+
this._ssrBlurCombinerPostProcess.strength = strength;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets or sets the falloff exponent used to compute the reflection strength. Higher values lead to fainter reflections (default: 1).
|
|
61
|
+
*/
|
|
62
|
+
get reflectionSpecularFalloffExponent() {
|
|
63
|
+
return this._ssrPostProcess.reflectionSpecularFalloffExponent;
|
|
64
|
+
}
|
|
65
|
+
set reflectionSpecularFalloffExponent(exponent) {
|
|
66
|
+
this._ssrPostProcess.reflectionSpecularFalloffExponent = exponent;
|
|
67
|
+
this._ssrBlurCombinerPostProcess.reflectionSpecularFalloffExponent = exponent;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Maximum number of steps during the ray marching process after which we consider an intersection could not be found (default: 1000).
|
|
71
|
+
* Should be an integer value.
|
|
72
|
+
*/
|
|
73
|
+
get maxSteps() {
|
|
74
|
+
return this._ssrPostProcess.maxSteps;
|
|
75
|
+
}
|
|
76
|
+
set maxSteps(steps) {
|
|
77
|
+
this._ssrPostProcess.maxSteps = steps;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Gets or sets the factor applied when computing roughness. Default value is 0.2.
|
|
81
|
+
* When blurring based on roughness is enabled (meaning blurDispersionStrength \> 0), roughnessFactor is used as a global roughness factor applied on all objects.
|
|
82
|
+
* If you want to disable this global roughness set it to 0.
|
|
83
|
+
*/
|
|
84
|
+
get roughnessFactor() {
|
|
85
|
+
return this._ssrPostProcess.roughnessFactor;
|
|
86
|
+
}
|
|
87
|
+
set roughnessFactor(factor) {
|
|
88
|
+
this._ssrPostProcess.roughnessFactor = factor;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Number of steps to skip at start when marching the ray to avoid self collisions (default: 1)
|
|
92
|
+
* 1 should normally be a good value, depending on the scene you may need to use a higher value (2 or 3)
|
|
93
|
+
*/
|
|
94
|
+
get selfCollisionNumSkip() {
|
|
95
|
+
return this._ssrPostProcess.selfCollisionNumSkip;
|
|
96
|
+
}
|
|
97
|
+
set selfCollisionNumSkip(skip) {
|
|
98
|
+
this._ssrPostProcess.selfCollisionNumSkip = skip;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets or sets the minimum value for one of the reflectivity component of the material to consider it for SSR (default: 0.04).
|
|
102
|
+
* If all r/g/b components of the reflectivity is below or equal this value, the pixel will not be considered reflective and SSR won't be applied.
|
|
103
|
+
*/
|
|
104
|
+
get reflectivityThreshold() {
|
|
105
|
+
return this._ssrPostProcess.reflectivityThreshold;
|
|
106
|
+
}
|
|
107
|
+
set reflectivityThreshold(threshold) {
|
|
108
|
+
const currentThreshold = this._ssrPostProcess.reflectivityThreshold;
|
|
109
|
+
if (threshold === currentThreshold) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this._ssrPostProcess.reflectivityThreshold = threshold;
|
|
113
|
+
this._ssrBlurCombinerPostProcess.reflectivityThreshold = threshold;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets or sets the blur dispersion strength. Set this value to 0 to disable blurring (default: 0.03)
|
|
117
|
+
* The reflections are blurred based on the roughness of the surface and the distance between the pixel shaded and the reflected pixel: the higher the distance the more blurry the reflection is.
|
|
118
|
+
* blurDispersionStrength allows to increase or decrease this effect.
|
|
119
|
+
*/
|
|
120
|
+
get blurDispersionStrength() {
|
|
121
|
+
return this._ssrBlurXPostProcess.blurStrength;
|
|
122
|
+
}
|
|
123
|
+
set blurDispersionStrength(strength) {
|
|
124
|
+
if (strength === this._ssrBlurXPostProcess.blurStrength) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this._ssrPostProcess.useBlur = strength > 0;
|
|
128
|
+
this._ssrBlurXPostProcess.blurStrength = strength;
|
|
129
|
+
this._ssrBlurYPostProcess.blurStrength = strength;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets or sets whether or not smoothing reflections is enabled (default: false)
|
|
133
|
+
* Enabling smoothing will require more GPU power.
|
|
134
|
+
* Note that this setting has no effect if step = 1: it's only used if step \> 1.
|
|
135
|
+
*/
|
|
136
|
+
get enableSmoothReflections() {
|
|
137
|
+
return this._ssrPostProcess.enableSmoothReflections;
|
|
138
|
+
}
|
|
139
|
+
set enableSmoothReflections(enabled) {
|
|
140
|
+
this._ssrPostProcess.enableSmoothReflections = enabled;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Gets or sets the environment cube texture used to define the reflection when the reflected rays of SSR leave the view space or when the maxDistance/maxSteps is reached.
|
|
144
|
+
*/
|
|
145
|
+
get environmentTexture() {
|
|
146
|
+
return this._ssrPostProcess.environmentTexture;
|
|
147
|
+
}
|
|
148
|
+
set environmentTexture(texture) {
|
|
149
|
+
this._ssrPostProcess.environmentTexture = texture;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Gets or sets the boolean defining if the environment texture is a standard cubemap (false) or a probe (true). Default value is false.
|
|
153
|
+
* Note: a probe cube texture is treated differently than an ordinary cube texture because the Y axis is reversed.
|
|
154
|
+
*/
|
|
155
|
+
get environmentTextureIsProbe() {
|
|
156
|
+
return this._ssrPostProcess.environmentTextureIsProbe;
|
|
157
|
+
}
|
|
158
|
+
set environmentTextureIsProbe(isProbe) {
|
|
159
|
+
this._ssrPostProcess.environmentTextureIsProbe = isProbe;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets or sets a boolean indicating if the reflections should be attenuated at the screen borders (default: true).
|
|
163
|
+
*/
|
|
164
|
+
get attenuateScreenBorders() {
|
|
165
|
+
return this._ssrPostProcess.attenuateScreenBorders;
|
|
166
|
+
}
|
|
167
|
+
set attenuateScreenBorders(attenuate) {
|
|
168
|
+
this._ssrPostProcess.attenuateScreenBorders = attenuate;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Gets or sets a boolean indicating if the reflections should be attenuated according to the distance of the intersection (default: true).
|
|
172
|
+
*/
|
|
173
|
+
get attenuateIntersectionDistance() {
|
|
174
|
+
return this._ssrPostProcess.attenuateIntersectionDistance;
|
|
175
|
+
}
|
|
176
|
+
set attenuateIntersectionDistance(attenuate) {
|
|
177
|
+
this._ssrPostProcess.attenuateIntersectionDistance = attenuate;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Gets or sets a boolean indicating if the reflections should be attenuated according to the number of iterations performed to find the intersection (default: true).
|
|
181
|
+
*/
|
|
182
|
+
get attenuateIntersectionIterations() {
|
|
183
|
+
return this._ssrPostProcess.attenuateIntersectionIterations;
|
|
184
|
+
}
|
|
185
|
+
set attenuateIntersectionIterations(attenuate) {
|
|
186
|
+
this._ssrPostProcess.attenuateIntersectionIterations = attenuate;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Gets or sets a boolean indicating if the reflections should be attenuated when the reflection ray is facing the camera (the view direction) (default: false).
|
|
190
|
+
*/
|
|
191
|
+
get attenuateFacingCamera() {
|
|
192
|
+
return this._ssrPostProcess.attenuateFacingCamera;
|
|
193
|
+
}
|
|
194
|
+
set attenuateFacingCamera(attenuate) {
|
|
195
|
+
this._ssrPostProcess.attenuateFacingCamera = attenuate;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Gets or sets a boolean indicating if the backface reflections should be attenuated (default: false).
|
|
199
|
+
*/
|
|
200
|
+
get attenuateBackfaceReflection() {
|
|
201
|
+
return this._ssrPostProcess.attenuateBackfaceReflection;
|
|
202
|
+
}
|
|
203
|
+
set attenuateBackfaceReflection(attenuate) {
|
|
204
|
+
this._ssrPostProcess.attenuateBackfaceReflection = attenuate;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Gets or sets a boolean indicating if the ray should be clipped to the frustum (default: true).
|
|
208
|
+
* You can try to set this parameter to false to save some performances: it may produce some artefacts in some cases, but generally they won't really be visible
|
|
209
|
+
*/
|
|
210
|
+
get clipToFrustum() {
|
|
211
|
+
return this._ssrPostProcess.clipToFrustum;
|
|
212
|
+
}
|
|
213
|
+
set clipToFrustum(clip) {
|
|
214
|
+
this._ssrPostProcess.clipToFrustum = clip;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets or sets a boolean indicating whether the blending between the current color pixel and the reflection color should be done with a Fresnel coefficient (default: false).
|
|
218
|
+
* It is more physically accurate to use the Fresnel coefficient (otherwise it uses the reflectivity of the material for blending), but it is also more expensive when you use blur (when blurDispersionStrength \> 0).
|
|
219
|
+
*/
|
|
220
|
+
get useFresnel() {
|
|
221
|
+
return this._ssrPostProcess.useFresnel;
|
|
222
|
+
}
|
|
223
|
+
set useFresnel(fresnel) {
|
|
224
|
+
this._ssrPostProcess.useFresnel = fresnel;
|
|
225
|
+
this._ssrBlurCombinerPostProcess.useFresnel = fresnel;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Gets or sets a boolean defining if geometry thickness should be computed automatically (default: false).
|
|
229
|
+
* When enabled, a depth renderer is created which will render the back faces of the scene to a depth texture (meaning additional work for the GPU).
|
|
230
|
+
* In that mode, the "thickness" property is still used as an offset to compute the ray intersection, but you can typically use a much lower
|
|
231
|
+
* value than when enableAutomaticThicknessComputation is false (it's even possible to use a value of 0 when using low values for "step")
|
|
232
|
+
* Note that for performance reasons, this option will only apply to the first camera to which the rendering pipeline is attached!
|
|
233
|
+
*/
|
|
234
|
+
get enableAutomaticThicknessComputation() {
|
|
235
|
+
return this._ssrPostProcess.enableAutomaticThicknessComputation;
|
|
236
|
+
}
|
|
237
|
+
set enableAutomaticThicknessComputation(automatic) {
|
|
238
|
+
if (this._ssrPostProcess.enableAutomaticThicknessComputation === automatic) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
this._ssrPostProcess.enableAutomaticThicknessComputation = automatic;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Gets or sets a boolean defining if the input color texture is in gamma space (default: true)
|
|
245
|
+
* The SSR effect works in linear space, so if the input texture is in gamma space, we must convert the texture to linear space before applying the effect
|
|
246
|
+
*/
|
|
247
|
+
get inputTextureColorIsInGammaSpace() {
|
|
248
|
+
return this._ssrPostProcess.inputTextureColorIsInGammaSpace;
|
|
249
|
+
}
|
|
250
|
+
set inputTextureColorIsInGammaSpace(gammaSpace) {
|
|
251
|
+
if (this._ssrPostProcess.inputTextureColorIsInGammaSpace === gammaSpace) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this._ssrPostProcess.inputTextureColorIsInGammaSpace = gammaSpace;
|
|
255
|
+
this._ssrBlurCombinerPostProcess.inputTextureColorIsInGammaSpace = gammaSpace;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Gets or sets a boolean defining if the output color texture generated by the SSR pipeline should be in gamma space (default: true)
|
|
259
|
+
* If you have a post-process that comes after the SSR and that post-process needs the input to be in a linear space, you must disable generateOutputInGammaSpace
|
|
260
|
+
*/
|
|
261
|
+
get generateOutputInGammaSpace() {
|
|
262
|
+
return this._ssrPostProcess.generateOutputInGammaSpace;
|
|
263
|
+
}
|
|
264
|
+
set generateOutputInGammaSpace(gammaSpace) {
|
|
265
|
+
if (this._ssrPostProcess.generateOutputInGammaSpace === gammaSpace) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this._ssrPostProcess.generateOutputInGammaSpace = gammaSpace;
|
|
269
|
+
this._ssrBlurCombinerPostProcess.generateOutputInGammaSpace = gammaSpace;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Gets or sets a boolean indicating if the effect should be rendered in debug mode (default: false).
|
|
273
|
+
* In this mode, colors have this meaning:
|
|
274
|
+
* - blue: the ray hit the max distance (we reached maxDistance)
|
|
275
|
+
* - red: the ray ran out of steps (we reached maxSteps)
|
|
276
|
+
* - yellow: the ray went off screen
|
|
277
|
+
* - green: the ray hit a surface. The brightness of the green color is proportional to the distance between the ray origin and the intersection point: A brighter green means more computation than a darker green.
|
|
278
|
+
* In the first 3 cases, the final color is calculated by mixing the skybox color with the pixel color (if environmentTexture is defined), otherwise the pixel color is not modified
|
|
279
|
+
* You should try to get as few blue/red/yellow pixels as possible, as this means that the ray has gone further than if it had hit a surface.
|
|
280
|
+
*/
|
|
281
|
+
get debug() {
|
|
282
|
+
return this._ssrPostProcess.debug;
|
|
283
|
+
}
|
|
284
|
+
set debug(value) {
|
|
285
|
+
if (this._ssrPostProcess.debug === value) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
this._ssrPostProcess.debug = value;
|
|
289
|
+
this._ssrBlurCombinerPostProcess.debug = value;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Gets or sets the camera to use to render the reflection
|
|
293
|
+
*/
|
|
294
|
+
get camera() {
|
|
295
|
+
return this._ssrPostProcess.camera;
|
|
296
|
+
}
|
|
297
|
+
set camera(camera) {
|
|
298
|
+
this._ssrPostProcess.camera = camera;
|
|
299
|
+
this._ssrBlurCombinerPostProcess.camera = camera;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Gets or sets a boolean indicating if the depth buffer stores screen space depth instead of camera view space depth.
|
|
303
|
+
*/
|
|
304
|
+
get useScreenspaceDepth() {
|
|
305
|
+
return this._ssrPostProcess.useScreenspaceDepth;
|
|
306
|
+
}
|
|
307
|
+
set useScreenspaceDepth(use) {
|
|
308
|
+
this._ssrPostProcess.useScreenspaceDepth = use;
|
|
309
|
+
this._ssrBlurCombinerPostProcess.useScreenspaceDepth = use;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Gets or sets a boolean indicating if the normals are in world space (false by default, meaning normals are in camera view space).
|
|
313
|
+
*/
|
|
314
|
+
get normalsAreInWorldSpace() {
|
|
315
|
+
return this._ssrPostProcess.normalsAreInWorldSpace;
|
|
316
|
+
}
|
|
317
|
+
set normalsAreInWorldSpace(normalsAreInWorldSpace) {
|
|
318
|
+
this._ssrPostProcess.normalsAreInWorldSpace = normalsAreInWorldSpace;
|
|
319
|
+
this._ssrBlurCombinerPostProcess.normalsAreInWorldSpace = normalsAreInWorldSpace;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Gets or sets a boolean indicating if the normals are encoded as unsigned, that is normalUnsigned = normal*0.5+0.5 (false by default).
|
|
323
|
+
*/
|
|
324
|
+
get normalsAreUnsigned() {
|
|
325
|
+
return this._ssrPostProcess.normalsAreUnsigned;
|
|
326
|
+
}
|
|
327
|
+
set normalsAreUnsigned(normalsAreUnsigned) {
|
|
328
|
+
this._ssrPostProcess.normalsAreUnsigned = normalsAreUnsigned;
|
|
329
|
+
this._ssrBlurCombinerPostProcess.normalsAreUnsigned = normalsAreUnsigned;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Checks if all the post processes in the pipeline are ready.
|
|
333
|
+
* @returns true if all the post processes in the pipeline are ready
|
|
334
|
+
*/
|
|
335
|
+
isReady() {
|
|
336
|
+
return this._ssrPostProcess.isReady() && this._ssrBlurXPostProcess.isReady() && this._ssrBlurYPostProcess.isReady() && this._ssrBlurCombinerPostProcess.isReady();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Constructor of the SSR rendering pipeline
|
|
340
|
+
* @param name The rendering pipeline name
|
|
341
|
+
* @param scene The scene linked to this pipeline
|
|
342
|
+
*/
|
|
343
|
+
constructor(name, scene) {
|
|
344
|
+
/**
|
|
345
|
+
* Gets or sets the downsample factor used to reduce the size of the texture used to compute the SSR contribution (default: 0).
|
|
346
|
+
* Use 0 to render the SSR contribution at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.
|
|
347
|
+
* Note that it is used only when blurring is enabled (blurDispersionStrength \> 0), because in that mode the SSR contribution is generated in a separate texture.
|
|
348
|
+
*/
|
|
349
|
+
this.ssrDownsample = 0;
|
|
350
|
+
/**
|
|
351
|
+
* Gets or sets the downsample factor used to reduce the size of the textures used to blur the reflection effect (default: 0).
|
|
352
|
+
* Use 0 to blur at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.
|
|
353
|
+
*/
|
|
354
|
+
this.blurDownsample = 0;
|
|
355
|
+
this.name = name;
|
|
356
|
+
this._scene = scene;
|
|
357
|
+
this._ssrPostProcess = new ThinSSRPostProcess(this.name, this._scene);
|
|
358
|
+
this._ssrBlurXPostProcess = new ThinSSRBlurPostProcess(this.name + " BlurX", this._scene.getEngine(), new Vector2(1, 0));
|
|
359
|
+
this._ssrBlurYPostProcess = new ThinSSRBlurPostProcess(this.name + " BlurY", this._scene.getEngine(), new Vector2(0, 1));
|
|
360
|
+
this._ssrBlurCombinerPostProcess = new ThinSSRBlurCombinerPostProcess(this.name + " BlurCombiner", this._scene.getEngine());
|
|
361
|
+
this._ssrPostProcess.useBlur = this._ssrBlurXPostProcess.blurStrength > 0;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Disposes of the pipeline
|
|
365
|
+
*/
|
|
366
|
+
dispose() {
|
|
367
|
+
this._ssrPostProcess?.dispose();
|
|
368
|
+
this._ssrBlurXPostProcess?.dispose();
|
|
369
|
+
this._ssrBlurYPostProcess?.dispose();
|
|
370
|
+
this._ssrBlurCombinerPostProcess?.dispose();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=thinSSRRenderingPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinSSRRenderingPipeline.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,kBAAkB,EAAE,oCAA8C;AAC3E,OAAO,EAAE,sBAAsB,EAAE,wCAAkD;AACnF,OAAO,EAAE,8BAA8B,EAAE,gDAA0D;AAEnG;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAejC;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC;IAC/C,CAAC;IAED,IAAW,cAAc,CAAC,SAAkB;QACxC,IAAI,CAAC,eAAe,CAAC,cAAc,GAAG,SAAS,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,IAAW,WAAW,CAAC,QAAgB;QACnC,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,QAAQ,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;IACrC,CAAC;IAED,IAAW,IAAI,CAAC,IAAY;QACxB,IAAI,CAAC,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC;IACrC,CAAC;IAED;;;;OAIG;I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,CAAC,IAAI,CAAC,IAAI,GAAG,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAE5H,IAAI,CAAC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,YAAY,GAAG,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,2BAA2B,EAAE,OAAO,EAAE,CAAC;IAChD,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, CubeTexture, Scene, Camera } from \"core/index\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { ThinSSRPostProcess } from \"core/PostProcesses/thinSSRPostProcess\";\r\nimport { ThinSSRBlurPostProcess } from \"core/PostProcesses/thinSSRBlurPostProcess\";\r\nimport { ThinSSRBlurCombinerPostProcess } from \"core/PostProcesses/thinSSRBlurCombinerPostProcess\";\r\n\r\n/**\r\n * The SSR rendering pipeline is used to generate a reflection based on a flat mirror model.\r\n */\r\nexport class ThinSSRRenderingPipeline {\r\n /** @internal */\r\n public readonly _ssrPostProcess: ThinSSRPostProcess;\r\n /** @internal */\r\n public readonly _ssrBlurXPostProcess: ThinSSRBlurPostProcess;\r\n /** @internal */\r\n public readonly _ssrBlurYPostProcess: ThinSSRBlurPostProcess;\r\n /** @internal */\r\n public readonly _ssrBlurCombinerPostProcess: ThinSSRBlurCombinerPostProcess;\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 * Gets or sets a boolean indicating if the SSR rendering pipeline is supported\r\n */\r\n public get isSSRSupported(): boolean {\r\n return this._ssrPostProcess.isSSRSupported;\r\n }\r\n\r\n public set isSSRSupported(supported: boolean) {\r\n this._ssrPostProcess.isSSRSupported = supported;\r\n }\r\n\r\n /**\r\n * Gets or sets the maxDistance used to define how far we look for reflection during the ray-marching on the reflected ray (default: 1000).\r\n * Note that this value is a view (camera) space distance (not pixels!).\r\n */\r\n public get maxDistance() {\r\n return this._ssrPostProcess.maxDistance;\r\n }\r\n\r\n public set maxDistance(distance: number) {\r\n this._ssrPostProcess.maxDistance = distance;\r\n }\r\n\r\n /**\r\n * Gets or sets the step size used to iterate until the effect finds the color of the reflection's pixel. Should be an integer \\>= 1 as it is the number of pixels we advance at each step (default: 1).\r\n * Use higher values to improve performances (but at the expense of quality).\r\n */\r\n public get step() {\r\n return this._ssrPostProcess.step;\r\n }\r\n\r\n public set step(step: number) {\r\n this._ssrPostProcess.step = step;\r\n }\r\n\r\n /**\r\n * Gets or sets the thickness value used as tolerance when computing the intersection between the reflected ray and the scene (default: 0.5).\r\n * If setting \"enableAutomaticThicknessComputation\" to true, you can use lower values for \"thickness\" (even 0), as the geometry thickness\r\n * is automatically computed thank to the regular depth buffer + the backface depth buffer\r\n */\r\n public get thickness() {\r\n return this._ssrPostProcess.thickness;\r\n }\r\n\r\n public set thickness(thickness: number) {\r\n this._ssrPostProcess.thickness = thickness;\r\n }\r\n\r\n /**\r\n * Gets or sets the current reflection strength. 1.0 is an ideal value but can be increased/decreased for particular results (default: 1).\r\n */\r\n public get strength() {\r\n return this._ssrPostProcess.strength;\r\n }\r\n\r\n public set strength(strength: number) {\r\n this._ssrPostProcess.strength = strength;\r\n this._ssrBlurCombinerPostProcess.strength = strength;\r\n }\r\n\r\n /**\r\n * Gets or sets the falloff exponent used to compute the reflection strength. Higher values lead to fainter reflections (default: 1).\r\n */\r\n public get reflectionSpecularFalloffExponent() {\r\n return this._ssrPostProcess.reflectionSpecularFalloffExponent;\r\n }\r\n\r\n public set reflectionSpecularFalloffExponent(exponent: number) {\r\n this._ssrPostProcess.reflectionSpecularFalloffExponent = exponent;\r\n this._ssrBlurCombinerPostProcess.reflectionSpecularFalloffExponent = exponent;\r\n }\r\n\r\n /**\r\n * Maximum number of steps during the ray marching process after which we consider an intersection could not be found (default: 1000).\r\n * Should be an integer value.\r\n */\r\n public get maxSteps() {\r\n return this._ssrPostProcess.maxSteps;\r\n }\r\n\r\n public set maxSteps(steps: number) {\r\n this._ssrPostProcess.maxSteps = steps;\r\n }\r\n\r\n /**\r\n * Gets or sets the factor applied when computing roughness. Default value is 0.2.\r\n * When blurring based on roughness is enabled (meaning blurDispersionStrength \\> 0), roughnessFactor is used as a global roughness factor applied on all objects.\r\n * If you want to disable this global roughness set it to 0.\r\n */\r\n public get roughnessFactor() {\r\n return this._ssrPostProcess.roughnessFactor;\r\n }\r\n\r\n public set roughnessFactor(factor: number) {\r\n this._ssrPostProcess.roughnessFactor = factor;\r\n }\r\n\r\n /**\r\n * Number of steps to skip at start when marching the ray to avoid self collisions (default: 1)\r\n * 1 should normally be a good value, depending on the scene you may need to use a higher value (2 or 3)\r\n */\r\n public get selfCollisionNumSkip() {\r\n return this._ssrPostProcess.selfCollisionNumSkip;\r\n }\r\n\r\n public set selfCollisionNumSkip(skip: number) {\r\n this._ssrPostProcess.selfCollisionNumSkip = skip;\r\n }\r\n\r\n /**\r\n * Gets or sets the minimum value for one of the reflectivity component of the material to consider it for SSR (default: 0.04).\r\n * If all r/g/b components of the reflectivity is below or equal this value, the pixel will not be considered reflective and SSR won't be applied.\r\n */\r\n public get reflectivityThreshold() {\r\n return this._ssrPostProcess.reflectivityThreshold;\r\n }\r\n\r\n public set reflectivityThreshold(threshold: number) {\r\n const currentThreshold = this._ssrPostProcess.reflectivityThreshold;\r\n\r\n if (threshold === currentThreshold) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.reflectivityThreshold = threshold;\r\n this._ssrBlurCombinerPostProcess.reflectivityThreshold = threshold;\r\n }\r\n\r\n /**\r\n * Gets or sets the downsample factor used to reduce the size of the texture used to compute the SSR contribution (default: 0).\r\n * Use 0 to render the SSR contribution at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.\r\n * Note that it is used only when blurring is enabled (blurDispersionStrength \\> 0), because in that mode the SSR contribution is generated in a separate texture.\r\n */\r\n public ssrDownsample = 0;\r\n\r\n /**\r\n * Gets or sets the blur dispersion strength. Set this value to 0 to disable blurring (default: 0.03)\r\n * The reflections are blurred based on the roughness of the surface and the distance between the pixel shaded and the reflected pixel: the higher the distance the more blurry the reflection is.\r\n * blurDispersionStrength allows to increase or decrease this effect.\r\n */\r\n public get blurDispersionStrength() {\r\n return this._ssrBlurXPostProcess.blurStrength;\r\n }\r\n\r\n public set blurDispersionStrength(strength: number) {\r\n if (strength === this._ssrBlurXPostProcess.blurStrength) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.useBlur = strength > 0;\r\n\r\n this._ssrBlurXPostProcess.blurStrength = strength;\r\n this._ssrBlurYPostProcess.blurStrength = strength;\r\n }\r\n\r\n /**\r\n * Gets or sets the downsample factor used to reduce the size of the textures used to blur the reflection effect (default: 0).\r\n * Use 0 to blur at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.\r\n */\r\n public blurDownsample = 0;\r\n\r\n /**\r\n * Gets or sets whether or not smoothing reflections is enabled (default: false)\r\n * Enabling smoothing will require more GPU power.\r\n * Note that this setting has no effect if step = 1: it's only used if step \\> 1.\r\n */\r\n public get enableSmoothReflections(): boolean {\r\n return this._ssrPostProcess.enableSmoothReflections;\r\n }\r\n\r\n public set enableSmoothReflections(enabled: boolean) {\r\n this._ssrPostProcess.enableSmoothReflections = enabled;\r\n }\r\n\r\n /**\r\n * Gets or sets the environment cube texture used to define the reflection when the reflected rays of SSR leave the view space or when the maxDistance/maxSteps is reached.\r\n */\r\n public get environmentTexture() {\r\n return this._ssrPostProcess.environmentTexture;\r\n }\r\n\r\n public set environmentTexture(texture: Nullable<CubeTexture>) {\r\n this._ssrPostProcess.environmentTexture = texture;\r\n }\r\n\r\n /**\r\n * Gets or sets the boolean defining if the environment texture is a standard cubemap (false) or a probe (true). Default value is false.\r\n * Note: a probe cube texture is treated differently than an ordinary cube texture because the Y axis is reversed.\r\n */\r\n public get environmentTextureIsProbe(): boolean {\r\n return this._ssrPostProcess.environmentTextureIsProbe;\r\n }\r\n\r\n public set environmentTextureIsProbe(isProbe: boolean) {\r\n this._ssrPostProcess.environmentTextureIsProbe = isProbe;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the reflections should be attenuated at the screen borders (default: true).\r\n */\r\n public get attenuateScreenBorders() {\r\n return this._ssrPostProcess.attenuateScreenBorders;\r\n }\r\n\r\n public set attenuateScreenBorders(attenuate: boolean) {\r\n this._ssrPostProcess.attenuateScreenBorders = attenuate;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the reflections should be attenuated according to the distance of the intersection (default: true).\r\n */\r\n public get attenuateIntersectionDistance() {\r\n return this._ssrPostProcess.attenuateIntersectionDistance;\r\n }\r\n\r\n public set attenuateIntersectionDistance(attenuate: boolean) {\r\n this._ssrPostProcess.attenuateIntersectionDistance = attenuate;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the reflections should be attenuated according to the number of iterations performed to find the intersection (default: true).\r\n */\r\n public get attenuateIntersectionIterations() {\r\n return this._ssrPostProcess.attenuateIntersectionIterations;\r\n }\r\n\r\n public set attenuateIntersectionIterations(attenuate: boolean) {\r\n this._ssrPostProcess.attenuateIntersectionIterations = attenuate;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the reflections should be attenuated when the reflection ray is facing the camera (the view direction) (default: false).\r\n */\r\n public get attenuateFacingCamera() {\r\n return this._ssrPostProcess.attenuateFacingCamera;\r\n }\r\n\r\n public set attenuateFacingCamera(attenuate: boolean) {\r\n this._ssrPostProcess.attenuateFacingCamera = attenuate;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the backface reflections should be attenuated (default: false).\r\n */\r\n public get attenuateBackfaceReflection() {\r\n return this._ssrPostProcess.attenuateBackfaceReflection;\r\n }\r\n\r\n public set attenuateBackfaceReflection(attenuate: boolean) {\r\n this._ssrPostProcess.attenuateBackfaceReflection = attenuate;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the ray should be clipped to the frustum (default: true).\r\n * You can try to set this parameter to false to save some performances: it may produce some artefacts in some cases, but generally they won't really be visible\r\n */\r\n public get clipToFrustum() {\r\n return this._ssrPostProcess.clipToFrustum;\r\n }\r\n\r\n public set clipToFrustum(clip: boolean) {\r\n this._ssrPostProcess.clipToFrustum = clip;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating whether the blending between the current color pixel and the reflection color should be done with a Fresnel coefficient (default: false).\r\n * It is more physically accurate to use the Fresnel coefficient (otherwise it uses the reflectivity of the material for blending), but it is also more expensive when you use blur (when blurDispersionStrength \\> 0).\r\n */\r\n public get useFresnel() {\r\n return this._ssrPostProcess.useFresnel;\r\n }\r\n\r\n public set useFresnel(fresnel: boolean) {\r\n this._ssrPostProcess.useFresnel = fresnel;\r\n this._ssrBlurCombinerPostProcess.useFresnel = fresnel;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean defining if geometry thickness should be computed automatically (default: false).\r\n * When enabled, a depth renderer is created which will render the back faces of the scene to a depth texture (meaning additional work for the GPU).\r\n * In that mode, the \"thickness\" property is still used as an offset to compute the ray intersection, but you can typically use a much lower\r\n * value than when enableAutomaticThicknessComputation is false (it's even possible to use a value of 0 when using low values for \"step\")\r\n * Note that for performance reasons, this option will only apply to the first camera to which the rendering pipeline is attached!\r\n */\r\n public get enableAutomaticThicknessComputation(): boolean {\r\n return this._ssrPostProcess.enableAutomaticThicknessComputation;\r\n }\r\n\r\n public set enableAutomaticThicknessComputation(automatic: boolean) {\r\n if (this._ssrPostProcess.enableAutomaticThicknessComputation === automatic) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.enableAutomaticThicknessComputation = automatic;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean defining if the input color texture is in gamma space (default: true)\r\n * The SSR effect works in linear space, so if the input texture is in gamma space, we must convert the texture to linear space before applying the effect\r\n */\r\n public get inputTextureColorIsInGammaSpace(): boolean {\r\n return this._ssrPostProcess.inputTextureColorIsInGammaSpace;\r\n }\r\n\r\n public set inputTextureColorIsInGammaSpace(gammaSpace: boolean) {\r\n if (this._ssrPostProcess.inputTextureColorIsInGammaSpace === gammaSpace) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.inputTextureColorIsInGammaSpace = gammaSpace;\r\n this._ssrBlurCombinerPostProcess.inputTextureColorIsInGammaSpace = gammaSpace;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean defining if the output color texture generated by the SSR pipeline should be in gamma space (default: true)\r\n * If you have a post-process that comes after the SSR and that post-process needs the input to be in a linear space, you must disable generateOutputInGammaSpace\r\n */\r\n public get generateOutputInGammaSpace(): boolean {\r\n return this._ssrPostProcess.generateOutputInGammaSpace;\r\n }\r\n\r\n public set generateOutputInGammaSpace(gammaSpace: boolean) {\r\n if (this._ssrPostProcess.generateOutputInGammaSpace === gammaSpace) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.generateOutputInGammaSpace = gammaSpace;\r\n this._ssrBlurCombinerPostProcess.generateOutputInGammaSpace = gammaSpace;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the effect should be rendered in debug mode (default: false).\r\n * In this mode, colors have this meaning:\r\n * - blue: the ray hit the max distance (we reached maxDistance)\r\n * - red: the ray ran out of steps (we reached maxSteps)\r\n * - yellow: the ray went off screen\r\n * - green: the ray hit a surface. The brightness of the green color is proportional to the distance between the ray origin and the intersection point: A brighter green means more computation than a darker green.\r\n * In the first 3 cases, the final color is calculated by mixing the skybox color with the pixel color (if environmentTexture is defined), otherwise the pixel color is not modified\r\n * You should try to get as few blue/red/yellow pixels as possible, as this means that the ray has gone further than if it had hit a surface.\r\n */\r\n public get debug(): boolean {\r\n return this._ssrPostProcess.debug;\r\n }\r\n\r\n public set debug(value: boolean) {\r\n if (this._ssrPostProcess.debug === value) {\r\n return;\r\n }\r\n\r\n this._ssrPostProcess.debug = value;\r\n this._ssrBlurCombinerPostProcess.debug = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the camera to use to render the reflection\r\n */\r\n public get camera() {\r\n return this._ssrPostProcess.camera;\r\n }\r\n\r\n public set camera(camera: Nullable<Camera>) {\r\n this._ssrPostProcess.camera = camera;\r\n this._ssrBlurCombinerPostProcess.camera = camera;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the depth buffer stores screen space depth instead of camera view space depth.\r\n */\r\n public get useScreenspaceDepth() {\r\n return this._ssrPostProcess.useScreenspaceDepth;\r\n }\r\n\r\n public set useScreenspaceDepth(use: boolean) {\r\n this._ssrPostProcess.useScreenspaceDepth = use;\r\n this._ssrBlurCombinerPostProcess.useScreenspaceDepth = use;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the normals are in world space (false by default, meaning normals are in camera view space).\r\n */\r\n public get normalsAreInWorldSpace() {\r\n return this._ssrPostProcess.normalsAreInWorldSpace;\r\n }\r\n\r\n public set normalsAreInWorldSpace(normalsAreInWorldSpace: boolean) {\r\n this._ssrPostProcess.normalsAreInWorldSpace = normalsAreInWorldSpace;\r\n this._ssrBlurCombinerPostProcess.normalsAreInWorldSpace = normalsAreInWorldSpace;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the normals are encoded as unsigned, that is normalUnsigned = normal*0.5+0.5 (false by default).\r\n */\r\n public get normalsAreUnsigned() {\r\n return this._ssrPostProcess.normalsAreUnsigned;\r\n }\r\n\r\n public set normalsAreUnsigned(normalsAreUnsigned: boolean) {\r\n this._ssrPostProcess.normalsAreUnsigned = normalsAreUnsigned;\r\n this._ssrBlurCombinerPostProcess.normalsAreUnsigned = normalsAreUnsigned;\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._ssrPostProcess.isReady() && this._ssrBlurXPostProcess.isReady() && this._ssrBlurYPostProcess.isReady() && this._ssrBlurCombinerPostProcess.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._ssrPostProcess = new ThinSSRPostProcess(this.name, this._scene);\r\n this._ssrBlurXPostProcess = new ThinSSRBlurPostProcess(this.name + \" BlurX\", this._scene.getEngine(), new Vector2(1, 0));\r\n this._ssrBlurYPostProcess = new ThinSSRBlurPostProcess(this.name + \" BlurY\", this._scene.getEngine(), new Vector2(0, 1));\r\n this._ssrBlurCombinerPostProcess = new ThinSSRBlurCombinerPostProcess(this.name + \" BlurCombiner\", this._scene.getEngine());\r\n\r\n this._ssrPostProcess.useBlur = this._ssrBlurXPostProcess.blurStrength > 0;\r\n }\r\n\r\n /**\r\n * Disposes of the pipeline\r\n */\r\n public dispose(): void {\r\n this._ssrPostProcess?.dispose();\r\n this._ssrBlurXPostProcess?.dispose();\r\n this._ssrBlurYPostProcess?.dispose();\r\n this._ssrBlurCombinerPostProcess?.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -328,6 +328,10 @@ export declare class PostProcess {
|
|
|
328
328
|
* A function that is added to the onAfterRenderObservable
|
|
329
329
|
*/
|
|
330
330
|
set onAfterRender(callback: (efect: Effect) => void);
|
|
331
|
+
/**
|
|
332
|
+
* An event triggered when the post-process is disposed
|
|
333
|
+
*/
|
|
334
|
+
readonly onDisposeObservable: Observable<void>;
|
|
331
335
|
/**
|
|
332
336
|
* The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will
|
|
333
337
|
* render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.
|
|
@@ -350,6 +354,7 @@ export declare class PostProcess {
|
|
|
350
354
|
*/
|
|
351
355
|
get texelSize(): Vector2;
|
|
352
356
|
protected readonly _effectWrapper: EffectWrapper;
|
|
357
|
+
protected readonly _useExistingThinPostProcess: boolean;
|
|
353
358
|
/**
|
|
354
359
|
* Creates a new instance PostProcess
|
|
355
360
|
* @param name The name of the PostProcess.
|
|
@@ -304,6 +304,10 @@ export class PostProcess {
|
|
|
304
304
|
* An event triggered after rendering the postprocess
|
|
305
305
|
*/
|
|
306
306
|
this.onAfterRenderObservable = new Observable();
|
|
307
|
+
/**
|
|
308
|
+
* An event triggered when the post-process is disposed
|
|
309
|
+
*/
|
|
310
|
+
this.onDisposeObservable = new Observable();
|
|
307
311
|
let size = 1;
|
|
308
312
|
let uniformBuffers = null;
|
|
309
313
|
let effectWrapper;
|
|
@@ -335,7 +339,7 @@ export class PostProcess {
|
|
|
335
339
|
size = { width: _size.width, height: _size.height };
|
|
336
340
|
}
|
|
337
341
|
}
|
|
338
|
-
|
|
342
|
+
this._useExistingThinPostProcess = !!effectWrapper;
|
|
339
343
|
this._effectWrapper =
|
|
340
344
|
effectWrapper ??
|
|
341
345
|
new EffectWrapper({
|
|
@@ -386,7 +390,7 @@ export class PostProcess {
|
|
|
386
390
|
}
|
|
387
391
|
this._uniformBuffers = uniformBuffers || [];
|
|
388
392
|
this._indexParameters = indexParameters;
|
|
389
|
-
if (!
|
|
393
|
+
if (!this._useExistingThinPostProcess) {
|
|
390
394
|
this._webGPUReady = this._shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
391
395
|
const importPromises = [];
|
|
392
396
|
this._gatherImports(this._engine.isWebGPU && !PostProcess.ForceGLSL, importPromises);
|
|
@@ -735,6 +739,9 @@ export class PostProcess {
|
|
|
735
739
|
*/
|
|
736
740
|
dispose(camera) {
|
|
737
741
|
camera = camera || this._camera;
|
|
742
|
+
if (!this._useExistingThinPostProcess) {
|
|
743
|
+
this._effectWrapper.dispose();
|
|
744
|
+
}
|
|
738
745
|
this._disposeTextures();
|
|
739
746
|
let index;
|
|
740
747
|
if (this._scene) {
|
|
@@ -754,6 +761,7 @@ export class PostProcess {
|
|
|
754
761
|
if (index !== -1) {
|
|
755
762
|
this._engine.postProcesses.splice(index, 1);
|
|
756
763
|
}
|
|
764
|
+
this.onDisposeObservable.notifyObservers();
|
|
757
765
|
if (!camera) {
|
|
758
766
|
return;
|
|
759
767
|
}
|