@onerjs/core 8.54.4 → 8.54.6

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 (234) hide show
  1. package/Engines/Native/nativeHelpers.js +5 -0
  2. package/Engines/Native/nativeHelpers.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  4. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  6. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  8. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  9. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  10. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  11. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  12. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  14. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  15. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  19. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  20. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  21. package/Engines/abstractEngine.pure.js +2 -2
  22. package/Engines/abstractEngine.pure.js.map +1 -1
  23. package/Engines/engineCapabilities.d.ts +5 -0
  24. package/Engines/engineCapabilities.js.map +1 -1
  25. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  26. package/Engines/thinNativeEngine.pure.js +52 -10
  27. package/Engines/thinNativeEngine.pure.js.map +1 -1
  28. package/Engines/webgpuEngine.pure.d.ts +1 -0
  29. package/Engines/webgpuEngine.pure.js +22 -8
  30. package/Engines/webgpuEngine.pure.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  38. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  39. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  42. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  44. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  48. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  49. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  51. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  54. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  57. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  58. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  63. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  64. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  65. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  66. package/FlowGraph/Blocks/Event/index.js +1 -0
  67. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  69. package/FlowGraph/Blocks/Event/pure.js +1 -0
  70. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  87. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  89. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  90. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  92. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  93. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  94. package/FlowGraph/flowGraphContext.d.ts +23 -0
  95. package/FlowGraph/flowGraphContext.js +29 -0
  96. package/FlowGraph/flowGraphContext.js.map +1 -1
  97. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  98. package/FlowGraph/flowGraphCoordinator.js +72 -0
  99. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  100. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  101. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  102. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  103. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  104. package/FlowGraph/flowGraphHostResolver.js +25 -0
  105. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  106. package/FlowGraph/flowGraphMath.d.ts +48 -1
  107. package/FlowGraph/flowGraphMath.js +169 -4
  108. package/FlowGraph/flowGraphMath.js.map +1 -1
  109. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  110. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  111. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  112. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  113. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  114. package/FlowGraph/index.d.ts +2 -0
  115. package/FlowGraph/index.js +2 -0
  116. package/FlowGraph/index.js.map +1 -1
  117. package/FlowGraph/pure.d.ts +2 -0
  118. package/FlowGraph/pure.js +2 -0
  119. package/FlowGraph/pure.js.map +1 -1
  120. package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
  121. package/Materials/Node/nodeMaterial.pure.js +18 -1
  122. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  123. package/Materials/Textures/envCubeTexture.pure.js +7 -2
  124. package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
  125. package/Materials/materialHelper.functions.d.ts +14 -0
  126. package/Materials/materialHelper.functions.js +67 -0
  127. package/Materials/materialHelper.functions.js.map +1 -1
  128. package/Maths/math.vector.pure.d.ts +11 -1
  129. package/Maths/math.vector.pure.js +13 -0
  130. package/Maths/math.vector.pure.js.map +1 -1
  131. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  134. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  135. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  136. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  137. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  138. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  139. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  140. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  141. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  142. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  143. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  144. package/Meshes/abstractMesh.pure.js +1 -0
  145. package/Meshes/abstractMesh.pure.js.map +1 -1
  146. package/Meshes/mesh.pure.js +5 -0
  147. package/Meshes/mesh.pure.js.map +1 -1
  148. package/Meshes/transformNode.pure.js +1 -0
  149. package/Meshes/transformNode.pure.js.map +1 -1
  150. package/Misc/areaLightsTextureTools.js +1 -1
  151. package/Misc/areaLightsTextureTools.js.map +1 -1
  152. package/Misc/greasedLineTools.js +1 -1
  153. package/Misc/greasedLineTools.js.map +1 -1
  154. package/Misc/tools.pure.js +14 -2
  155. package/Misc/tools.pure.js.map +1 -1
  156. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  157. package/Particles/gpuParticleSystem.pure.js +189 -49
  158. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  159. package/Physics/v2/characterController.js +69 -17
  160. package/Physics/v2/characterController.js.map +1 -1
  161. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
  162. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
  163. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
  164. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
  165. package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
  166. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  167. package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
  168. package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
  170. package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
  171. package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
  172. package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
  173. package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
  174. package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
  175. package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
  176. package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
  177. package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
  178. package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
  179. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
  180. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  181. package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
  182. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  183. package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
  184. package/Shaders/fsr1Sharpen.fragment.js +26 -0
  185. package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
  186. package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
  187. package/Shaders/fsr1Upscale.fragment.js +77 -0
  188. package/Shaders/fsr1Upscale.fragment.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
  191. package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
  192. package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
  193. package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
  194. package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
  195. package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
  196. package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
  197. package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
  198. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  199. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  200. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  201. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  202. package/XR/features/WebXRAbstractFeature.js +16 -0
  203. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  204. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  205. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  206. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  207. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  208. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  209. package/XR/features/WebXRLayers.pure.js +65 -8
  210. package/XR/features/WebXRLayers.pure.js.map +1 -1
  211. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  212. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  213. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  214. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  215. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  216. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  217. package/XR/webXRCamera.js +27 -0
  218. package/XR/webXRCamera.js.map +1 -1
  219. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  220. package/XR/webXRFeatureWarningRegistry.js +19 -0
  221. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  222. package/XR/webXRFeaturesManager.d.ts +5 -0
  223. package/XR/webXRFeaturesManager.js +23 -4
  224. package/XR/webXRFeaturesManager.js.map +1 -1
  225. package/XR/webXRGraphicsBinding.d.ts +17 -10
  226. package/XR/webXRGraphicsBinding.js +8 -5
  227. package/XR/webXRGraphicsBinding.js.map +1 -1
  228. package/XR/webXRSessionManager.d.ts +3 -5
  229. package/XR/webXRSessionManager.js +1 -3
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  232. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  233. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  234. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ import { type Scene } from "../../../scene.js";
2
+ import { PostProcessRenderPipeline } from "../postProcessRenderPipeline.js";
3
+ /**
4
+ * FidelityFX Super Resolution (FSR) 1 render pipeline.
5
+ * This can be used to render the scene at a lower resolution and upscale it.
6
+ */
7
+ export declare class FSR1RenderingPipeline extends PostProcessRenderPipeline {
8
+ /**
9
+ * AMD's recommended `scaleFactor` for an "Ultra Quality" preset (equal to 1.3)
10
+ */
11
+ static readonly SCALE_ULTRA_QUALITY = 1.3;
12
+ /**
13
+ * AMD's recommended `scaleFactor` for a "Quality" preset (equal to 1.5)
14
+ */
15
+ static readonly SCALE_QUALITY = 1.5;
16
+ /**
17
+ * AMD's recommended `scaleFactor` for a "Balanced" preset (equal to 1.7)
18
+ */
19
+ static readonly SCALE_BALANCED = 1.7;
20
+ /**
21
+ * AMD's recommended `scaleFactor` for a "Performance" preset (equal to 2)
22
+ */
23
+ static readonly SCALE_PERFORMANCE = 2;
24
+ private readonly _scene;
25
+ /**
26
+ * Returns true if FSR is supported by the running hardware
27
+ */
28
+ get isSupported(): boolean;
29
+ private _samples;
30
+ /**
31
+ * MSAA sample count (default: 4).
32
+ * Disabling MSAA is not recommended since aliased edges will be exaggerated by the FSR pass.
33
+ * Always have at least one AA solution enabled, whether that be MSAA with this setting or a post-process effect like FXAA or TAA.
34
+ */
35
+ get samples(): number;
36
+ set samples(samples: number);
37
+ private _scaleFactor;
38
+ /**
39
+ * How much smaller to render the scene at (default: 1.5).
40
+ * For example, a value of 2 will render the scene at half resolution.
41
+ */
42
+ get scaleFactor(): number;
43
+ set scaleFactor(factor: number);
44
+ private _sharpnessStops;
45
+ /**
46
+ * The number of stops (halving) of the reduction of sharpness (default: 0.2).
47
+ * A value of 0 indicates a maximum sharpness.
48
+ */
49
+ get sharpnessStops(): number;
50
+ set sharpnessStops(stops: number);
51
+ /**
52
+ * The FSR upscale PostProcess ID in the pipeline
53
+ */
54
+ FSR1UpscaleEffect: string;
55
+ private readonly _thinUpscalePostProcess;
56
+ private _upscalePostProcess;
57
+ /**
58
+ * The FSR sharpen PostProcess ID in the pipeline
59
+ */
60
+ FSR1SharpenEffect: string;
61
+ private readonly _thinSharpenPostProcess;
62
+ private _sharpenPostProcess;
63
+ /**
64
+ * Creates a new FSR 1 rendering pipeline
65
+ * @param name The rendering pipeline name
66
+ * @param scene The scene linked to this pipeline
67
+ * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)
68
+ */
69
+ constructor(name: string, scene: Scene, cameras?: import("../../../index.js").Camera[]);
70
+ private _buildPipeline;
71
+ /**
72
+ * Disposes of the pipeline
73
+ */
74
+ dispose(): void;
75
+ private _createUpscalePostProcess;
76
+ private _disposeUpscalePostProcess;
77
+ private _createSharpenPostProcess;
78
+ private _disposeSharpenPostProcess;
79
+ }
@@ -0,0 +1,171 @@
1
+ import { PostProcessRenderEffect } from "../postProcessRenderEffect.js";
2
+ import { PostProcessRenderPipeline } from "../postProcessRenderPipeline.js";
3
+ import { PostProcess } from "../../postProcess.pure.js";
4
+ import { ThinFSR1UpscalePostProcess } from "../../thinFSR1UpscalePostProcess.js";
5
+ import { ThinFSR1SharpenPostProcess } from "../../thinFSR1SharpenPostProcess.js";
6
+ /**
7
+ * FidelityFX Super Resolution (FSR) 1 render pipeline.
8
+ * This can be used to render the scene at a lower resolution and upscale it.
9
+ */
10
+ export class FSR1RenderingPipeline extends PostProcessRenderPipeline {
11
+ /**
12
+ * Returns true if FSR is supported by the running hardware
13
+ */
14
+ get isSupported() {
15
+ // FSR 1 needs integer texel fetch (texelFetch/textureSize) and bit-cast intrinsics.
16
+ // These are available on WebGPU, WebGL2 and Babylon Native (all report version >= 2 or isWebGPU),
17
+ // but not WebGL1. Note caps.texelFetch cannot be used here because Babylon Native reports it as
18
+ // false even though the underlying backend supports the required operations.
19
+ return this.engine.isWebGPU || this.engine.version >= 2;
20
+ }
21
+ /**
22
+ * MSAA sample count (default: 4).
23
+ * Disabling MSAA is not recommended since aliased edges will be exaggerated by the FSR pass.
24
+ * Always have at least one AA solution enabled, whether that be MSAA with this setting or a post-process effect like FXAA or TAA.
25
+ */
26
+ get samples() {
27
+ return this._samples;
28
+ }
29
+ set samples(samples) {
30
+ if (this._samples === samples) {
31
+ return;
32
+ }
33
+ this._samples = samples;
34
+ if (this._upscalePostProcess) {
35
+ this._upscalePostProcess.samples = this._samples;
36
+ }
37
+ }
38
+ /**
39
+ * How much smaller to render the scene at (default: 1.5).
40
+ * For example, a value of 2 will render the scene at half resolution.
41
+ */
42
+ get scaleFactor() {
43
+ return this._scaleFactor;
44
+ }
45
+ set scaleFactor(factor) {
46
+ if (this._scaleFactor === factor) {
47
+ return;
48
+ }
49
+ this._scaleFactor = factor;
50
+ this._buildPipeline();
51
+ }
52
+ /**
53
+ * The number of stops (halving) of the reduction of sharpness (default: 0.2).
54
+ * A value of 0 indicates a maximum sharpness.
55
+ */
56
+ get sharpnessStops() {
57
+ return this._sharpnessStops;
58
+ }
59
+ set sharpnessStops(stops) {
60
+ if (this._sharpnessStops === stops) {
61
+ return;
62
+ }
63
+ this._sharpnessStops = stops;
64
+ // The value is applied to the effect every frame in the sharpen post-process onApply callback.
65
+ }
66
+ /**
67
+ * Creates a new FSR 1 rendering pipeline
68
+ * @param name The rendering pipeline name
69
+ * @param scene The scene linked to this pipeline
70
+ * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)
71
+ */
72
+ constructor(name, scene, cameras = scene.cameras) {
73
+ super(scene.getEngine(), name);
74
+ this._samples = 4;
75
+ this._scaleFactor = FSR1RenderingPipeline.SCALE_QUALITY;
76
+ this._sharpnessStops = 0.2;
77
+ /**
78
+ * The FSR upscale PostProcess ID in the pipeline
79
+ */
80
+ // eslint-disable-next-line @typescript-eslint/naming-convention
81
+ this.FSR1UpscaleEffect = "FSR1UpscaleEffect";
82
+ /**
83
+ * The FSR sharpen PostProcess ID in the pipeline
84
+ */
85
+ // eslint-disable-next-line @typescript-eslint/naming-convention
86
+ this.FSR1SharpenEffect = "FSR1SharpenEffect";
87
+ this._scene = scene;
88
+ this._cameras = cameras.slice();
89
+ this._thinUpscalePostProcess = new ThinFSR1UpscalePostProcess(name + "Upscale", this.engine);
90
+ this._thinSharpenPostProcess = new ThinFSR1SharpenPostProcess(name + "Sharpen", this.engine);
91
+ this._createSharpenPostProcess();
92
+ if (this.isSupported) {
93
+ scene.postProcessRenderPipelineManager.addPipeline(this);
94
+ this._buildPipeline();
95
+ }
96
+ }
97
+ _buildPipeline() {
98
+ if (!this.isSupported) {
99
+ return;
100
+ }
101
+ const cameras = this._cameras.slice();
102
+ this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, cameras);
103
+ this._reset();
104
+ this._disposeUpscalePostProcess();
105
+ this._createUpscalePostProcess();
106
+ this.addEffect(new PostProcessRenderEffect(this.engine, this.FSR1UpscaleEffect, () => this._upscalePostProcess));
107
+ this.addEffect(new PostProcessRenderEffect(this.engine, this.FSR1SharpenEffect, () => this._sharpenPostProcess));
108
+ this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name, cameras);
109
+ }
110
+ /**
111
+ * Disposes of the pipeline
112
+ */
113
+ dispose() {
114
+ this._disposeSharpenPostProcess();
115
+ this._thinSharpenPostProcess.dispose();
116
+ this._disposeUpscalePostProcess();
117
+ this._thinUpscalePostProcess.dispose();
118
+ super.dispose();
119
+ }
120
+ _createUpscalePostProcess() {
121
+ const postProcess = new PostProcess(this._thinUpscalePostProcess.name, ThinFSR1UpscalePostProcess.FragmentUrl, {
122
+ uniforms: ThinFSR1UpscalePostProcess.Uniforms,
123
+ size: 1 / this._scaleFactor,
124
+ engine: this.engine,
125
+ effectWrapper: this._thinUpscalePostProcess,
126
+ });
127
+ postProcess.samples = this._samples;
128
+ postProcess.onApplyObservable.add((effect) => {
129
+ this._thinUpscalePostProcess.updateConstants(effect, postProcess.width, postProcess.height, postProcess.width, postProcess.height, this.engine.getRenderWidth(), this.engine.getRenderHeight());
130
+ });
131
+ this._upscalePostProcess = postProcess;
132
+ }
133
+ _disposeUpscalePostProcess() {
134
+ for (const camera of this._cameras) {
135
+ this._upscalePostProcess?.dispose(camera);
136
+ }
137
+ this._upscalePostProcess = null;
138
+ }
139
+ _createSharpenPostProcess() {
140
+ this._sharpenPostProcess = new PostProcess(this._thinSharpenPostProcess.name, ThinFSR1SharpenPostProcess.FragmentUrl, {
141
+ uniforms: ThinFSR1SharpenPostProcess.Uniforms,
142
+ engine: this.engine,
143
+ effectWrapper: this._thinSharpenPostProcess,
144
+ });
145
+ this._sharpenPostProcess.onApplyObservable.add((effect) => {
146
+ this._thinSharpenPostProcess.updateConstants(effect, this._sharpnessStops);
147
+ });
148
+ }
149
+ _disposeSharpenPostProcess() {
150
+ for (const camera of this._cameras) {
151
+ this._sharpenPostProcess.dispose(camera);
152
+ }
153
+ }
154
+ }
155
+ /**
156
+ * AMD's recommended `scaleFactor` for an "Ultra Quality" preset (equal to 1.3)
157
+ */
158
+ FSR1RenderingPipeline.SCALE_ULTRA_QUALITY = 1.3;
159
+ /**
160
+ * AMD's recommended `scaleFactor` for a "Quality" preset (equal to 1.5)
161
+ */
162
+ FSR1RenderingPipeline.SCALE_QUALITY = 1.5;
163
+ /**
164
+ * AMD's recommended `scaleFactor` for a "Balanced" preset (equal to 1.7)
165
+ */
166
+ FSR1RenderingPipeline.SCALE_BALANCED = 1.7;
167
+ /**
168
+ * AMD's recommended `scaleFactor` for a "Performance" preset (equal to 2)
169
+ */
170
+ FSR1RenderingPipeline.SCALE_PERFORMANCE = 2;
171
+ //# sourceMappingURL=fsr1RenderingPipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsr1RenderingPipeline.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,yBAAyB;IAoBhE;;OAEG;IACH,IAAoB,WAAW;QAC3B,oFAAoF;QACpF,kGAAkG;QAClG,gGAAgG;QAChG,6EAA6E;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;IAC5D,CAAC;IAGD;;;;OAIG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,OAAe;QAC9B,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAC5B,OAAO;QACX,CAAC;QACD,IAAI,CAAC,Q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AC,uBAAuB,CAAC,IAAI,EAAE,0BAA0B,CAAC,WAAW,EAAE;YAClH,QAAQ,EAAE,0BAA0B,CAAC,QAAQ;YAC7C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,aAAa,EAAE,IAAI,CAAC,uBAAuB;SAC9C,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACtD,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,0BAA0B;QAC9B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;;AAnMD;;GAEG;AACoB,yCAAmB,GAAG,GAAG,AAAN,CAAO;AACjD;;GAEG;AACoB,mCAAa,GAAG,GAAG,AAAN,CAAO;AAC3C;;GAEG;AACoB,oCAAc,GAAG,GAAG,AAAN,CAAO;AAC5C;;GAEG;AACoB,uCAAiB,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { type Scene } from \"core/scene\";\nimport { type Nullable } from \"core/types\";\n\nimport { PostProcessRenderEffect } from \"../postProcessRenderEffect\";\nimport { PostProcessRenderPipeline } from \"../postProcessRenderPipeline\";\nimport { PostProcess } from \"../../postProcess.pure\";\nimport { ThinFSR1UpscalePostProcess } from \"../../thinFSR1UpscalePostProcess\";\nimport { ThinFSR1SharpenPostProcess } from \"../../thinFSR1SharpenPostProcess\";\n\n/**\n * FidelityFX Super Resolution (FSR) 1 render pipeline.\n * This can be used to render the scene at a lower resolution and upscale it.\n */\nexport class FSR1RenderingPipeline extends PostProcessRenderPipeline {\n /**\n * AMD's recommended `scaleFactor` for an \"Ultra Quality\" preset (equal to 1.3)\n */\n public static readonly SCALE_ULTRA_QUALITY = 1.3;\n /**\n * AMD's recommended `scaleFactor` for a \"Quality\" preset (equal to 1.5)\n */\n public static readonly SCALE_QUALITY = 1.5;\n /**\n * AMD's recommended `scaleFactor` for a \"Balanced\" preset (equal to 1.7)\n */\n public static readonly SCALE_BALANCED = 1.7;\n /**\n * AMD's recommended `scaleFactor` for a \"Performance\" preset (equal to 2)\n */\n public static readonly SCALE_PERFORMANCE = 2;\n\n private readonly _scene: Scene;\n\n /**\n * Returns true if FSR is supported by the running hardware\n */\n public override get isSupported(): boolean {\n // FSR 1 needs integer texel fetch (texelFetch/textureSize) and bit-cast intrinsics.\n // These are available on WebGPU, WebGL2 and Babylon Native (all report version >= 2 or isWebGPU),\n // but not WebGL1. Note caps.texelFetch cannot be used here because Babylon Native reports it as\n // false even though the underlying backend supports the required operations.\n return this.engine.isWebGPU || this.engine.version >= 2;\n }\n\n private _samples = 4;\n /**\n * MSAA sample count (default: 4).\n * Disabling MSAA is not recommended since aliased edges will be exaggerated by the FSR pass.\n * Always have at least one AA solution enabled, whether that be MSAA with this setting or a post-process effect like FXAA or TAA.\n */\n public get samples(): number {\n return this._samples;\n }\n\n public set samples(samples: number) {\n if (this._samples === samples) {\n return;\n }\n this._samples = samples;\n if (this._upscalePostProcess) {\n this._upscalePostProcess.samples = this._samples;\n }\n }\n\n private _scaleFactor = FSR1RenderingPipeline.SCALE_QUALITY;\n /**\n * How much smaller to render the scene at (default: 1.5).\n * For example, a value of 2 will render the scene at half resolution.\n */\n public get scaleFactor(): number {\n return this._scaleFactor;\n }\n\n public set scaleFactor(factor: number) {\n if (this._scaleFactor === factor) {\n return;\n }\n this._scaleFactor = factor;\n this._buildPipeline();\n }\n\n private _sharpnessStops = 0.2;\n /**\n * The number of stops (halving) of the reduction of sharpness (default: 0.2).\n * A value of 0 indicates a maximum sharpness.\n */\n public get sharpnessStops(): number {\n return this._sharpnessStops;\n }\n\n public set sharpnessStops(stops: number) {\n if (this._sharpnessStops === stops) {\n return;\n }\n this._sharpnessStops = stops;\n // The value is applied to the effect every frame in the sharpen post-process onApply callback.\n }\n\n /**\n * The FSR upscale PostProcess ID in the pipeline\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public FSR1UpscaleEffect = \"FSR1UpscaleEffect\";\n private readonly _thinUpscalePostProcess: ThinFSR1UpscalePostProcess;\n private _upscalePostProcess: Nullable<PostProcess>;\n\n /**\n * The FSR sharpen PostProcess ID in the pipeline\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public FSR1SharpenEffect = \"FSR1SharpenEffect\";\n private readonly _thinSharpenPostProcess: ThinFSR1SharpenPostProcess;\n private _sharpenPostProcess: PostProcess;\n\n /**\n * Creates a new FSR 1 rendering pipeline\n * @param name The rendering pipeline name\n * @param scene The scene linked to this pipeline\n * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)\n */\n constructor(name: string, scene: Scene, cameras = scene.cameras) {\n super(scene.getEngine(), name);\n this._scene = scene;\n this._cameras = cameras.slice();\n\n this._thinUpscalePostProcess = new ThinFSR1UpscalePostProcess(name + \"Upscale\", this.engine);\n this._thinSharpenPostProcess = new ThinFSR1SharpenPostProcess(name + \"Sharpen\", this.engine);\n this._createSharpenPostProcess();\n\n if (this.isSupported) {\n scene.postProcessRenderPipelineManager.addPipeline(this);\n this._buildPipeline();\n }\n }\n\n private _buildPipeline(): void {\n if (!this.isSupported) {\n return;\n }\n const cameras = this._cameras.slice();\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, cameras);\n this._reset();\n\n this._disposeUpscalePostProcess();\n this._createUpscalePostProcess();\n\n this.addEffect(new PostProcessRenderEffect(this.engine, this.FSR1UpscaleEffect, () => this._upscalePostProcess));\n this.addEffect(new PostProcessRenderEffect(this.engine, this.FSR1SharpenEffect, () => this._sharpenPostProcess));\n\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name, cameras);\n }\n\n /**\n * Disposes of the pipeline\n */\n public override dispose(): void {\n this._disposeSharpenPostProcess();\n this._thinSharpenPostProcess.dispose();\n this._disposeUpscalePostProcess();\n this._thinUpscalePostProcess.dispose();\n super.dispose();\n }\n\n private _createUpscalePostProcess(): void {\n const postProcess = new PostProcess(this._thinUpscalePostProcess.name, ThinFSR1UpscalePostProcess.FragmentUrl, {\n uniforms: ThinFSR1UpscalePostProcess.Uniforms,\n size: 1 / this._scaleFactor,\n engine: this.engine,\n effectWrapper: this._thinUpscalePostProcess,\n });\n postProcess.samples = this._samples;\n\n postProcess.onApplyObservable.add((effect) => {\n this._thinUpscalePostProcess.updateConstants(\n effect,\n postProcess.width,\n postProcess.height,\n postProcess.width,\n postProcess.height,\n this.engine.getRenderWidth(),\n this.engine.getRenderHeight()\n );\n });\n\n this._upscalePostProcess = postProcess;\n }\n\n private _disposeUpscalePostProcess(): void {\n for (const camera of this._cameras) {\n this._upscalePostProcess?.dispose(camera);\n }\n this._upscalePostProcess = null;\n }\n\n private _createSharpenPostProcess(): void {\n this._sharpenPostProcess = new PostProcess(this._thinSharpenPostProcess.name, ThinFSR1SharpenPostProcess.FragmentUrl, {\n uniforms: ThinFSR1SharpenPostProcess.Uniforms,\n engine: this.engine,\n effectWrapper: this._thinSharpenPostProcess,\n });\n this._sharpenPostProcess.onApplyObservable.add((effect) => {\n this._thinSharpenPostProcess.updateConstants(effect, this._sharpnessStops);\n });\n }\n\n private _disposeSharpenPostProcess(): void {\n for (const camera of this._cameras) {\n this._sharpenPostProcess.dispose(camera);\n }\n }\n}\n"]}
@@ -5,6 +5,7 @@ export * from "./ssaoRenderingPipeline.js";
5
5
  export * from "./standardRenderingPipeline.js";
