@babylonjs/core 7.52.1 → 7.52.3

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.
Files changed (247) hide show
  1. package/AudioV2/abstractAudio/abstractAudioBus.d.ts +11 -0
  2. package/AudioV2/abstractAudio/abstractAudioBus.js +10 -0
  3. package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
  4. package/AudioV2/abstractAudio/abstractSound.d.ts +11 -5
  5. package/AudioV2/abstractAudio/abstractSound.js +11 -5
  6. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  7. package/AudioV2/abstractAudio/audioBus.d.ts +5 -6
  8. package/AudioV2/abstractAudio/audioBus.js +1 -5
  9. package/AudioV2/abstractAudio/audioBus.js.map +1 -1
  10. package/AudioV2/abstractAudio/audioEngineV2.d.ts +1 -2
  11. package/AudioV2/abstractAudio/audioEngineV2.js +1 -5
  12. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  13. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +43 -0
  14. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +71 -0
  15. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -0
  16. package/AudioV2/abstractAudio/mainAudioBus.d.ts +2 -2
  17. package/AudioV2/abstractAudio/mainAudioBus.js.map +1 -1
  18. package/AudioV2/abstractAudio/staticSound.d.ts +6 -6
  19. package/AudioV2/abstractAudio/staticSound.js +5 -5
  20. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  21. package/AudioV2/abstractAudio/streamingSound.d.ts +2 -2
  22. package/AudioV2/abstractAudio/streamingSound.js +3 -3
  23. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  24. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +30 -6
  25. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +44 -21
  26. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
  27. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +24 -0
  28. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js +30 -0
  29. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -0
  30. package/AudioV2/abstractAudio/subNodes/audioSubNode.d.ts +1 -0
  31. package/AudioV2/abstractAudio/subNodes/audioSubNode.js +1 -0
  32. package/AudioV2/abstractAudio/subNodes/audioSubNode.js.map +1 -1
  33. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +15 -0
  34. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +38 -3
  35. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  36. package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -1
  37. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.d.ts +86 -0
  38. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js +29 -0
  39. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js.map +1 -0
  40. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +29 -8
  41. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +1 -0
  42. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  43. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +28 -1
  44. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js +5 -1
  45. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
  46. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +35 -0
  47. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +96 -0
  48. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -0
  49. package/AudioV2/abstractAudio/subProperties/index.d.ts +1 -0
  50. package/AudioV2/abstractAudio/subProperties/index.js +1 -0
  51. package/AudioV2/abstractAudio/subProperties/index.js.map +1 -1
  52. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +16 -1
  53. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +48 -14
  54. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  55. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +21 -0
  56. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +39 -4
  57. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
  58. package/AudioV2/index.d.ts +1 -0
  59. package/AudioV2/index.js +1 -0
  60. package/AudioV2/index.js.map +1 -1
  61. package/AudioV2/spatialAudioAttachmentType.d.ts +5 -0
  62. package/AudioV2/spatialAudioAttachmentType.js +7 -0
  63. package/AudioV2/spatialAudioAttachmentType.js.map +1 -0
  64. package/AudioV2/webAudio/components/spatialWebAudioUpdaterComponent.d.ts +13 -0
  65. package/AudioV2/webAudio/components/spatialWebAudioUpdaterComponent.js +38 -0
  66. package/AudioV2/webAudio/components/spatialWebAudioUpdaterComponent.js.map +1 -0
  67. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +13 -14
  68. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +39 -39
  69. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  70. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +37 -0
  71. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +85 -0
  72. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -0
  73. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +5 -3
  74. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +25 -2
  75. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
  76. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +2 -1
  77. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +32 -17
  78. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
  79. package/AudioV2/webAudio/subProperties/spatialWebAudio.d.ts +6 -2
  80. package/AudioV2/webAudio/subProperties/spatialWebAudio.js +13 -15
  81. package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
  82. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.d.ts +1 -1
  83. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +41 -56
  84. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
  85. package/AudioV2/webAudio/webAudioBus.d.ts +3 -0
  86. package/AudioV2/webAudio/webAudioBus.js +23 -2
  87. package/AudioV2/webAudio/webAudioBus.js.map +1 -1
  88. package/AudioV2/webAudio/webAudioEngine.d.ts +3 -1
  89. package/AudioV2/webAudio/webAudioEngine.js +11 -3
  90. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  91. package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -0
  92. package/AudioV2/webAudio/webAudioStaticSound.js +23 -2
  93. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  94. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -0
  95. package/AudioV2/webAudio/webAudioStreamingSound.js +23 -2
  96. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  97. package/Engines/WebGPU/webgpuTextureManager.d.ts +0 -1
  98. package/Engines/WebGPU/webgpuTextureManager.js +2 -57
  99. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  100. package/Engines/abstractEngine.d.ts +6 -0
  101. package/Engines/abstractEngine.js +3 -3
  102. package/Engines/abstractEngine.js.map +1 -1
  103. package/Engines/engine.common.js +4 -0
  104. package/Engines/engine.common.js.map +1 -1
  105. package/Engines/nativeEngine.d.ts +1 -0
  106. package/Engines/nativeEngine.js +3 -0
  107. package/Engines/nativeEngine.js.map +1 -1
  108. package/Engines/nullEngine.d.ts +1 -0
  109. package/Engines/nullEngine.js +1 -0
  110. package/Engines/nullEngine.js.map +1 -1
  111. package/Engines/thinEngine.d.ts +1 -0
  112. package/Engines/thinEngine.js +7 -4
  113. package/Engines/thinEngine.js.map +1 -1
  114. package/Engines/webgpuEngine.d.ts +2 -1
  115. package/Engines/webgpuEngine.js +12 -9
  116. package/Engines/webgpuEngine.js.map +1 -1
  117. package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.d.ts +48 -0
  118. package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js +54 -0
  119. package/FlowGraph/Blocks/Data/flowGraphDataSwitchBlock.js.map +1 -0
  120. package/FlowGraph/Blocks/Data/index.d.ts +1 -0
  121. package/FlowGraph/Blocks/Data/index.js +1 -0
  122. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +1 -0
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +19 -13
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -5
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  128. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +1 -1
  129. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +2 -4
  131. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
  132. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +1 -1
  133. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  134. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +1 -2
  135. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  136. package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
  137. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  138. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +2 -1
  139. package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
  140. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  141. package/FlowGraph/CustomTypes/flowGraphInteger.d.ts +1 -0
  142. package/FlowGraph/CustomTypes/flowGraphInteger.js +3 -0
  143. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -1
  144. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +2 -0
  145. package/FlowGraph/CustomTypes/flowGraphMatrix.js +6 -0
  146. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  147. package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -0
  148. package/FlowGraph/flowGraphExecutionBlock.js +4 -0
  149. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  150. package/FlowGraph/utils.d.ts +2 -1
  151. package/FlowGraph/utils.js +7 -2
  152. package/FlowGraph/utils.js.map +1 -1
  153. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +2 -2
  154. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  155. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +2 -2
  156. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -1
  157. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.d.ts +126 -0
  158. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +497 -0
  159. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -0
  160. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
  161. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +30 -4
  162. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  163. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  164. package/FrameGraph/Node/Blocks/index.js +1 -0
  165. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  166. package/FrameGraph/Node/nodeRenderGraph.js +1 -1
  167. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  168. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +2 -3
  169. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -4
  170. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  171. package/FrameGraph/Tasks/PostProcesses/blurTask.js +2 -2
  172. package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
  173. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +2 -3
  174. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +4 -5
  175. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  176. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +6 -0
  177. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +14 -0
  178. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  179. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +11 -0
  180. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +18 -0
  181. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -0
  182. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +76 -0
  183. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +170 -0
  184. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -0
  185. package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +16 -0
  186. package/FrameGraph/Tasks/PostProcesses/ssrTask.js +45 -0
  187. package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -0
  188. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +10 -0
  189. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +29 -0
  190. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  191. package/FrameGraph/frameGraph.d.ts +7 -3
  192. package/FrameGraph/frameGraph.js +10 -4
  193. package/FrameGraph/frameGraph.js.map +1 -1
  194. package/FrameGraph/frameGraphTextureManager.d.ts +2 -1
  195. package/FrameGraph/frameGraphTextureManager.js +4 -3
  196. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  197. package/FrameGraph/index.d.ts +1 -0
  198. package/FrameGraph/index.js +1 -0
  199. package/FrameGraph/index.js.map +1 -1
  200. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  201. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  202. package/Materials/effectRenderer.js +1 -1
  203. package/Materials/effectRenderer.js.map +1 -1
  204. package/Materials/material.js +5 -3
  205. package/Materials/material.js.map +1 -1
  206. package/Materials/materialHelper.geometryrendering.d.ts +7 -5
  207. package/Materials/materialHelper.geometryrendering.js +8 -3
  208. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  209. package/Materials/standardMaterial.js +1 -1
  210. package/Materials/standardMaterial.js.map +1 -1
  211. package/Meshes/geometry.js +18 -7
  212. package/Meshes/geometry.js.map +1 -1
  213. package/Meshes/mesh.vertexData.d.ts +1 -1
  214. package/Meshes/mesh.vertexData.js +2 -1
  215. package/Meshes/mesh.vertexData.js.map +1 -1
  216. package/Particles/particleSystemComponent.d.ts +2 -1
  217. package/Particles/particleSystemComponent.js +2 -2
  218. package/Particles/particleSystemComponent.js.map +1 -1
  219. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +23 -30
  220. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +226 -411
  221. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  222. package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.d.ts +222 -0
  223. package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js +373 -0
  224. package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js.map +1 -0
  225. package/PostProcesses/thinDepthOfFieldEffect.d.ts +4 -4
  226. package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
  227. package/PostProcesses/thinSSRBlurCombinerPostProcess.d.ts +41 -0
  228. package/PostProcesses/thinSSRBlurCombinerPostProcess.js +185 -0
  229. package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -0
  230. package/PostProcesses/thinSSRBlurPostProcess.d.ts +18 -0
  231. package/PostProcesses/thinSSRBlurPostProcess.js +47 -0
  232. package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -0
  233. package/PostProcesses/thinSSRPostProcess.d.ts +94 -0
  234. package/PostProcesses/thinSSRPostProcess.js +416 -0
  235. package/PostProcesses/thinSSRPostProcess.js.map +1 -0
  236. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +2 -0
  237. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -0
  238. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  239. package/Rendering/iblCdfGenerator.js +1 -1
  240. package/Rendering/iblCdfGenerator.js.map +1 -1
  241. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
  242. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
  243. package/ShadersWGSL/geometry.fragment.js +1 -1
  244. package/ShadersWGSL/geometry.fragment.js.map +1 -1
  245. package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js +13 -2
  246. package/ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -1
  247. 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,O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AAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,eAAe,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACtE,IAAI,CAAC,oBAAoB,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzH,IAAI,CAAC,oBAAoB,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzH,IAAI,CAAC,2BAA2B,GAAG,IAAI,8BAA8B,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"]}
