@babylonjs/core 5.47.1 → 5.48.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.
Files changed (53) hide show
  1. package/Cameras/camera.js +5 -0
  2. package/Cameras/camera.js.map +1 -1
  3. package/Engines/thinEngine.js +2 -2
  4. package/Engines/thinEngine.js.map +1 -1
  5. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +1 -0
  6. package/PostProcesses/RenderPipeline/Pipelines/index.js +1 -0
  7. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  8. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +255 -0
  9. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +805 -0
  10. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -0
  11. package/PostProcesses/screenSpaceReflectionPostProcess.d.ts +1 -0
  12. package/PostProcesses/screenSpaceReflectionPostProcess.js +1 -0
  13. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  14. package/Rendering/depthRenderer.d.ts +12 -3
  15. package/Rendering/depthRenderer.js +22 -7
  16. package/Rendering/depthRenderer.js.map +1 -1
  17. package/Rendering/geometryBufferRenderer.d.ts +1 -0
  18. package/Rendering/geometryBufferRenderer.js +4 -2
  19. package/Rendering/geometryBufferRenderer.js.map +1 -1
  20. package/Rendering/prePassRendererSceneComponent.d.ts +4 -0
  21. package/Rendering/prePassRendererSceneComponent.js +3 -3
  22. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  23. package/Rendering/screenSpaceReflections2Configuration.d.ts +19 -0
  24. package/Rendering/screenSpaceReflections2Configuration.js +22 -0
  25. package/Rendering/screenSpaceReflections2Configuration.js.map +1 -0
  26. package/Shaders/ShadersInclude/screenSpaceRayTrace.d.ts +5 -0
  27. package/Shaders/ShadersInclude/screenSpaceRayTrace.js +32 -0
  28. package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -0
  29. package/Shaders/default.fragment.js +3 -3
  30. package/Shaders/default.fragment.js.map +1 -1
  31. package/Shaders/depth.fragment.js +8 -0
  32. package/Shaders/depth.fragment.js.map +1 -1
  33. package/Shaders/depth.vertex.js +6 -1
  34. package/Shaders/depth.vertex.js.map +1 -1
  35. package/Shaders/geometry.fragment.js +5 -13
  36. package/Shaders/geometry.fragment.js.map +1 -1
  37. package/Shaders/pbr.fragment.js +2 -2
  38. package/Shaders/pbr.fragment.js.map +1 -1
  39. package/Shaders/screenSpaceReflection2.fragment.d.ts +7 -0
  40. package/Shaders/screenSpaceReflection2.fragment.js +61 -0
  41. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -0
  42. package/Shaders/screenSpaceReflection2Blur.fragment.d.ts +5 -0
  43. package/Shaders/screenSpaceReflection2Blur.fragment.js +9 -0
  44. package/Shaders/screenSpaceReflection2Blur.fragment.js.map +1 -0
  45. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.d.ts +6 -0
  46. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js +11 -0
  47. package/Shaders/screenSpaceReflection2BlurCombiner.fragment.js.map +1 -0
  48. package/XR/webXRCamera.d.ts +6 -0
  49. package/XR/webXRCamera.js +15 -0
  50. package/XR/webXRCamera.js.map +1 -1
  51. package/package.json +1 -1
  52. package/scene.js +1 -0
  53. package/scene.js.map +1 -1
@@ -3,3 +3,4 @@ export * from "./lensRenderingPipeline";
3
3
  export * from "./ssao2RenderingPipeline";
4
4
  export * from "./ssaoRenderingPipeline";
5
5
  export * from "./standardRenderingPipeline";
6
+ export * from "./ssrRenderingPipeline";
@@ -3,4 +3,5 @@ export * from "./lensRenderingPipeline.js";
3
3
  export * from "./ssao2RenderingPipeline.js";
4
4
  export * from "./ssaoRenderingPipeline.js";
5
5
  export * from "./standardRenderingPipeline.js";