6
6
  export * from "./ssrRenderingPipeline.js";
7
7
  export * from "./taaRenderingPipeline.js";
8
+ export * from "./fsr1RenderingPipeline.js";
8
9
  import "../../../Shaders/ssao2.fragment.js";
9
10
  import "../../../Shaders/ssaoCombine.fragment.js";
10
11
  import "../../../ShadersWGSL/ssao2.fragment.js";
@@ -17,3 +18,7 @@ import "../../../ShadersWGSL/screenSpaceReflection2Blur.fragment.js";
17
18
  import "../../../ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js";
18
19
  import "../../../Shaders/taa.fragment.js";
19
20
  import "../../../ShadersWGSL/taa.fragment.js";
21
+ import "../../../Shaders/fsr1Upscale.fragment.js";
22
+ import "../../../Shaders/fsr1Sharpen.fragment.js";
23
+ import "../../../ShadersWGSL/fsr1Upscale.fragment.js";
24
+ import "../../../ShadersWGSL/fsr1Sharpen.fragment.js";
@@ -5,6 +5,7 @@ export * from "./ssaoRenderingPipeline.js";
5
5
  export * from "./standardRenderingPipeline.js";
6
6
  export * from "./ssrRenderingPipeline.js";
7
7
  export * from "./taaRenderingPipeline.js";