@@ -22,13 +22,13 @@ export declare enum ThinDepthOfFieldEffectBlurLevel {
22
22
  }
23
23
  export declare class ThinDepthOfFieldEffect {
24
24
  /** @internal */
25
- _circleOfConfusion: ThinCircleOfConfusionPostProcess;
25
+ readonly _circleOfConfusion: ThinCircleOfConfusionPostProcess;
26
26
  /** @internal */
27
- _depthOfFieldBlurX: Array<[ThinBlurPostProcess, number]>;
27
+ readonly _depthOfFieldBlurX: Array<[ThinBlurPostProcess, number]>;
28
28
  /** @internal */
29
- _depthOfFieldBlurY: Array<[ThinBlurPostProcess, number]>;
29
+ readonly _depthOfFieldBlurY: Array<[ThinBlurPostProcess, number]>;
30
30
  /** @internal */
31
- _dofMerge: ThinDepthOfFieldMergePostProcess;
31
+ readonly _dofMerge: ThinDepthOfFieldMergePostProcess;
32
32
  /**
33
33
  * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)
34
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"thinDepthOfFieldEffect.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinDepthOfFieldEffect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,gCAA+B;AAEjD;;GAEG;AACH,MAAM,CAAN,IAAkB,+BAajB;AAbD,WAAkB,+BAA+B;IAC7C;;OAEG;IACH,mFAAG,CAAA;IACH;;OAEG;IACH,yFAAM,CAAA;IACN;;OAEG;IACH,qFAAI,CAAA;AACR,CAAC,EAbiB,+BAA+B,KAA/B,+BAA+B,QAahD;AAED,MAAM,OAAO,sB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B,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,IAAI,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5G,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ThinBlurPostProcess } from \"./thinBlurPostProcess\";\r\nimport { ThinCircleOfConfusionPostProcess } from \"./thinCircleOfConfusionPostProcess\";\r\nimport { ThinDepthOfFieldMergePostProcess } from \"./thinDepthOfFieldMergePostProcess\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Specifies the level of blur that should be applied when using the depth of field effect\r\n */\r\nexport const enum ThinDepthOfFieldEffectBlurLevel {\r\n /**\r\n * Subtle blur\r\n */\r\n Low,\r\n /**\r\n * Medium blur\r\n */\r\n Medium,\r\n /**\r\n * Large blur\r\n */\r\n High,\r\n}\r\n\r\nexport class ThinDepthOfFieldEffect {\r\n /** @internal */\r\n public _circleOfConfusion: ThinCircleOfConfusionPostProcess;\r\n /** @internal */\r\n public _depthOfFieldBlurX: Array<[ThinBlurPostProcess, number]> = [];\r\n /** @internal */\r\n public _depthOfFieldBlurY: Array<[ThinBlurPostProcess, number]> = [];\r\n /** @internal */\r\n public _dofMerge: ThinDepthOfFieldMergePostProcess;\r\n\r\n /**\r\n * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)\r\n */\r\n public set focalLength(value: number) {\r\n this._circleOfConfusion.focalLength = value;\r\n }\r\n public get focalLength() {\r\n return this._circleOfConfusion.focalLength;\r\n }\r\n /**\r\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n public set fStop(value: number) {\r\n this._circleOfConfusion.fStop = value;\r\n }\r\n public get fStop() {\r\n return this._circleOfConfusion.fStop;\r\n }\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n public set focusDistance(value: number) {\r\n this._circleOfConfusion.focusDistance = value;\r\n }\r\n public get focusDistance() {\r\n return this._circleOfConfusion.focusDistance;\r\n }\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diameter of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n public set lensSize(value: number) {\r\n this._circleOfConfusion.lensSize = value;\r\n }\r\n public get lensSize() {\r\n return this._circleOfConfusion.lensSize;\r\n }\r\n\r\n /**\r\n * The quality of the effect.\r\n */\r\n public readonly blurLevel: ThinDepthOfFieldEffectBlurLevel;\r\n\r\n /**\r\n * Creates a new instance of @see ThinDepthOfFieldEffect\r\n * @param name The name of the depth of field render effect\r\n * @param engine The engine which the render effect will be applied. (default: current engine)\r\n * @param blurLevel The quality of the effect. (default: DepthOfFieldEffectBlurLevel.Low)\r\n * @param depthNotNormalized If the (view) depth used in circle of confusion post-process is normalized (0.0 to 1.0 from near to far) or not (0 to camera max distance) (default: false)\r\n * @param blockCompilation If shaders should not be compiled when the effect is created (default: false)\r\n */\r\n constructor(\r\n name: string,\r\n engine: Nullable<AbstractEngine>,\r\n blurLevel: ThinDepthOfFieldEffectBlurLevel = ThinDepthOfFieldEffectBlurLevel.Low,\r\n depthNotNormalized = false,\r\n blockCompilation = false\r\n ) {\r\n this._circleOfConfusion = new ThinCircleOfConfusionPostProcess(name, engine, { depthNotNormalized, blockCompilation });\r\n this.blurLevel = blurLevel;\r\n\r\n let blurCount = 1;\r\n let kernelSize = 15;\r\n switch (blurLevel) {\r\n case ThinDepthOfFieldEffectBlurLevel.High: {\r\n blurCount = 3;\r\n kernelSize = 51;\r\n break;\r\n }\r\n case ThinDepthOfFieldEffectBlurLevel.Medium: {\r\n blurCount = 2;\r\n kernelSize = 31;\r\n break;\r\n }\r\n default: {\r\n kernelSize = 15;\r\n blurCount = 1;\r\n break;\r\n }\r\n }\r\n\r\n const adjustedKernelSize = kernelSize / Math.pow(2, blurCount - 1);\r\n let ratio = 1.0;\r\n for (let i = 0; i < blurCount; i++) {\r\n this._depthOfFieldBlurY.push([new ThinBlurPostProcess(name, engine, new Vector2(0, 1), adjustedKernelSize, { blockCompilation }), ratio]);\r\n ratio = 0.75 / Math.pow(2, i);\r\n this._depthOfFieldBlurX.push([new ThinBlurPostProcess(name, engine, new Vector2(1, 0), adjustedKernelSize, { blockCompilation }), ratio]);\r\n }\r\n\r\n this._dofMerge = new ThinDepthOfFieldMergePostProcess(name, engine, { blockCompilation });\r\n }\r\n\r\n /**\r\n * Checks if the effect is ready to be used\r\n * @returns if the effect is ready\r\n */\r\n public isReady() {\r\n let isReady = this._circleOfConfusion.isReady() && this._dofMerge.isReady();\r\n for (let i = 0; i < this._depthOfFieldBlurX.length; i++) {\r\n isReady = isReady && this._depthOfFieldBlurX[i][0].isReady() && this._depthOfFieldBlurY[i][0].isReady();\r\n }\r\n return isReady;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"thinDepthOfFieldEffect.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinDepthOfFieldEffect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,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AAC,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,EAAE,EAAE,gBAAgB,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9I,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,IAAI,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5G,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ThinBlurPostProcess } from \"./thinBlurPostProcess\";\r\nimport { ThinCircleOfConfusionPostProcess } from \"./thinCircleOfConfusionPostProcess\";\r\nimport { ThinDepthOfFieldMergePostProcess } from \"./thinDepthOfFieldMergePostProcess\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Specifies the level of blur that should be applied when using the depth of field effect\r\n */\r\nexport const enum ThinDepthOfFieldEffectBlurLevel {\r\n /**\r\n * Subtle blur\r\n */\r\n Low,\r\n /**\r\n * Medium blur\r\n */\r\n Medium,\r\n /**\r\n * Large blur\r\n */\r\n High,\r\n}\r\n\r\nexport class ThinDepthOfFieldEffect {\r\n /** @internal */\r\n public readonly _circleOfConfusion: ThinCircleOfConfusionPostProcess;\r\n /** @internal */\r\n public readonly _depthOfFieldBlurX: Array<[ThinBlurPostProcess, number]> = [];\r\n /** @internal */\r\n public readonly _depthOfFieldBlurY: Array<[ThinBlurPostProcess, number]> = [];\r\n /** @internal */\r\n public readonly _dofMerge: ThinDepthOfFieldMergePostProcess;\r\n\r\n /**\r\n * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)\r\n */\r\n public set focalLength(value: number) {\r\n this._circleOfConfusion.focalLength = value;\r\n }\r\n public get focalLength() {\r\n return this._circleOfConfusion.focalLength;\r\n }\r\n /**\r\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\r\n */\r\n public set fStop(value: number) {\r\n this._circleOfConfusion.fStop = value;\r\n }\r\n public get fStop() {\r\n return this._circleOfConfusion.fStop;\r\n }\r\n /**\r\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\r\n */\r\n public set focusDistance(value: number) {\r\n this._circleOfConfusion.focusDistance = value;\r\n }\r\n public get focusDistance() {\r\n return this._circleOfConfusion.focusDistance;\r\n }\r\n /**\r\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diameter of the resulting aperture can be computed by lensSize/fStop.\r\n */\r\n public set lensSize(value: number) {\r\n this._circleOfConfusion.lensSize = value;\r\n }\r\n public get lensSize() {\r\n return this._circleOfConfusion.lensSize;\r\n }\r\n\r\n /**\r\n * The quality of the effect.\r\n */\r\n public readonly blurLevel: ThinDepthOfFieldEffectBlurLevel;\r\n\r\n /**\r\n * Creates a new instance of @see ThinDepthOfFieldEffect\r\n * @param name The name of the depth of field render effect\r\n * @param engine The engine which the render effect will be applied. (default: current engine)\r\n * @param blurLevel The quality of the effect. (default: DepthOfFieldEffectBlurLevel.Low)\r\n * @param depthNotNormalized If the (view) depth used in circle of confusion post-process is normalized (0.0 to 1.0 from near to far) or not (0 to camera max distance) (default: false)\r\n * @param blockCompilation If shaders should not be compiled when the effect is created (default: false)\r\n */\r\n constructor(\r\n name: string,\r\n engine: Nullable<AbstractEngine>,\r\n blurLevel: ThinDepthOfFieldEffectBlurLevel = ThinDepthOfFieldEffectBlurLevel.Low,\r\n depthNotNormalized = false,\r\n blockCompilation = false\r\n ) {\r\n this._circleOfConfusion = new ThinCircleOfConfusionPostProcess(name, engine, { depthNotNormalized, blockCompilation });\r\n this.blurLevel = blurLevel;\r\n\r\n let blurCount = 1;\r\n let kernelSize = 15;\r\n switch (blurLevel) {\r\n case ThinDepthOfFieldEffectBlurLevel.High: {\r\n blurCount = 3;\r\n kernelSize = 51;\r\n break;\r\n }\r\n case ThinDepthOfFieldEffectBlurLevel.Medium: {\r\n blurCount = 2;\r\n kernelSize = 31;\r\n break;\r\n }\r\n default: {\r\n kernelSize = 15;\r\n blurCount = 1;\r\n break;\r\n }\r\n }\r\n\r\n const adjustedKernelSize = kernelSize / Math.pow(2, blurCount - 1);\r\n let ratio = 1.0;\r\n for (let i = 0; i < blurCount; i++) {\r\n this._depthOfFieldBlurY.push([new ThinBlurPostProcess(name, engine, new Vector2(0, 1), adjustedKernelSize, { blockCompilation }), ratio]);\r\n ratio = 0.75 / Math.pow(2, i);\r\n this._depthOfFieldBlurX.push([new ThinBlurPostProcess(name, engine, new Vector2(1, 0), adjustedKernelSize, { blockCompilation }), ratio]);\r\n }\r\n\r\n this._dofMerge = new ThinDepthOfFieldMergePostProcess(name, engine, { blockCompilation });\r\n }\r\n\r\n /**\r\n * Checks if the effect is ready to be used\r\n * @returns if the effect is ready\r\n */\r\n public isReady() {\r\n let isReady = this._circleOfConfusion.isReady() && this._dofMerge.isReady();\r\n for (let i = 0; i < this._depthOfFieldBlurX.length; i++) {\r\n isReady = isReady && this._depthOfFieldBlurX[i][0].isReady() && this._depthOfFieldBlurY[i][0].isReady();\r\n }\r\n return isReady;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,41 @@
1
+ import type { Nullable, AbstractEngine, EffectWrapperCreationOptions, Camera } from "../index.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class ThinSSRBlurCombinerPostProcess extends EffectWrapper {
7
+ static readonly FragmentUrl = "screenSpaceReflection2BlurCombiner";
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
+ strength: number;
13
+ reflectionSpecularFalloffExponent: number;
14
+ camera: Nullable<Camera>;
15
+ private _useFresnel;
16
+ get useFresnel(): boolean;
17
+ set useFresnel(fresnel: boolean);
18
+ private _useScreenspaceDepth;
19
+ get useScreenspaceDepth(): boolean;
20
+ set useScreenspaceDepth(value: boolean);
21
+ private _inputTextureColorIsInGammaSpace;
22
+ get inputTextureColorIsInGammaSpace(): boolean;
23
+ set inputTextureColorIsInGammaSpace(gammaSpace: boolean);
24
+ private _generateOutputInGammaSpace;
25
+ get generateOutputInGammaSpace(): boolean;
26
+ set generateOutputInGammaSpace(gammaSpace: boolean);
27
+ private _debug;
28
+ get debug(): boolean;
29
+ set debug(value: boolean);
30
+ private _reflectivityThreshold;
31
+ get reflectivityThreshold(): number;
32
+ set reflectivityThreshold(threshold: number);
33
+ private _normalsAreInWorldSpace;
34
+ get normalsAreInWorldSpace(): boolean;
35
+ set normalsAreInWorldSpace(value: boolean);
36
+ private _normalsAreUnsigned;
37
+ get normalsAreUnsigned(): boolean;
38
+ set normalsAreUnsigned(value: boolean);
39
+ bind(): void;
40
+ private _updateEffectDefines;
41
+ }