6
+ export * from "./ssrRenderingPipeline.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/PostProcesses/RenderPipeline/Pipelines/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\r\nexport * from \"./lensRenderingPipeline\";\r\nexport * from \"./ssao2RenderingPipeline\";\r\nexport * from \"./ssaoRenderingPipeline\";\r\nexport * from \"./standardRenderingPipeline\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/PostProcesses/RenderPipeline/Pipelines/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\r\nexport * from \"./lensRenderingPipeline\";\r\nexport * from \"./ssao2RenderingPipeline\";\r\nexport * from \"./ssaoRenderingPipeline\";\r\nexport * from \"./standardRenderingPipeline\";\r\nexport * from \"./ssrRenderingPipeline\";\r\n"]}
@@ -0,0 +1,255 @@
1
+ import type { Camera } from "../../../Cameras/camera";
2
+ import { PostProcessRenderPipeline } from "../postProcessRenderPipeline";
3
+ import type { Scene } from "../../../scene";
4
+ import type { Nullable } from "../../../types";
5
+ import type { CubeTexture } from "../../../Materials/Textures/cubeTexture";
6
+ import { DepthRenderer } from "../../../Rendering/depthRenderer";
7
+ import "../postProcessRenderPipelineManagerSceneComponent";
8
+ import "../../../Shaders/screenSpaceReflection2.fragment";
9
+ import "../../../Shaders/screenSpaceReflection2Blur.fragment";
10
+ import "../../../Shaders/screenSpaceReflection2BlurCombiner.fragment";
11
+ /**
12
+ * Render pipeline to produce Screen Space Reflections (SSR) effect
13
+ *
14
+ * References:
15
+ * Screen Space Ray Tracing:
16
+ * - http://casual-effects.blogspot.com/2014/08/screen-space-ray-tracing.html
17
+ * - https://sourceforge.net/p/g3d/code/HEAD/tree/G3D10/data-files/shader/screenSpaceRayTrace.glsl
18
+ * - https://github.com/kode80/kode80SSR
19
+ * SSR:
20
+ * - general tips: https://sakibsaikia.github.io/graphics/2016/12/26/Screen-Space-Reflection-in-Killing-Floor-2.html
21
+ * - computation of blur radius from roughness and distance: https://github.com/godotengine/godot/blob/master/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl
22
+ * - blur and usage of back depth buffer: https://github.com/kode80/kode80SSR
23
+ */
24
+ export declare class SSRRenderingPipeline extends PostProcessRenderPipeline {
25
+ /**
26
+ * The SSR PostProcess effect id in the pipeline
27
+ */
28
+ SSRRenderEffect: string;
29
+ /**
30
+ * The blur PostProcess effect id in the pipeline
31
+ */
32
+ SSRBlurRenderEffect: string;
33
+ /**
34
+ * The PostProcess effect id in the pipeline that combines the SSR-Blur output with the original scene color
35
+ */
36
+ SSRCombineRenderEffect: string;
37
+ private _samples;
38
+ /**
39
+ * MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)
40
+ */
41
+ set samples(sampleCount: number);
42
+ get samples(): number;
43
+ /**
44
+ * Gets or sets the maxDistance used to define how far we look for reflection during the ray-marching on the reflected ray (default: 1000).
45
+ * Note that this value is a view (camera) space distance (not pixels!).
46
+ */
47
+ maxDistance: number;
48
+ /**
49
+ * 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).
50
+ * Use higher values to improve performances (but at the expense of quality).
51
+ */
52
+ step: number;
53
+ /**
54
+ * Gets or sets the thickness value used as tolerance when computing the intersection between the reflected ray and the scene (default: 0.5).
55
+ * If setting "enableAutomaticThicknessComputation" to true, you can use lower values for "thickness" (even 0), as the geometry thickness
56
+ * is automatically computed thank to the regular depth buffer + the backface depth buffer
57
+ */
58
+ thickness: number;
59
+ /**
60
+ * Gets or sets the current reflection strength. 1.0 is an ideal value but can be increased/decreased for particular results (default: 1).
61
+ */
62
+ strength: number;
63
+ /**
64
+ * Gets or sets the falloff exponent used to compute the reflection strength. Higher values lead to fainter reflections (default: 1).
65
+ */
66
+ reflectionSpecularFalloffExponent: number;
67
+ /**
68
+ * Maximum number of steps during the ray marching process after which we consider an intersection could not be found (default: 1000)
69
+ */
70
+ maxSteps: number;
71
+ /**
72
+ * Gets or sets the factor applied when computing roughness. Default value is 0.2.
73
+ * When blurring based on roughness is enabled (meaning blurDispersionStrength \> 0), roughnessFactor is used as a global roughness factor applied on all objects.
74
+ * If you want to disable this global roughness set it to 0.
75
+ */
76
+ roughnessFactor: number;
77
+ /**
78
+ * Number of steps to skip at start when marching the ray to avoid self collisions (default: 1)
79
+ * 1 should normally be a good value, depending on the scene you may need to use a higher value (2 or 3)
80
+ */
81
+ selfCollisionNumSkip: number;
82
+ private _blurDispersionStrength;
83
+ /**
84
+ * Gets or sets the blur dispersion strength. Set this value to 0 to disable blurring (default: 0.05)
85
+ * The reflections are blurred based on the distance between the pixel shaded and the reflected pixel: the higher the distance the more blurry the reflection is.
86
+ * blurDispersionStrength allows to increase or decrease this effect.
87
+ */
88
+ get blurDispersionStrength(): number;
89
+ set blurDispersionStrength(strength: number);
90
+ /**
91
+ * Apply different weighting when blurring.
92
+ * Must be a value between 2 and 5
93
+ */
94
+ blurQuality: number;
95
+ private _enableSmoothReflections;
96
+ /**
97
+ * Gets or sets whether or not smoothing reflections is enabled.
98
+ * Enabling smoothing will require more GPU power and can generate a drop in FPS.
99
+ * Note that this setting has no effect if step = 1: it's only used if step \> 1.
100
+ */
101
+ get enableSmoothReflections(): boolean;
102
+ set enableSmoothReflections(enabled: boolean);
103
+ private _environmentTexture;
104
+ /**
105
+ * 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.
106
+ */
107
+ get environmentTexture(): Nullable<CubeTexture>;
108
+ set environmentTexture(texture: Nullable<CubeTexture>);
109
+ private _environmentTextureIsProbe;
110
+ /**
111
+ * Gets or sets the boolean defining if the environment texture is a standard cubemap (false) or a probe (true). Default value is false.
112
+ * Note: a probe cube texture is treated differently than an ordinary cube texture because the Y axis is reversed.
113
+ */
114
+ get environmentTextureIsProbe(): boolean;
115
+ set environmentTextureIsProbe(isProbe: boolean);
116
+ private _attenuateScreenBorders;
117
+ /**
118
+ * Gets or sets a boolean indicating if the reflections should be attenuated at the screen borders (default: true).
119
+ */
120
+ get attenuateScreenBorders(): boolean;
121
+ set attenuateScreenBorders(attenuate: boolean);
122
+ private _attenuateIntersectionDistance;
123
+ /**
124
+ * Gets or sets a boolean indicating if the reflections should be attenuated according to the distance of the intersection (default: true).
125
+ */
126
+ get attenuateIntersectionDistance(): boolean;
127
+ set attenuateIntersectionDistance(attenuate: boolean);
128
+ private _attenuateFacingCamera;
129
+ /**
130
+ * 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).
131
+ */
132
+ get attenuateFacingCamera(): boolean;
133
+ set attenuateFacingCamera(attenuate: boolean);
134
+ private _attenuateBackfaceReflection;
135
+ /**
136
+ * Gets or sets a boolean indicating if the backface reflections should be attenuated (default: false).
137
+ */
138
+ get attenuateBackfaceReflection(): boolean;
139
+ set attenuateBackfaceReflection(attenuate: boolean);
140
+ private _clipToFrustum;
141
+ /**
142
+ * Gets or sets a boolean indicating if the ray should be clipped to the frustum (default: true).
143
+ * 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
144
+ */
145
+ get clipToFrustum(): boolean;
146
+ set clipToFrustum(clip: boolean);
147
+ private _enableAutomaticThicknessComputation;
148
+ /**
149
+ * Gets or sets a boolean defining if geometry thickness should be computed automatically (default: false).
150
+ * 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).
151
+ * 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
152
+ * value than when enableAutomaticThicknessComputation is false (it's even possible to use a value of 0 when using low values for "step")
153
+ * Note that for performance reasons, this option will only apply to the first camera to which the the rendering pipeline is attached!
154
+ */
155
+ get enableAutomaticThicknessComputation(): boolean;
156
+ set enableAutomaticThicknessComputation(automatic: boolean);
157
+ /**
158
+ * Gets the depth renderer used to render the back faces of the scene to a depth texture.
159
+ */
160
+ get backfaceDepthRenderer(): Nullable<DepthRenderer>;
161
+ private _backfaceDepthTextureSizeFactor;
162
+ /**
163
+ * Gets or sets the size factor used to create the backface depth texture, used only if enableAutomaticThicknessComputation = true (default: 1).
164
+ * This factor is used as a divisor of the full screen size (so, 2 means that the backface depth texture will be created at half the screen size, meaning better performances).
165
+ * Note that you will get rendering artefacts when using a value different from 1: it's a tradeoff between image quality and performances.
166
+ */
167
+ get backfaceDepthTextureSizeFactor(): number;
168
+ set backfaceDepthTextureSizeFactor(factor: number);
169
+ private _isEnabled;
170
+ /**
171
+ * Gets or sets a boolean indicating if the effect is enabled (default: true).
172
+ */
173
+ get isEnabled(): boolean;
174
+ set isEnabled(value: boolean);
175
+ private _debug;
176
+ /**
177
+ * Gets or sets a boolean indicating if the effect should be rendered in debug mode (default: false).
178
+ * In this mode, colors have this meaning:
179
+ * - blue: the ray hit the max distance (we reached maxDistance)
180
+ * - red: the ray ran out of steps (we reached maxSteps)
181
+ * - yellow: the ray went off screen
182
+ * - 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.
183
+ * 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
184
+ * 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.
185
+ */
186
+ get debug(): boolean;
187
+ set debug(value: boolean);
188
+ private _forceGeometryBuffer;
189
+ private get _geometryBufferRenderer();
190
+ private get _prePassRenderer();
191
+ private _scene;
192
+ private _isDirty;
193
+ private _camerasToBeAttached;
194
+ private _textureType;
195
+ private _ssrPostProcess;
196
+ private _blurPostProcessX;
197
+ private _blurPostProcessY;
198
+ private _blurCombinerPostProcess;
199
+ private _depthRenderer;
200
+ private _depthRendererCamera;
201
+ /**
202
+ * Gets active scene
203
+ */
204
+ get scene(): Scene;
205
+ /**
206
+ * Constructor of the SSR rendering pipeline
207
+ * @param name The rendering pipeline name
208
+ * @param scene The scene linked to this pipeline
209
+ * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)
210
+ * @param forceGeometryBuffer Set to true if you want to use the legacy geometry buffer renderer (default: false)
211
+ * @param textureType The texture type used by the different post processes created by SSR (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)
212
+ */
213
+ constructor(name: string, scene: Scene, cameras?: Camera[], forceGeometryBuffer?: boolean, textureType?: number);
214
+ /**
215
+ * Get the class name
216
+ * @returns "SSRRenderingPipeline"
217
+ */
218
+ getClassName(): string;
219
+ /**
220
+ * Adds a camera to the pipeline
221
+ * @param camera the camera to be added
222
+ */
223
+ addCamera(camera: Camera): void;
224
+ /**
225
+ * Removes a camera from the pipeline
226
+ * @param camera the camera to remove
227
+ */
228
+ removeCamera(camera: Camera): void;
229
+ /**
230
+ * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
231
+ * @param disableGeometryBufferRenderer
232
+ */
233
+ dispose(disableGeometryBufferRenderer?: boolean): void;
234
+ private _getTextureSize;
235
+ private _updateEffectDefines;
236
+ private _buildPipeline;
237
+ private _resizeDepthRenderer;
238
+ private _disposeDepthRenderer;
239
+ private _disposePostProcesses;
240
+ private _createSSRPostProcess;
241
+ private _createBlurAndCombinerPostProcesses;
242
+ /**
243
+ * Serializes the rendering pipeline (Used when exporting)
244
+ * @returns the serialized object
245
+ */
246
+ serialize(): any;
247
+ /**
248
+ * Parse the serialized pipeline
249
+ * @param source Source pipeline.
250
+ * @param scene The scene to load the pipeline to.
251
+ * @param rootUrl The URL of the serialized pipeline.
252
+ * @returns An instantiated pipeline from the serialized object.
253
+ */
254
+ static Parse(source: any, scene: Scene, rootUrl: string): SSRRenderingPipeline;
255
+ }