8
+ export * from "./fsr1RenderingPipeline.js";
8
9
  // SSAO2 shaders
9
10
  import "../../../Shaders/ssao2.fragment.js";
10
11
  import "../../../Shaders/ssaoCombine.fragment.js";
@@ -20,4 +21,9 @@ import "../../../ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment.js";
20
21
  // TAA shaders
21
22
  import "../../../Shaders/taa.fragment.js";
22
23
  import "../../../ShadersWGSL/taa.fragment.js";
24
+ // FSR 1 shaders
25
+ import "../../../Shaders/fsr1Upscale.fragment.js";
26
+ import "../../../Shaders/fsr1Sharpen.fragment.js";
27
+ import "../../../ShadersWGSL/fsr1Upscale.fragment.js";
28
+ import "../../../ShadersWGSL/fsr1Sharpen.fragment.js";
23
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/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;AACvC,cAAc,wBAAwB,CAAC;AAEvC,gBAAgB;AAChB,OAAO,iCAAiC,CAAC;AACzC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,2CAA2C,CAAC;AAEnD,cAAc;AACd,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,8DAA8D,CAAC;AACtE,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0DAA0D,CAAC;AAClE,OAAO,kEAAkE,CAAC;AAE1E,cAAc;AACd,OAAO,+BAA+B,CAAC;AACvC,OAAO,mCAAmC,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\nexport * from \"./lensRenderingPipeline\";\nexport * from \"./ssao2RenderingPipeline\";\nexport * from \"./ssaoRenderingPipeline\";\nexport * from \"./standardRenderingPipeline\";\nexport * from \"./ssrRenderingPipeline\";\nexport * from \"./taaRenderingPipeline\";\n\n// SSAO2 shaders\nimport \"../../../Shaders/ssao2.fragment\";\nimport \"../../../Shaders/ssaoCombine.fragment\";\nimport \"../../../ShadersWGSL/ssao2.fragment\";\nimport \"../../../ShadersWGSL/ssaoCombine.fragment\";\n\n// SSR shaders\nimport \"../../../Shaders/screenSpaceReflection2.fragment\";\nimport \"../../../Shaders/screenSpaceReflection2Blur.fragment\";\nimport \"../../../Shaders/screenSpaceReflection2BlurCombiner.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2Blur.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment\";\n\n// TAA shaders\nimport \"../../../Shaders/taa.fragment\";\nimport \"../../../ShadersWGSL/taa.fragment\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/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;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AAExC,gBAAgB;AAChB,OAAO,iCAAiC,CAAC;AACzC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,2CAA2C,CAAC;AAEnD,cAAc;AACd,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,8DAA8D,CAAC;AACtE,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0DAA0D,CAAC;AAClE,OAAO,kEAAkE,CAAC;AAE1E,cAAc;AACd,OAAO,+BAA+B,CAAC;AACvC,OAAO,mCAAmC,CAAC;AAE3C,gBAAgB;AAChB,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,2CAA2C,CAAC;AACnD,OAAO,2CAA2C,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\nexport * from \"./lensRenderingPipeline\";\nexport * from \"./ssao2RenderingPipeline\";\nexport * from \"./ssaoRenderingPipeline\";\nexport * from \"./standardRenderingPipeline\";\nexport * from \"./ssrRenderingPipeline\";\nexport * from \"./taaRenderingPipeline\";\nexport * from \"./fsr1RenderingPipeline\";\n\n// SSAO2 shaders\nimport \"../../../Shaders/ssao2.fragment\";\nimport \"../../../Shaders/ssaoCombine.fragment\";\nimport \"../../../ShadersWGSL/ssao2.fragment\";\nimport \"../../../ShadersWGSL/ssaoCombine.fragment\";\n\n// SSR shaders\nimport \"../../../Shaders/screenSpaceReflection2.fragment\";\nimport \"../../../Shaders/screenSpaceReflection2Blur.fragment\";\nimport \"../../../Shaders/screenSpaceReflection2BlurCombiner.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2Blur.fragment\";\nimport \"../../../ShadersWGSL/screenSpaceReflection2BlurCombiner.fragment\";\n\n// TAA shaders\nimport \"../../../Shaders/taa.fragment\";\nimport \"../../../ShadersWGSL/taa.fragment\";\n\n// FSR 1 shaders\nimport \"../../../Shaders/fsr1Upscale.fragment\";\nimport \"../../../Shaders/fsr1Sharpen.fragment\";\nimport \"../../../ShadersWGSL/fsr1Upscale.fragment\";\nimport \"../../../ShadersWGSL/fsr1Sharpen.fragment\";\n"]}
@@ -6,4 +6,5 @@ export * from "./ssaoRenderingPipeline.pure.js";
6
6
  export * from "./standardRenderingPipeline.pure.js";
7
7
  export * from "./ssrRenderingPipeline.pure.js";
8
8
  export * from "./taaRenderingPipeline.pure.js";
9
+ export * from "./fsr1RenderingPipeline.js";
9
10
  export * from "./taaMaterialManager.pure.js";
@@ -6,5 +6,6 @@ export * from "./ssaoRenderingPipeline.pure.js";
6
6
  export * from "./standardRenderingPipeline.pure.js";
7
7
  export * from "./ssrRenderingPipeline.pure.js";
8
8
  export * from "./taaRenderingPipeline.pure.js";
9
+ export * from "./fsr1RenderingPipeline.js";
9
10
  export * from "./taaMaterialManager.pure.js";
10
11
  //# sourceMappingURL=pure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./defaultRenderingPipeline.pure\";\nexport * from \"./lensRenderingPipeline.pure\";\nexport * from \"./ssao2RenderingPipeline.pure\";\nexport * from \"./ssaoRenderingPipeline.pure\";\nexport * from \"./standardRenderingPipeline.pure\";\nexport * from \"./ssrRenderingPipeline.pure\";\nexport * from \"./taaRenderingPipeline.pure\";\nexport * from \"./taaMaterialManager.pure\";\n"]}
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./defaultRenderingPipeline.pure\";\nexport * from \"./lensRenderingPipeline.pure\";\nexport * from \"./ssao2RenderingPipeline.pure\";\nexport * from \"./ssaoRenderingPipeline.pure\";\nexport * from \"./standardRenderingPipeline.pure\";\nexport * from \"./ssrRenderingPipeline.pure\";\nexport * from \"./taaRenderingPipeline.pure\";\nexport * from \"./fsr1RenderingPipeline\";\nexport * from \"./taaMaterialManager.pure\";\n"]}
@@ -0,0 +1,32 @@
1
+ import { type AbstractEngine } from "../Engines/abstractEngine.js";
2
+ import { type Effect } from "../Materials/effect.js";
3
+ import { EffectWrapper, type EffectWrapperCreationOptions } from "../Materials/effectRenderer.pure.js";
4
+ import { type Nullable } from "../types.js";
5
+ /**
6
+ * Robust Contrast Adaptive Sharpening (RCAS) post-process used by FSR 1
7
+ */
8
+ export declare class ThinFSR1SharpenPostProcess extends EffectWrapper {
9
+ /**
10
+ * The fragment shader URL
11
+ */
12
+ static readonly FragmentUrl = "fsr1Sharpen";
13
+ /**
14
+ * The list of uniforms used by the effect
15
+ */
16
+ static readonly Uniforms: string[];
17
+ /**
18
+ * Creates a new FSR 1 sharpen post process
19
+ * @param name Name of the effect
20
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
21
+ * @param options Options to configure the effect
22
+ */
23
+ constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
24
+ protected _gatherImports(useWebGPU: boolean | undefined, list: Promise<any>[]): void;
25
+ /**
26
+ * Sets the required constant value on the effect. Plain uniforms are used (rather than a uniform
27
+ * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.
28
+ * @param effect The effect to set the constant on (typically the one provided by onApplyObservable).
29
+ * @param sharpness The number of stops (halving) of the reduction of sharpness (0 = maximum sharpness)
30
+ */
31
+ updateConstants(effect: Effect, sharpness: number): void;
32
+ }
@@ -0,0 +1,58 @@
1
+ import { EngineStore } from "../Engines/engineStore.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.pure.js";
3
+ /**
4
+ * Robust Contrast Adaptive Sharpening (RCAS) post-process used by FSR 1
5
+ */
6
+ export class ThinFSR1SharpenPostProcess extends EffectWrapper {
7
+ /**
8
+ * Creates a new FSR 1 sharpen post process
9
+ * @param name Name of the effect
10
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
11
+ * @param options Options to configure the effect
12
+ */
13
+ constructor(name, engine, options) {
14
+ engine ?? (engine = EngineStore.LastCreatedEngine);
15
+ super({
16
+ ...options,
17
+ name,
18
+ engine,
19
+ useShaderStore: true,
20
+ useAsPostProcess: true,
21
+ fragmentShader: ThinFSR1SharpenPostProcess.FragmentUrl,
22
+ uniforms: ThinFSR1SharpenPostProcess.Uniforms,
23
+ });
24
+ }
25
+ _gatherImports(useWebGPU, list) {
26
+ if (useWebGPU) {
27
+ this._webGPUReady = true;
28
+ list.push(import("../ShadersWGSL/fsr1Sharpen.fragment.js"));
29
+ }
30
+ else {
31
+ list.push(import("../Shaders/fsr1Sharpen.fragment.js"));
32
+ }
33
+ }
34
+ /**
35
+ * Sets the required constant value on the effect. Plain uniforms are used (rather than a uniform
36
+ * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.
37
+ * @param effect The effect to set the constant on (typically the one provided by onApplyObservable).
38
+ * @param sharpness The number of stops (halving) of the reduction of sharpness (0 = maximum sharpness)
39
+ */
40
+ updateConstants(effect, sharpness) {
41
+ // Code based on FsrRcasCon from FSR 1:
42
+ // https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/a21ffb8f6c13233ba336352bdff293894c706575/ffx-fsr/ffx_fsr1.h#L662
43
+ sharpness = Math.pow(2, -sharpness);
44
+ // Upstream FSR packs this as a uint and bitcasts it in the shader; this port declares it
45
+ // as a float on both the GLSL and WGSL sides, so it is sent as one.
46
+ // Since we haven't added the half-float shader yet, we don't need the second constant, which would require JS half-float calculation
47
+ effect.setFloat4("con", sharpness, 0, 0, 0);
48
+ }
49
+ }
50
+ /**
51
+ * The fragment shader URL
52
+ */
53
+ ThinFSR1SharpenPostProcess.FragmentUrl = "fsr1Sharpen";
54
+ /**
55
+ * The list of uniforms used by the effect
56
+ */
57
+ ThinFSR1SharpenPostProcess.Uniforms = ["con"];
58
+ //# sourceMappingURL=thinFSR1SharpenPostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinFSR1SharpenPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinFSR1SharpenPostProcess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAqC,MAAM,oCAAoC,CAAC;AAGtG;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAWzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,MAAiC,EAAE,OAAsC;QAC/F,MAAM,KAAN,MAAM,GAAK,WAAW,CAAC,iBAAkB,EAAC;QAC1C,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM;YACN,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,0BAA0B,CAAC,WAAW;YACtD,QAAQ,EAAE,0BAA0B,CAAC,QAAQ;SAChD,CAAC,CAAC;IACP,CAAC;IAEkB,cAAc,CAAC,SAA8B,EAAE,IAAoB;QAClF,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,MAAc,EAAE,SAAiB;QACpD,uCAAuC;QACvC,0HAA0H;QAC1H,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;QAEpC,yFAAyF;QACzF,oEAAoE;QACpE,qIAAqI;QACrI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;;AArDD;;GAEG;AACoB,sCAAW,GAAG,aAAa,CAAC;AAEnD;;GAEG;AACoB,mCAAQ,GAAG,CAAC,KAAK,CAAC,CAAC","sourcesContent":["import { type AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { type Effect } from \"core/Materials/effect\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { EffectWrapper, type EffectWrapperCreationOptions } from \"core/Materials/effectRenderer.pure\";\r\nimport { type Nullable } from \"core/types\";\r\n\r\n/**\r\n * Robust Contrast Adaptive Sharpening (RCAS) post-process used by FSR 1\r\n */\r\nexport class ThinFSR1SharpenPostProcess extends EffectWrapper {\r\n /**\r\n * The fragment shader URL\r\n */\r\n public static readonly FragmentUrl = \"fsr1Sharpen\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"con\"];\r\n\r\n /**\r\n * Creates a new FSR 1 sharpen post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions) {\r\n engine ??= EngineStore.LastCreatedEngine!;\r\n super({\r\n ...options,\r\n name,\r\n engine,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinFSR1SharpenPostProcess.FragmentUrl,\r\n uniforms: ThinFSR1SharpenPostProcess.Uniforms,\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean | undefined, list: Promise<any>[]): void {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/fsr1Sharpen.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/fsr1Sharpen.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Sets the required constant value on the effect. Plain uniforms are used (rather than a uniform\r\n * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.\r\n * @param effect The effect to set the constant on (typically the one provided by onApplyObservable).\r\n * @param sharpness The number of stops (halving) of the reduction of sharpness (0 = maximum sharpness)\r\n */\r\n public updateConstants(effect: Effect, sharpness: number): void {\r\n // Code based on FsrRcasCon from FSR 1:\r\n // https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/a21ffb8f6c13233ba336352bdff293894c706575/ffx-fsr/ffx_fsr1.h#L662\r\n sharpness = Math.pow(2, -sharpness);\r\n\r\n // Upstream FSR packs this as a uint and bitcasts it in the shader; this port declares it\r\n // as a float on both the GLSL and WGSL sides, so it is sent as one.\r\n // Since we haven't added the half-float shader yet, we don't need the second constant, which would require JS half-float calculation\r\n effect.setFloat4(\"con\", sharpness, 0, 0, 0);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,37 @@
1
+ import { type AbstractEngine } from "../Engines/abstractEngine.js";
2
+ import { type Effect } from "../Materials/effect.js";
3
+ import { EffectWrapper, type EffectWrapperCreationOptions } from "../Materials/effectRenderer.pure.js";
4
+ import { type Nullable } from "../types.js";
5
+ /**
6
+ * Edge Adaptive Spatial Upsampling (EASU) post-process used by FSR 1
7
+ */
8
+ export declare class ThinFSR1UpscalePostProcess extends EffectWrapper {
9
+ /**
10
+ * The fragment shader URL
11
+ */
12
+ static readonly FragmentUrl = "fsr1Upscale";
13
+ /**
14
+ * The list of uniforms used by the effect
15
+ */
16
+ static readonly Uniforms: string[];
17
+ /**
18
+ * Creates a new FSR 1 upscale post process
19
+ * @param name Name of the effect
20
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
21
+ * @param options Options to configure the effect
22
+ */
23
+ constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
24
+ protected _gatherImports(useWebGPU: boolean | undefined, list: Promise<any>[]): void;
25
+ /**
26
+ * Sets the required constant values on the effect. Plain uniforms are used (rather than a uniform
27
+ * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.
28
+ * @param effect The effect to set the constants on (typically the one provided by onApplyObservable).
29
+ * @param viewportWidth The rendered input width being upscaled
30
+ * @param viewportHeight The rendered input height being upscaled
31
+ * @param inputWidth The width of the texture containing the input viewport
32
+ * @param inputHeight The height of the texture containing the input viewport
33
+ * @param outputWidth The display width which the input image gets upscaled to
34
+ * @param outputHeight The display height which the input image gets upscaled to
35
+ */
36
+ updateConstants(effect: Effect, viewportWidth: number, viewportHeight: number, inputWidth: number, inputHeight: number, outputWidth: number, outputHeight: number): void;
37
+ }
@@ -0,0 +1,68 @@
1
+ import { EngineStore } from "../Engines/engineStore.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.pure.js";
3
+ /**
4
+ * Edge Adaptive Spatial Upsampling (EASU) post-process used by FSR 1
5
+ */
6
+ export class ThinFSR1UpscalePostProcess extends EffectWrapper {
7
+ /**
8
+ * Creates a new FSR 1 upscale post process
9
+ * @param name Name of the effect
10
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
11
+ * @param options Options to configure the effect
12
+ */
13
+ constructor(name, engine, options) {
14
+ engine ?? (engine = EngineStore.LastCreatedEngine);
15
+ super({
16
+ ...options,
17
+ name,
18
+ engine,
19
+ useShaderStore: true,
20
+ useAsPostProcess: true,
21
+ fragmentShader: ThinFSR1UpscalePostProcess.FragmentUrl,
22
+ uniforms: ThinFSR1UpscalePostProcess.Uniforms,
23
+ });
24
+ }
25
+ _gatherImports(useWebGPU, list) {
26
+ if (useWebGPU) {
27
+ this._webGPUReady = true;
28
+ list.push(import("../ShadersWGSL/fsr1Upscale.fragment.js"));
29
+ }
30
+ else {
31
+ list.push(import("../Shaders/fsr1Upscale.fragment.js"));
32
+ }
33
+ }
34
+ /**
35
+ * Sets the required constant values on the effect. Plain uniforms are used (rather than a uniform
36
+ * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.
37
+ * @param effect The effect to set the constants on (typically the one provided by onApplyObservable).
38
+ * @param viewportWidth The rendered input width being upscaled
39
+ * @param viewportHeight The rendered input height being upscaled
40
+ * @param inputWidth The width of the texture containing the input viewport
41
+ * @param inputHeight The height of the texture containing the input viewport
42
+ * @param outputWidth The display width which the input image gets upscaled to
43
+ * @param outputHeight The display height which the input image gets upscaled to
44
+ */
45
+ updateConstants(effect, viewportWidth, viewportHeight, inputWidth, inputHeight, outputWidth, outputHeight) {
46
+ // Code based on FsrEasuCon from FSR 1:
47
+ // https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/a21ffb8f6c13233ba336352bdff293894c706575/ffx-fsr/ffx_fsr1.h#L156
48
+ const rcpInputWidth = 1 / inputWidth;
49
+ const rcpInputHeight = 1 / inputHeight;
50
+ const rcpOutputWidth = 1 / outputWidth;
51
+ const rcpOutputHeight = 1 / outputHeight;
52
+ // Upstream FSR packs these as uints and bitcasts them in the shader; this port declares
53
+ // them as floats on both the GLSL and WGSL sides, so they are sent as floats.
54
+ effect.setFloat4("con0", viewportWidth * rcpOutputWidth, viewportHeight * rcpOutputHeight, 0.5 * viewportWidth * rcpOutputWidth - 0.5, 0.5 * viewportHeight * rcpOutputHeight - 0.5);
55
+ effect.setFloat4("con1", rcpInputWidth, rcpInputHeight, 1 * rcpInputWidth, -1 * rcpInputHeight);
56
+ effect.setFloat4("con2", -1 * rcpInputWidth, 2 * rcpInputHeight, 1 * rcpInputWidth, 2 * rcpInputHeight);
57
+ effect.setFloat4("con3", 0 * rcpInputWidth, 4 * rcpInputHeight, 0, 0);
58
+ }
59
+ }
60
+ /**
61
+ * The fragment shader URL
62
+ */
63
+ ThinFSR1UpscalePostProcess.FragmentUrl = "fsr1Upscale";
64
+ /**
65
+ * The list of uniforms used by the effect
66
+ */
67
+ ThinFSR1UpscalePostProcess.Uniforms = ["con0", "con1", "con2", "con3"];
68
+ //# sourceMappingURL=thinFSR1UpscalePostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinFSR1UpscalePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinFSR1UpscalePostProcess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAqC,MAAM,oCAAoC,CAAC;AAGtG;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAWzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,MAAiC,EAAE,OAAsC;QAC/F,MAAM,KAAN,MAAM,GAAK,WAAW,CAAC,iBAAkB,EAAC;QAC1C,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM;YACN,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,0BAA0B,CAAC,WAAW;YACtD,QAAQ,EAAE,0BAA0B,CAAC,QAAQ;SAChD,CAAC,CAAC;IACP,CAAC;IAEkB,cAAc,CAAC,SAA8B,EAAE,IAAoB;QAClF,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAA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AAE,MAAM,CAAC,CAAC","sourcesContent":["import { type AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { type Effect } from \"core/Materials/effect\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { EffectWrapper, type EffectWrapperCreationOptions } from \"core/Materials/effectRenderer.pure\";\r\nimport { type Nullable } from \"core/types\";\r\n\r\n/**\r\n * Edge Adaptive Spatial Upsampling (EASU) post-process used by FSR 1\r\n */\r\nexport class ThinFSR1UpscalePostProcess extends EffectWrapper {\r\n /**\r\n * The fragment shader URL\r\n */\r\n public static readonly FragmentUrl = \"fsr1Upscale\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"con0\", \"con1\", \"con2\", \"con3\"];\r\n\r\n /**\r\n * Creates a new FSR 1 upscale post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions) {\r\n engine ??= EngineStore.LastCreatedEngine!;\r\n super({\r\n ...options,\r\n name,\r\n engine,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinFSR1UpscalePostProcess.FragmentUrl,\r\n uniforms: ThinFSR1UpscalePostProcess.Uniforms,\r\n });\r\n }\r\n\r\n protected override _gatherImports(useWebGPU: boolean | undefined, list: Promise<any>[]): void {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/fsr1Upscale.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/fsr1Upscale.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Sets the required constant values on the effect. Plain uniforms are used (rather than a uniform\r\n * buffer) so this works on every backend, including Babylon Native, which disables uniform buffers.\r\n * @param effect The effect to set the constants on (typically the one provided by onApplyObservable).\r\n * @param viewportWidth The rendered input width being upscaled\r\n * @param viewportHeight The rendered input height being upscaled\r\n * @param inputWidth The width of the texture containing the input viewport\r\n * @param inputHeight The height of the texture containing the input viewport\r\n * @param outputWidth The display width which the input image gets upscaled to\r\n * @param outputHeight The display height which the input image gets upscaled to\r\n */\r\n public updateConstants(\r\n effect: Effect,\r\n viewportWidth: number,\r\n viewportHeight: number,\r\n inputWidth: number,\r\n inputHeight: number,\r\n outputWidth: number,\r\n outputHeight: number\r\n ): void {\r\n // Code based on FsrEasuCon from FSR 1:\r\n // https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/a21ffb8f6c13233ba336352bdff293894c706575/ffx-fsr/ffx_fsr1.h#L156\r\n const rcpInputWidth = 1 / inputWidth;\r\n const rcpInputHeight = 1 / inputHeight;\r\n const rcpOutputWidth = 1 / outputWidth;\r\n const rcpOutputHeight = 1 / outputHeight;\r\n\r\n // Upstream FSR packs these as uints and bitcasts them in the shader; this port declares\r\n // them as floats on both the GLSL and WGSL sides, so they are sent as floats.\r\n effect.setFloat4(\r\n \"con0\",\r\n viewportWidth * rcpOutputWidth,\r\n viewportHeight * rcpOutputHeight,\r\n 0.5 * viewportWidth * rcpOutputWidth - 0.5,\r\n 0.5 * viewportHeight * rcpOutputHeight - 0.5\r\n );\r\n effect.setFloat4(\"con1\", rcpInputWidth, rcpInputHeight, 1 * rcpInputWidth, -1 * rcpInputHeight);\r\n effect.setFloat4(\"con2\", -1 * rcpInputWidth, 2 * rcpInputHeight, 1 * rcpInputWidth, 2 * rcpInputHeight);\r\n effect.setFloat4(\"con3\", 0 * rcpInputWidth, 4 * rcpInputHeight, 0, 0);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,5 @@
1
+ /** @internal */
2
+ export declare const ffxFunctions: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -0,0 +1,18 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "../../Engines/shaderStore.js";
3
+ const name = "ffxFunctions";
4
+ const shader = `float AMax3F1(float x,float y,float z) {return max(x,max(y,z));}
5
+ vec3 AMax3F3(vec3 x,vec3 y,vec3 z) {return max(x,max(y,z));}
6
+ float AMin3F1(float x,float y,float z) {return min(x,min(y,z));}
7
+ vec3 AMin3F3(vec3 x,vec3 y,vec3 z) {return min(x,min(y,z));}
8
+ float APrxLoRcpF1(float a) {return uintBitsToFloat(0x7ef07ebbu-floatBitsToUint(a));}
9
+ float APrxMedRcpF1(float a) {float b=uintBitsToFloat(0x7ef19fffu-floatBitsToUint(a));return b*(-b*a+2.0);}
10
+ float APrxLoRsqF1(float a) {return uintBitsToFloat(0x5f347d74u-(floatBitsToUint(a)>>1u));}
11
+ `;
12
+ // Sideeffect
13
+ if (!ShaderStore.IncludesShadersStore[name]) {
14
+ ShaderStore.IncludesShadersStore[name] = shader;
15
+ }
16
+ /** @internal */
17
+ export const ffxFunctions = { name, shader };
18
+ //# sourceMappingURL=ffxFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffxFunctions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/ffxFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,MAAM,MAAM,GAAG;;;;;;;CAOd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\nconst name = \"ffxFunctions\";\nconst shader = `float AMax3F1(float x,float y,float z) {return max(x,max(y,z));}\nvec3 AMax3F3(vec3 x,vec3 y,vec3 z) {return max(x,max(y,z));}\nfloat AMin3F1(float x,float y,float z) {return min(x,min(y,z));}\nvec3 AMin3F3(vec3 x,vec3 y,vec3 z) {return min(x,min(y,z));}\nfloat APrxLoRcpF1(float a) {return uintBitsToFloat(0x7ef07ebbu-floatBitsToUint(a));}\nfloat APrxMedRcpF1(float a) {float b=uintBitsToFloat(0x7ef19fffu-floatBitsToUint(a));return b*(-b*a+2.0);}\nfloat APrxLoRsqF1(float a) {return uintBitsToFloat(0x5f347d74u-(floatBitsToUint(a)>>1u));}\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const ffxFunctions = { name, shader };\n"]}
@@ -127,13 +127,13 @@ vec2 noiseInput,
127
127
  bool isRefraction,
128
128
  float ior
129
129
  )
130
- {vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float clampedAlphaT=max(alphaTangent,MINIMUMVARIANCE);float clampedAlphaB=max(alphaBitangent,MINIMUMVARIANCE);float effectiveDim=dim0*sqrt(clampedAlphaT*clampedAlphaB);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0f,0.0f,1.0f);float weight=0.;
130
+ {vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float clampedAlphaT=max(alphaTangent,MINIMUMVARIANCE);float clampedAlphaB=max(alphaBitangent,MINIMUMVARIANCE);float effectiveDim=dim0*sqrt(clampedAlphaT*clampedAlphaB);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0,0.0,1.0);float weight=0.;
131
131
  #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
132
132
  for(uint i=0u; i<NUM_SAMPLES; ++i)
133
133
  #else
134
134
  for(int i=0; i<NUM_SAMPLES; ++i)
135
135
  #endif
136
- {vec2 Xi=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5f,0.015f,noiseScale));
136
+ {vec2 Xi=hammersley(i,NUM_SAMPLES);Xi=fract(Xi+noiseInput*mix(0.5,0.015,noiseScale));
137
137
  vec3 H_tangent=hemisphereImportanceSampleDggxAnisotropic(Xi,clampedAlphaT,clampedAlphaB);vec3 H=normalize(H_tangent.x*T+H_tangent.y*B+H_tangent.z*N);vec3 L;if (isRefraction) {L=refract(-V,H,1.0/ior);} else {L=reflect(-V,H);}
138
138
  float NoH=max(dot(N,H),0.001);float VoH=max(dot(V,H),0.001);float NoL=max(dot(N,L),0.001);if (NoL>0.) {float pdf_inversed=4./normalDistributionFunction_BurleyGGX_Anisotropic(
139
139
  H_tangent.z,H_tangent.x,H_tangent.y,vec2(clampedAlphaT,clampedAlphaB)