@meimu/mutracer 0.3.0 → 0.3.1

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 (304) hide show
  1. package/CHANGELOG.md +222 -0
  2. package/LICENSES/FidelityFX-FSR.txt +19 -0
  3. package/LICENSES/pbrt-v4-Apache-2.0.txt +202 -0
  4. package/THIRD_PARTY_NOTICES.md +18 -4
  5. package/dist/assets/bvh.worker.js +1 -1
  6. package/dist/mutracer.umd.js +6260 -5580
  7. package/docs/api.md +45 -18
  8. package/docs/materials.md +4 -2
  9. package/docs/performance.md +7 -0
  10. package/docs/post-processing.md +62 -9
  11. package/docs/progressive-rendering.md +3 -0
  12. package/docs/sampling.md +4 -0
  13. package/docs/technical/acceleration.md +52 -0
  14. package/docs/technical/aovs.md +79 -0
  15. package/docs/technical/caustics.md +109 -0
  16. package/docs/technical/continuous-spectrum.md +29 -0
  17. package/docs/technical/display-upscale.md +82 -0
  18. package/docs/technical/openpbr.md +99 -0
  19. package/docs/technical/pbrt-import.md +168 -0
  20. package/docs/technical/tiling.md +74 -0
  21. package/docs/technical/webgl.md +53 -0
  22. package/docs/viewer.md +11 -1
  23. package/lib/Display.d.ts +19 -5
  24. package/lib/Display.js +10 -7
  25. package/lib/Display.js.map +1 -1
  26. package/lib/Engine.d.ts +2 -1
  27. package/lib/Engine.js +30 -2
  28. package/lib/Engine.js.map +1 -1
  29. package/lib/Render.d.ts +20 -11
  30. package/lib/Render.js +32 -7
  31. package/lib/Render.js.map +1 -1
  32. package/lib/main.d.ts +3 -1
  33. package/lib/main.js +1 -0
  34. package/lib/main.js.map +1 -1
  35. package/lib/oidn.d.ts +1 -1
  36. package/lib/renderer/AovPrimitiveCache.js +39 -8
  37. package/lib/renderer/AovPrimitiveCache.js.map +1 -1
  38. package/lib/renderer/DisplayPostProcess.d.ts +8 -3
  39. package/lib/renderer/DisplayPostProcess.js +51 -18
  40. package/lib/renderer/DisplayPostProcess.js.map +1 -1
  41. package/lib/renderer/MaterialData.js +7 -2
  42. package/lib/renderer/MaterialData.js.map +1 -1
  43. package/lib/renderer/RenderingPipeline.d.ts +7 -1
  44. package/lib/renderer/RenderingPipeline.js.map +1 -1
  45. package/lib/renderer/TileRender.d.ts +2 -2
  46. package/lib/renderer/TileRender.js +128 -7
  47. package/lib/renderer/TileRender.js.map +1 -1
  48. package/lib/renderer/WGPUAov.d.ts +6 -1
  49. package/lib/renderer/WGPUAov.js +108 -14
  50. package/lib/renderer/WGPUAov.js.map +1 -1
  51. package/lib/renderer/WGPUCanvasSurface.js +12 -1
  52. package/lib/renderer/WGPUCanvasSurface.js.map +1 -1
  53. package/lib/renderer/WGPUEnvMapDistribution.js +19 -19
  54. package/lib/renderer/WGPUFullQuadPass.js +3 -3
  55. package/lib/renderer/WGPURayTraceOutput.js +12 -12
  56. package/lib/renderer/WGPURayTracePass.d.ts +17 -4
  57. package/lib/renderer/WGPURayTracePass.js +194 -71
  58. package/lib/renderer/WGPURayTracePass.js.map +1 -1
  59. package/lib/renderer/WGPURenderingPipeline.js +46 -40
  60. package/lib/renderer/WGPURenderingPipeline.js.map +1 -1
  61. package/lib/renderer/WebGLAov.js +3 -3
  62. package/lib/renderer/WebGLAov.js.map +1 -1
  63. package/lib/renderer/WebGLFullQuadPass.d.ts +1 -1
  64. package/lib/renderer/WebGLFullQuadPass.js +8 -2
  65. package/lib/renderer/WebGLFullQuadPass.js.map +1 -1
  66. package/lib/renderer/WebGLJNLMDenoiser.js +66 -66
  67. package/lib/renderer/WebGLJNLMDenoiser.js.map +1 -1
  68. package/lib/renderer/WebGLRayTraceOutputPass.js +4 -4
  69. package/lib/renderer/WebGLRayTracePass.d.ts +14 -10
  70. package/lib/renderer/WebGLRayTracePass.js +115 -111
  71. package/lib/renderer/WebGLRayTracePass.js.map +1 -1
  72. package/lib/renderer/WebGLRenderingPipeline.js +10 -3
  73. package/lib/renderer/WebGLRenderingPipeline.js.map +1 -1
  74. package/lib/renderer/WebGLSkyBaker.js +57 -57
  75. package/lib/renderer/aov.d.ts +13 -1
  76. package/lib/renderer/aov.js +21 -2
  77. package/lib/renderer/aov.js.map +1 -1
  78. package/lib/renderer/aovDisplay.js +2 -2
  79. package/lib/renderer/aovDisplay.js.map +1 -1
  80. package/lib/renderer/binnedSahBvh.d.ts +2 -1
  81. package/lib/renderer/binnedSahBvh.js +24 -17
  82. package/lib/renderer/binnedSahBvh.js.map +1 -1
  83. package/lib/renderer/bvhAccel.d.ts +3 -1
  84. package/lib/renderer/bvhAccel.js +36 -6
  85. package/lib/renderer/bvhAccel.js.map +1 -1
  86. package/lib/renderer/cameraUniform.d.ts +1 -1
  87. package/lib/renderer/cameraUniform.js +6 -2
  88. package/lib/renderer/cameraUniform.js.map +1 -1
  89. package/lib/renderer/compactVertices.d.ts +14 -0
  90. package/lib/renderer/compactVertices.js +124 -0
  91. package/lib/renderer/compactVertices.js.map +1 -0
  92. package/lib/renderer/easu.d.ts +11 -0
  93. package/lib/renderer/easu.js +156 -0
  94. package/lib/renderer/easu.js.map +1 -0
  95. package/lib/renderer/geometryUpdateState.d.ts +1 -0
  96. package/lib/renderer/geometryUpdateState.js.map +1 -1
  97. package/lib/renderer/geometryUpdates.js +3 -2
  98. package/lib/renderer/geometryUpdates.js.map +1 -1
  99. package/lib/renderer/glsl/aovDisplay.frag.js +5 -5
  100. package/lib/renderer/glsl/aovReflectance.glsl.js +35 -35
  101. package/lib/renderer/glsl/aovReflectanceSamples.glsl.js +1 -1
  102. package/lib/renderer/glsl/aovTrace.frag.js +44 -36
  103. package/lib/renderer/glsl/aovTrace.frag.js.map +1 -1
  104. package/lib/renderer/glsl/chunks/cameraProjection.glsl.d.ts +2 -0
  105. package/lib/renderer/glsl/chunks/cameraProjection.glsl.js +16 -0
  106. package/lib/renderer/glsl/chunks/cameraProjection.glsl.js.map +1 -0
  107. package/lib/renderer/glsl/chunks/cameraRay.glsl.d.ts +1 -1
  108. package/lib/renderer/glsl/chunks/cameraRay.glsl.js +9 -16
  109. package/lib/renderer/glsl/chunks/cameraRay.glsl.js.map +1 -1
  110. package/lib/renderer/glsl/chunks/emissiveLight.glsl.js +8 -8
  111. package/lib/renderer/glsl/chunks/envMap.glsl.js +67 -67
  112. package/lib/renderer/glsl/chunks/intersect.glsl.js +390 -375
  113. package/lib/renderer/glsl/chunks/intersect.glsl.js.map +1 -1
  114. package/lib/renderer/glsl/chunks/materialBuffer.glsl.js +120 -120
  115. package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js +562 -562
  116. package/lib/renderer/glsl/chunks/rand.glsl.js +3 -3
  117. package/lib/renderer/glsl/chunks/random.glsl.js +4 -4
  118. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js +37 -35
  119. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js.map +1 -1
  120. package/lib/renderer/glsl/chunks/sampleLight.glsl.js +70 -74
  121. package/lib/renderer/glsl/chunks/sampleLight.glsl.js.map +1 -1
  122. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.d.ts +1 -1
  123. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js +107 -88
  124. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js.map +1 -1
  125. package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js +11 -11
  126. package/lib/renderer/glsl/chunks/sampling.glsl.js +77 -77
  127. package/lib/renderer/glsl/chunks/sobol.glsl.js +70 -70
  128. package/lib/renderer/glsl/chunks/spectralPrefix.glsl.d.ts +6 -0
  129. package/lib/renderer/glsl/chunks/spectralPrefix.glsl.js +47 -0
  130. package/lib/renderer/glsl/chunks/spectralPrefix.glsl.js.map +1 -0
  131. package/lib/renderer/glsl/chunks/textureLinear.glsl.js +5 -5
  132. package/lib/renderer/glsl/chunks/uvProjection.glsl.js +11 -11
  133. package/lib/renderer/glsl/depthQuery.frag.js +12 -6
  134. package/lib/renderer/glsl/depthQuery.frag.js.map +1 -1
  135. package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js +10 -10
  136. package/lib/renderer/glsl/rayTrace.frag.js +233 -170
  137. package/lib/renderer/glsl/rayTrace.frag.js.map +1 -1
  138. package/lib/renderer/glsl/shadowCatcher.frag.js +10 -9
  139. package/lib/renderer/glsl/shadowCatcher.frag.js.map +1 -1
  140. package/lib/renderer/glsl/webglPipeline.frag.js +58 -58
  141. package/lib/renderer/gpuMemory.js +1 -1
  142. package/lib/renderer/gpuMemory.js.map +1 -1
  143. package/lib/renderer/openPbrEnergyLut.d.ts +2 -1
  144. package/lib/renderer/openPbrEnergyLut.js +18 -1
  145. package/lib/renderer/openPbrEnergyLut.js.map +1 -1
  146. package/lib/renderer/pathLimits.d.ts +5 -4
  147. package/lib/renderer/pathLimits.js +6 -5
  148. package/lib/renderer/pathLimits.js.map +1 -1
  149. package/lib/renderer/prepareMeshBVH.d.ts +2 -0
  150. package/lib/renderer/prepareMeshBVH.js +5 -3
  151. package/lib/renderer/prepareMeshBVH.js.map +1 -1
  152. package/lib/renderer/progressiveScheduler.js +1 -1
  153. package/lib/renderer/progressiveScheduler.js.map +1 -1
  154. package/lib/renderer/renderPipeline.d.ts +4 -0
  155. package/lib/renderer/renderPipeline.js +1 -0
  156. package/lib/renderer/renderPipeline.js.map +1 -1
  157. package/lib/renderer/researchTransport.d.ts +1 -1
  158. package/lib/renderer/researchTransport.js.map +1 -1
  159. package/lib/renderer/sceneAssembly.d.ts +1 -1
  160. package/lib/renderer/sceneAssembly.js +4 -3
  161. package/lib/renderer/sceneAssembly.js.map +1 -1
  162. package/lib/renderer/sceneChangeDetector.d.ts +1 -1
  163. package/lib/renderer/sceneChangeDetector.js +3 -1
  164. package/lib/renderer/sceneChangeDetector.js.map +1 -1
  165. package/lib/renderer/sceneLayoutSchema.d.ts +1 -0
  166. package/lib/renderer/sceneLayoutSchema.js +2 -2
  167. package/lib/renderer/sceneLayoutSchema.js.map +1 -1
  168. package/lib/renderer/scenePreparation.d.ts +3 -2
  169. package/lib/renderer/scenePreparation.js +18 -2
  170. package/lib/renderer/scenePreparation.js.map +1 -1
  171. package/lib/renderer/scratchSampling.js +6 -6
  172. package/lib/renderer/spectrum.js +2 -2
  173. package/lib/renderer/staticBvhPreparation.d.ts +9 -0
  174. package/lib/renderer/staticBvhPreparation.js +8 -2
  175. package/lib/renderer/staticBvhPreparation.js.map +1 -1
  176. package/lib/renderer/surfaceHit.d.ts +10 -0
  177. package/lib/renderer/surfaceHit.js +22 -0
  178. package/lib/renderer/surfaceHit.js.map +1 -0
  179. package/lib/renderer/tangentRequirements.d.ts +2 -0
  180. package/lib/renderer/tangentRequirements.js +7 -0
  181. package/lib/renderer/tangentRequirements.js.map +1 -0
  182. package/lib/renderer/textureAtlas.d.ts +4 -0
  183. package/lib/renderer/textureAtlas.js +48 -2
  184. package/lib/renderer/textureAtlas.js.map +1 -1
  185. package/lib/renderer/webgl.js +4 -0
  186. package/lib/renderer/webgl.js.map +1 -1
  187. package/lib/renderer/webglVertexAttributes.d.ts +17 -0
  188. package/lib/renderer/webglVertexAttributes.js +44 -0
  189. package/lib/renderer/webglVertexAttributes.js.map +1 -0
  190. package/lib/renderer/wgpuBindlessSource.js +2 -2
  191. package/lib/renderer/wgpuMaterialConstants.js +4 -3
  192. package/lib/renderer/wgpuMaterialConstants.js.map +1 -1
  193. package/lib/renderer/wgpuSceneUniform.js +2 -2
  194. package/lib/renderer/wgpuSceneUniform.js.map +1 -1
  195. package/lib/renderer/wgpuShaderSource.d.ts +15 -0
  196. package/lib/renderer/wgpuShaderSource.js +1 -1
  197. package/lib/renderer/wgpuShaderSource.js.map +1 -1
  198. package/lib/renderer/wgsl/aovCompact.wgsl.d.ts +4 -0
  199. package/lib/renderer/wgsl/aovCompact.wgsl.js +26 -0
  200. package/lib/renderer/wgsl/aovCompact.wgsl.js.map +1 -0
  201. package/lib/renderer/wgsl/aovDisplay.wgsl.js +9 -9
  202. package/lib/renderer/wgsl/aovReflectance.wgsl.js +39 -39
  203. package/lib/renderer/wgsl/aovReflectanceSamples.wgsl.js +1 -1
  204. package/lib/renderer/wgsl/aovResolve.wgsl.d.ts +4 -0
  205. package/lib/renderer/wgsl/aovResolve.wgsl.js +21 -2
  206. package/lib/renderer/wgsl/aovResolve.wgsl.js.map +1 -1
  207. package/lib/renderer/wgsl/aovSnapshot.wgsl.js +2 -2
  208. package/lib/renderer/wgsl/aovSnapshot.wgsl.js.map +1 -1
  209. package/lib/renderer/wgsl/aovTrace.wgsl.js +31 -31
  210. package/lib/renderer/wgsl/aovTraceDisplay.wgsl.d.ts +2 -0
  211. package/lib/renderer/wgsl/aovTraceDisplay.wgsl.js +56 -0
  212. package/lib/renderer/wgsl/aovTraceDisplay.wgsl.js.map +1 -0
  213. package/lib/renderer/wgsl/bloom.wgsl.js +18 -18
  214. package/lib/renderer/wgsl/causticLight.compute.d.ts +1 -1
  215. package/lib/renderer/wgsl/causticLight.compute.js +121 -119
  216. package/lib/renderer/wgsl/causticLight.compute.js.map +1 -1
  217. package/lib/renderer/wgsl/chunks/background.wgsl.js +46 -46
  218. package/lib/renderer/wgsl/chunks/causticAdjoint.wgsl.js +4 -4
  219. package/lib/renderer/wgsl/chunks/causticAtomic.wgsl.js +3 -3
  220. package/lib/renderer/wgsl/chunks/caustics.wgsl.js +3 -3
  221. package/lib/renderer/wgsl/chunks/common.wgsl.js +4 -4
  222. package/lib/renderer/wgsl/chunks/envMap.wgsl.js +30 -30
  223. package/lib/renderer/wgsl/chunks/intersect.wgsl.d.ts +6 -2
  224. package/lib/renderer/wgsl/chunks/intersect.wgsl.js +550 -542
  225. package/lib/renderer/wgsl/chunks/intersect.wgsl.js.map +1 -1
  226. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.d.ts +1 -1
  227. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js +18 -16
  228. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js.map +1 -1
  229. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.d.ts +2 -1
  230. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js +70 -69
  231. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js.map +1 -1
  232. package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js +593 -593
  233. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js +118 -118
  234. package/lib/renderer/wgsl/chunks/rand.wgsl.js +3 -3
  235. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.d.ts +4 -1
  236. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js +32 -26
  237. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js.map +1 -1
  238. package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js +114 -114
  239. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.d.ts +1 -1
  240. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js +159 -137
  241. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js.map +1 -1
  242. package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js +8 -8
  243. package/lib/renderer/wgsl/chunks/sampling.wgsl.js +74 -74
  244. package/lib/renderer/wgsl/chunks/sobol.wgsl.js +74 -74
  245. package/lib/renderer/wgsl/chunks/spectralPrefix.wgsl.d.ts +6 -0
  246. package/lib/renderer/wgsl/chunks/spectralPrefix.wgsl.js +66 -0
  247. package/lib/renderer/wgsl/chunks/spectralPrefix.wgsl.js.map +1 -0
  248. package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js +11 -11
  249. package/lib/renderer/wgsl/chunks/vertexAttributes.wgsl.d.ts +2 -0
  250. package/lib/renderer/wgsl/chunks/vertexAttributes.wgsl.js +61 -0
  251. package/lib/renderer/wgsl/chunks/vertexAttributes.wgsl.js.map +1 -0
  252. package/lib/renderer/wgsl/compose.frag.wgsl.d.ts +2 -0
  253. package/lib/renderer/wgsl/compose.frag.wgsl.js +99 -97
  254. package/lib/renderer/wgsl/compose.frag.wgsl.js.map +1 -1
  255. package/lib/renderer/wgsl/customDenoise.wgsl.js +10 -10
  256. package/lib/renderer/wgsl/depthQuery.wgsl.d.ts +1 -1
  257. package/lib/renderer/wgsl/depthQuery.wgsl.js +11 -2
  258. package/lib/renderer/wgsl/depthQuery.wgsl.js.map +1 -1
  259. package/lib/renderer/wgsl/easu.wgsl.d.ts +2 -0
  260. package/lib/renderer/wgsl/easu.wgsl.js +80 -0
  261. package/lib/renderer/wgsl/easu.wgsl.js.map +1 -0
  262. package/lib/renderer/wgsl/easuDetail.wgsl.d.ts +21 -0
  263. package/lib/renderer/wgsl/easuDetail.wgsl.js +230 -0
  264. package/lib/renderer/wgsl/easuDetail.wgsl.js.map +1 -0
  265. package/lib/renderer/wgsl/jnlm.compute.js +74 -74
  266. package/lib/renderer/wgsl/jnlm.compute.js.map +1 -1
  267. package/lib/renderer/wgsl/offlineAdaptive.compute.js +26 -26
  268. package/lib/renderer/wgsl/oidnAuxiliary.wgsl.js +3 -3
  269. package/lib/renderer/wgsl/photonMap.compute.js +89 -89
  270. package/lib/renderer/wgsl/proceduralSky.compute.js +61 -61
  271. package/lib/renderer/wgsl/rayTrace.compute.d.ts +14 -0
  272. package/lib/renderer/wgsl/rayTrace.compute.js +395 -333
  273. package/lib/renderer/wgsl/rayTrace.compute.js.map +1 -1
  274. package/lib/scene/Scene.js.map +1 -1
  275. package/lib/settings/render.d.ts +11 -0
  276. package/lib/settings/render.js +1 -0
  277. package/lib/settings/render.js.map +1 -1
  278. package/lib/util/fromTHREE.js +21 -14
  279. package/lib/util/fromTHREE.js.map +1 -1
  280. package/lib/version.d.ts +1 -1
  281. package/lib/version.js +1 -1
  282. package/lib/version.js.map +1 -1
  283. package/package.json +5 -2
  284. package/lib/oidnBundledWeights.cdn.d.ts +0 -2
  285. package/lib/oidnBundledWeights.cdn.js +0 -5
  286. package/lib/oidnBundledWeights.cdn.js.map +0 -1
  287. package/lib/renderer/bvh.worker.d.ts +0 -1
  288. package/lib/renderer/bvh.worker.js +0 -16
  289. package/lib/renderer/bvh.worker.js.map +0 -1
  290. package/lib/renderer/bvhWorkerBuild.d.ts +0 -13
  291. package/lib/renderer/bvhWorkerBuild.js +0 -17
  292. package/lib/renderer/bvhWorkerBuild.js.map +0 -1
  293. package/lib/renderer/lightCore.d.ts +0 -12
  294. package/lib/renderer/lightCore.js +0 -13
  295. package/lib/renderer/lightCore.js.map +0 -1
  296. package/lib/renderer/materialCore.d.ts +0 -8
  297. package/lib/renderer/materialCore.js +0 -9
  298. package/lib/renderer/materialCore.js.map +0 -1
  299. package/lib/scene/PixelTexture.d.ts +0 -6
  300. package/lib/scene/PixelTexture.js +0 -10
  301. package/lib/scene/PixelTexture.js.map +0 -1
  302. package/lib/util/studioLighting.d.ts +0 -18
  303. package/lib/util/studioLighting.js +0 -36
  304. package/lib/util/studioLighting.js.map +0 -1
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAYvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAY1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,SAAS,IAAI,iBAAiB,EAC/B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;A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AkC,CAAC","sourcesContent":["/// <reference types=\"@webgpu/types\" preserve=\"true\" />\n\n/**\n * MuTracer: a physically based WebGPU path tracer with a\n * WebGL 2 fallback.\n *\n * Build a {@link Scene} from {@link Mesh}es and lights (or convert a Three.js\n * scene with {@link fromTHREEScene}), then call {@link Engine.update} and {@link Render.refine} once\n * per animation frame.\n *\n * @packageDocumentation\n */\nexport { VERSION } from './version.js';\n\nexport type {\n AlphaBlendStrategy,\n ShaderCompilationDiagnostics,\n ToneMapping\n} from './renderer/RenderingPipeline.js';\nexport type {\n OfflineAdaptiveSamplingOptions,\n OfflineVarianceHistory\n} from './renderer/OfflineAdaptiveSampling.js';\nexport type { OIDNModel, OIDNEngine, OIDNPrecision, OIDNHDRTransfer, OIDNDynamicTileOptions, OIDNDynamicTileSetting, OIDNAuxiliaryModelUrls } from './oidn.js';\nexport { DEFAULT_JNLM_OPTIONS } from './renderer/jnlm.js';\nexport type { JNLMOptions } from './renderer/jnlm.js';\n\n// Scene description\nexport type {\n AnalyticLight,\n EquirectBackground,\n GroundedSkyboxBackground,\n Scene,\n SceneBackground,\n SceneLight\n} from './scene/Scene.js';\nexport { default as Camera } from './scene/Camera.js';\nexport { default as Mesh } from './scene/Mesh.js';\nexport { default as InstancedMesh } from './scene/InstancedMesh.js';\nexport type { InstancedMeshOptions } from './scene/InstancedMesh.js';\nexport { default as SceneNode } from './scene/SceneNode.js';\nexport {\n default as Geometry,\n Attribute as GeometryAttribute\n} from './scene/Geometry.js';\nexport type { GeometryInit } from './scene/Geometry.js';\nexport type { OpenPBRMaterialParams } from './scene/OpenPBRMaterial.js';\nexport { default as OpenPBRMaterial } from './scene/OpenPBRMaterial.js';\nexport type {\n MaterialAlphaMode,\n UVProjection\n} from './scene/OpenPBRMaterial.js';\nexport { default as ProceduralSky } from './scene/ProceduralSky.js';\nexport type { ProceduralSkyOptions } from './scene/ProceduralSky.js';\nexport { default as Texture } from './scene/Texture.js';\nexport type { TextureDataSource, TextureWrapMode, TextureColorSpace } from './scene/Texture.js';\nexport type { ColorRGB, ColorRGBA, Vec2, Vec3, Mat4 } from './types.js';\n\n// Lights\nexport { default as AmbientLight } from './scene/AmbientLight.js';\nexport { default as DirectionalLight } from './scene/DirectionalLight.js';\nexport { default as RectLight } from './scene/RectLight.js';\nexport { default as SphereLight } from './scene/SphereLight.js';\nexport { default as SpotLight } from './scene/SpotLight.js';\nexport { default as EnvironmentLight } from './scene/EnvironmentLight.js';\nexport {\n default as IESProfile,\n IESParseError,\n parseIESProfile\n} from './scene/IESProfile.js';\n\n// Loaders and integrations\nexport { loadRGBE, parseRGBE } from './util/loadRGBE.js';\nexport { fromTHREECamera, fromTHREEScene, THREESync } from './util/fromTHREE.js';\nexport type {\n FromTHREESceneOptions,\n THREESyncOptions, THREEControls,\n FromTHREECameraOptions\n} from './util/fromTHREE.js';\n\n// Geometry helpers\nexport {\n createCubeGeometry,\n createCurvePlaneGeometry,\n createPlaneGeometry,\n createSphereGeometry\n} from './util/commonGeometry.js';\nexport {\n generateVertexNormals,\n generateVertexTangents\n} from './util/geometry.js';\nexport { computeMeshesBoundingBox } from './util/mesh.js';\n\n// BVH\nexport type { TinyBvhLayout } from './tinybvh/TinyBvhBuilder.js';\n\nexport type { SamplingPattern } from './renderer/sampling.js';\n\n// Independent rendering mechanisms.\nexport { default as Engine } from './Engine.js';\nexport type { EngineParams, EngineInfo, EngineDiagnostics, PrepareOptions, BVHBuilder, DepthSampleArea, TextureAtlasLimits } from './Engine.js';\nexport { default as Display } from './Display.js';\nexport type { BlobOptions, DisplayChannel, AovIdComponent, DisplaySettings, PostProcess, PostProcessContext } from './Display.js';\nexport { default as Render } from './Render.js';\nexport type { RenderOptions, RenderSettings, CausticSettings, RefineOptions, ConvergeOptions, ConvergeResult, DenoiserOptions, Denoiser, DenoiseInput, CustomDenoiserOptions, DenoiseSchedule, JNLMDenoiserOptions, OIDNDenoiserOptions, RenderStatus, SampleEvent } from './Render.js';\n\nexport { default as Sync } from './Sync.js';\nexport { default as RenderLoop } from './RenderLoop.js';\nexport type { RenderLoopOptions, RenderLoopStatus } from './RenderLoop.js';\n\nexport {getRecommendedDeviceDescriptor} from './renderer/deviceRequirements.js';\n\nexport type {AovKind} from './renderer/aov.js';\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAYvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAY1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,SAAS,IAAI,iBAAiB,EAC/B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAIxD,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,2BAA2B;AAC3B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOjF,mBAAmB;AACnB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAO1D,oCAAoC;AACpC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAIhF,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC","sourcesContent":["/// <reference types=\"@webgpu/types\" preserve=\"true\" />\n\n/**\n * MuTracer: a physically based WebGPU path tracer with a\n * WebGL 2 fallback.\n *\n * Build a {@link Scene} from {@link Mesh}es and lights (or convert a Three.js\n * scene with {@link fromTHREEScene}), then call {@link Engine.update} and {@link Render.refine} once\n * per animation frame.\n *\n * @packageDocumentation\n */\nexport { VERSION } from './version.js';\n\nexport type {\n AlphaBlendStrategy,\n ShaderCompilationDiagnostics,\n ToneMapping\n} from './renderer/RenderingPipeline.js';\nexport type {\n OfflineAdaptiveSamplingOptions,\n OfflineVarianceHistory\n} from './renderer/OfflineAdaptiveSampling.js';\nexport type { OIDNModel, OIDNEngine, OIDNPrecision, OIDNHDRTransfer, OIDNDynamicTileOptions, OIDNDynamicTileSetting, OIDNAuxiliaryModelUrls } from './oidn.js';\nexport { DEFAULT_JNLM_OPTIONS } from './renderer/jnlm.js';\nexport type { JNLMOptions } from './renderer/jnlm.js';\n\n// Scene description\nexport type {\n AnalyticLight,\n EquirectBackground,\n GroundedSkyboxBackground,\n Scene,\n SceneBackground,\n SceneLight\n} from './scene/Scene.js';\nexport { default as Camera } from './scene/Camera.js';\nexport { default as Mesh } from './scene/Mesh.js';\nexport { default as InstancedMesh } from './scene/InstancedMesh.js';\nexport type { InstancedMeshOptions } from './scene/InstancedMesh.js';\nexport { default as SceneNode } from './scene/SceneNode.js';\nexport {\n default as Geometry,\n Attribute as GeometryAttribute\n} from './scene/Geometry.js';\nexport type { GeometryInit } from './scene/Geometry.js';\nexport type { OpenPBRMaterialParams } from './scene/OpenPBRMaterial.js';\nexport { default as OpenPBRMaterial } from './scene/OpenPBRMaterial.js';\nexport type {\n MaterialAlphaMode,\n UVProjection\n} from './scene/OpenPBRMaterial.js';\nexport { default as ProceduralSky } from './scene/ProceduralSky.js';\nexport type { ProceduralSkyOptions } from './scene/ProceduralSky.js';\nexport { default as Texture } from './scene/Texture.js';\nexport type { TextureDataSource, TextureWrapMode, TextureColorSpace } from './scene/Texture.js';\nexport type { ColorRGB, ColorRGBA, Vec2, Vec3, Mat4 } from './types.js';\n\n// Lights\nexport { default as AmbientLight } from './scene/AmbientLight.js';\nexport { default as DirectionalLight } from './scene/DirectionalLight.js';\nexport { default as RectLight } from './scene/RectLight.js';\nexport { default as SphereLight } from './scene/SphereLight.js';\nexport { default as SpotLight } from './scene/SpotLight.js';\nexport { default as EnvironmentLight } from './scene/EnvironmentLight.js';\nexport {\n default as IESProfile,\n IESParseError,\n parseIESProfile\n} from './scene/IESProfile.js';\n\n// Loaders and integrations\nexport { loadRGBE, parseRGBE } from './util/loadRGBE.js';\nexport { fromTHREECamera, fromTHREEScene, THREESync } from './util/fromTHREE.js';\nexport type {\n FromTHREESceneOptions,\n THREESyncOptions, THREEControls,\n FromTHREECameraOptions\n} from './util/fromTHREE.js';\n\n// Geometry helpers\nexport {\n createCubeGeometry,\n createCurvePlaneGeometry,\n createPlaneGeometry,\n createSphereGeometry\n} from './util/commonGeometry.js';\nexport {\n generateVertexNormals,\n generateVertexTangents\n} from './util/geometry.js';\nexport { computeMeshesBoundingBox } from './util/mesh.js';\n\n// BVH\nexport type { TinyBvhLayout } from './tinybvh/TinyBvhBuilder.js';\n\nexport type { SamplingPattern } from './renderer/sampling.js';\n\n// Independent rendering mechanisms.\nexport { default as Engine } from './Engine.js';\nexport type { EngineParams, EngineInfo, EngineDiagnostics, PrepareOptions, BVHBuilder, DepthSampleArea, TextureAtlasLimits } from './Engine.js';\nexport { default as Display } from './Display.js';\nexport type { BlobOptions, DisplayChannel, AovIdComponent, DisplaySettings, PostProcess, PostProcessContext, PostProcessOptions } from './Display.js';\nexport { default as Render } from './Render.js';\nexport type { RenderOptions, RenderSettings, CausticSettings, RefineOptions, ConvergeOptions, ConvergeResult, DenoiserOptions, Denoiser, DenoiseInput, CustomDenoiserOptions, DenoiseSchedule, JNLMDenoiserOptions, OIDNDenoiserOptions, RenderStatus, SampleEvent } from './Render.js';\n\nexport { default as Sync } from './Sync.js';\nexport { default as RenderLoop } from './RenderLoop.js';\nexport type { RenderLoopOptions, RenderLoopStatus } from './RenderLoop.js';\n\nexport {getRecommendedDeviceDescriptor} from './renderer/deviceRequirements.js';\n\nexport type {AovKind} from './renderer/aov.js';\n\nexport {createEasuPass} from './renderer/easu.js';\nexport type {EasuOptions, EasuPass} from './renderer/easu.js';\n"]}
package/lib/oidn.d.ts CHANGED
@@ -40,6 +40,6 @@ export declare const DEFAULT_OIDN_WEIGHTS_PACKAGE_BASE_URL = "https://cdn.jsdeli
40
40
  * Fallback for bundled standard/small weights when application assets fail.
41
41
  * Defaults to jsDelivr's `@meimu/mutracer@VERSION/oidn/weights/` directory.
42
42
  */
43
- export declare const DEFAULT_OIDN_WEIGHTS_BASE_URL = "https://cdn.jsdelivr.net/npm/@meimu/mutracer@0.3.0/oidn/weights/";
43
+ export declare const DEFAULT_OIDN_WEIGHTS_BASE_URL = "https://cdn.jsdelivr.net/npm/@meimu/mutracer@0.3.1/oidn/weights/";
44
44
  export declare function resolveOIDNModelUrl(model: OIDNModel, weightsBaseUrl?: string | URL): string;
45
45
  export declare function resolveOIDNAuxiliaryModelUrls(weightsBaseUrl?: string | URL): OIDNAuxiliaryModelUrls;
@@ -14,14 +14,7 @@ export class AovPrimitiveCache {
14
14
  cached.topology === geometry.topologyVersion && cached.triangleIds === triangleIds)
15
15
  return cached.ids;
16
16
  const bvh = new Uint32Array(buffer), ids = new Uint32Array(bvh.length / 4).fill(AOV_BACKGROUND_ID);
17
- const triangles = new Map();
18
- for (let t = 0; t < indices.length / 3; t++)
19
- triangles.set(`${indices[t * 3]},${indices[t * 3 + 1]},${indices[t * 3 + 2]}`, t);
20
- for (let record = 0; record < ids.length; record++) {
21
- const triangle = triangles.get(`${bvh[record * 4]},${bvh[record * 4 + 1]},${bvh[record * 4 + 2]}`);
22
- if (triangle !== undefined)
23
- ids[record] = triangle;
24
- }
17
+ matchSourceTriangles(bvh, indices, ids);
25
18
  // Builder metadata distinguishes displaced/duplicate index triples.
26
19
  if (triangleIds)
27
20
  for (let i = 0; i < triangleIds.length; i += 2)
@@ -45,4 +38,42 @@ export class AovPrimitiveCache {
45
38
  return this.combined;
46
39
  }
47
40
  }
41
+ /**
42
+ * Writes the source triangle whose index triple equals each record's first
43
+ * three words; the last duplicate wins. Triangles are bucketed by first index
44
+ * in typed arrays, so a lookup compares only the triangles sharing that vertex.
45
+ */
46
+ function matchSourceTriangles(bvh, indices, ids) {
47
+ const triangles = indices.length / 3;
48
+ let vertices = 0;
49
+ for (let i = 0; i < indices.length; i += 3)
50
+ if (indices[i] >= vertices)
51
+ vertices = indices[i] + 1;
52
+ const start = new Uint32Array(vertices + 1);
53
+ for (let t = 0; t < triangles; t++)
54
+ start[indices[t * 3] + 1]++;
55
+ for (let v = 0; v < vertices; v++)
56
+ start[v + 1] += start[v];
57
+ // Each bucket stores (second index, third index, triangle) contiguously, so
58
+ // a lookup touches one random cache line instead of three.
59
+ const entries = new Uint32Array(triangles * 3), next = start.slice(0, vertices);
60
+ for (let t = 0; t < triangles; t++) {
61
+ const e = next[indices[t * 3]]++ * 3;
62
+ entries[e] = indices[t * 3 + 1];
63
+ entries[e + 1] = indices[t * 3 + 2];
64
+ entries[e + 2] = t;
65
+ }
66
+ for (let record = 0; record < ids.length; record++) {
67
+ const a = bvh[record * 4];
68
+ if (a >= vertices)
69
+ continue;
70
+ const b = bvh[record * 4 + 1], c = bvh[record * 4 + 2];
71
+ for (let e = start[a + 1] * 3; (e -= 3) >= start[a] * 3;) {
72
+ if (entries[e] === b && entries[e + 1] === c) {
73
+ ids[record] = entries[e + 2];
74
+ break;
75
+ }
76
+ }
77
+ }
78
+ }
48
79
  //# sourceMappingURL=AovPrimitiveCache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AovPrimitiveCache.js","sourceRoot":"","sources":["../../src/renderer/AovPrimitiveCache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAE3C,gFAAgF;AAChF,MAAM,OAAO,iBAAiB;IACpB,MAAM,GAAG,IAAI,OAAO,EAGxB,CAAC;IACG,KAAK,GAAkB,EAAE,CAAC;IAC1B,WAAW,GAAG,CAAC,CAAC,CAAC;IACjB,QAAQ,CAAe;IAE/B,GAAG,CAAC,MAAqD,EAAE,IAAiB;QAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC9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AG,WAAW,CAAC;YACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;YAAC,CAAC;YAChF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/E,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF","sourcesContent":["import type {AovSceneSource} from './aovScene.js';\nimport type {FlattendBVH} from './bvhAccel.js';\nimport type Geometry from '../scene/Geometry.js';\nimport {AOV_BACKGROUND_ID} from './aov.js';\n\n/** Web AOV identity data is independent of camera, transforms and materials. */\nexport class AovPrimitiveCache {\n private blases = new WeakMap<ArrayBuffer, {\n geometry: Geometry; indices: Uint16Array | Uint32Array; topology: number;\n triangleIds?: Uint32Array; ids: Uint32Array;\n }>();\n private parts: Uint32Array[] = [];\n private tlasRecords = -1;\n private combined?: Uint32Array;\n\n get(source: Pick<AovSceneSource, 'blases' | 'geometries'>, tlas: FlattendBVH) {\n const parts = source.blases.map((blas, index) => {\n const geometry = source.geometries[index], indices = geometry.indexArray;\n const buffer = blas.bvh.buffer, triangleIds = blas.bvh.triangleIds;\n const cached = this.blases.get(buffer);\n if (cached && cached.geometry === geometry && cached.indices === indices &&\n cached.topology === geometry.topologyVersion && cached.triangleIds === triangleIds) return cached.ids;\n const bvh = new Uint32Array(buffer), ids = new Uint32Array(bvh.length / 4).fill(AOV_BACKGROUND_ID);\n const triangles = new Map<string, number>();\n for (let t = 0; t < indices.length / 3; t++) triangles.set(`${indices[t*3]},${indices[t*3+1]},${indices[t*3+2]}`, t);\n for (let record = 0; record < ids.length; record++) {\n const triangle = triangles.get(`${bvh[record*4]},${bvh[record*4+1]},${bvh[record*4+2]}`);\n if (triangle !== undefined) ids[record] = triangle;\n }\n // Builder metadata distinguishes displaced/duplicate index triples.\n if (triangleIds) for (let i = 0; i < triangleIds.length; i += 2) ids[triangleIds[i]] = triangleIds[i+1];\n this.blases.set(buffer, {geometry, indices, topology: geometry.topologyVersion, triangleIds, ids});\n return ids;\n });\n const tlasRecords = tlas.buffer.byteLength / 16;\n if (!this.combined || this.tlasRecords !== tlasRecords || parts.length !== this.parts.length ||\n parts.some((part, i) => part !== this.parts[i])) {\n const combined = new Uint32Array(tlasRecords + parts.reduce((count, part) => count + part.length, 0)).fill(AOV_BACKGROUND_ID);\n let offset = tlasRecords;\n for (const part of parts) { combined.set(part, offset); offset += part.length; }\n this.combined = combined; this.parts = parts; this.tlasRecords = tlasRecords;\n }\n return this.combined;\n }\n}\n"]}
1
+ {"version":3,"file":"AovPrimitiveCache.js","sourceRoot":"","sources":["../../src/renderer/AovPrimitiveCache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAE3C,gFAAgF;AAChF,MAAM,OAAO,iBAAiB;IACpB,MAAM,GAAG,IAAI,OAAO,EAGxB,CAAC;IACG,KAAK,GAAkB,EAAE,CAAC;IAC1B,WAAW,GAAG,CAAC,CAAC,CAAC;IACjB,QAAQ,CAAe;IAE/B,GAAG,CAAC,MAAqD,EAAE,IAAiB;QAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC;YACzE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;YACnE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACv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AC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;YACzD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBAAC,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAC,MAAM;YAAC,CAAC;QACxF,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type {AovSceneSource} from './aovScene.js';\nimport type {FlattendBVH} from './bvhAccel.js';\nimport type Geometry from '../scene/Geometry.js';\nimport {AOV_BACKGROUND_ID} from './aov.js';\n\n/** Web AOV identity data is independent of camera, transforms and materials. */\nexport class AovPrimitiveCache {\n private blases = new WeakMap<ArrayBuffer, {\n geometry: Geometry; indices: Uint16Array | Uint32Array; topology: number;\n triangleIds?: Uint32Array; ids: Uint32Array;\n }>();\n private parts: Uint32Array[] = [];\n private tlasRecords = -1;\n private combined?: Uint32Array;\n\n get(source: Pick<AovSceneSource, 'blases' | 'geometries'>, tlas: FlattendBVH) {\n const parts = source.blases.map((blas, index) => {\n const geometry = source.geometries[index], indices = geometry.indexArray;\n const buffer = blas.bvh.buffer, triangleIds = blas.bvh.triangleIds;\n const cached = this.blases.get(buffer);\n if (cached && cached.geometry === geometry && cached.indices === indices &&\n cached.topology === geometry.topologyVersion && cached.triangleIds === triangleIds) return cached.ids;\n const bvh = new Uint32Array(buffer), ids = new Uint32Array(bvh.length / 4).fill(AOV_BACKGROUND_ID);\n matchSourceTriangles(bvh, indices, ids);\n // Builder metadata distinguishes displaced/duplicate index triples.\n if (triangleIds) for (let i = 0; i < triangleIds.length; i += 2) ids[triangleIds[i]] = triangleIds[i+1];\n this.blases.set(buffer, {geometry, indices, topology: geometry.topologyVersion, triangleIds, ids});\n return ids;\n });\n const tlasRecords = tlas.buffer.byteLength / 16;\n if (!this.combined || this.tlasRecords !== tlasRecords || parts.length !== this.parts.length ||\n parts.some((part, i) => part !== this.parts[i])) {\n const combined = new Uint32Array(tlasRecords + parts.reduce((count, part) => count + part.length, 0)).fill(AOV_BACKGROUND_ID);\n let offset = tlasRecords;\n for (const part of parts) { combined.set(part, offset); offset += part.length; }\n this.combined = combined; this.parts = parts; this.tlasRecords = tlasRecords;\n }\n return this.combined;\n }\n}\n\n/**\n * Writes the source triangle whose index triple equals each record's first\n * three words; the last duplicate wins. Triangles are bucketed by first index\n * in typed arrays, so a lookup compares only the triangles sharing that vertex.\n */\nfunction matchSourceTriangles(bvh: Uint32Array, indices: Uint16Array | Uint32Array, ids: Uint32Array) {\n const triangles = indices.length / 3;\n let vertices = 0;\n for (let i = 0; i < indices.length; i += 3) if (indices[i] >= vertices) vertices = indices[i] + 1;\n const start = new Uint32Array(vertices + 1);\n for (let t = 0; t < triangles; t++) start[indices[t*3] + 1]++;\n for (let v = 0; v < vertices; v++) start[v + 1] += start[v];\n // Each bucket stores (second index, third index, triangle) contiguously, so\n // a lookup touches one random cache line instead of three.\n const entries = new Uint32Array(triangles * 3), next = start.slice(0, vertices);\n for (let t = 0; t < triangles; t++) {\n const e = next[indices[t*3]]++ * 3;\n entries[e] = indices[t*3 + 1]; entries[e + 1] = indices[t*3 + 2]; entries[e + 2] = t;\n }\n for (let record = 0; record < ids.length; record++) {\n const a = bvh[record*4];\n if (a >= vertices) continue;\n const b = bvh[record*4 + 1], c = bvh[record*4 + 2];\n for (let e = start[a + 1] * 3; (e -= 3) >= start[a] * 3;) {\n if (entries[e] === b && entries[e + 1] === c) { ids[record] = entries[e + 2]; break; }\n }\n }\n}\n"]}
@@ -1,5 +1,9 @@
1
- import type { PostProcess, PostProcessContext } from '../Display.js';
2
- /** Target-owned ping-pong images. A failed chain never replaces the composed image. */
1
+ import type { PostProcess, PostProcessContext, PostProcessOptions } from '../Display.js';
2
+ type Size = {
3
+ width: number;
4
+ height: number;
5
+ };
6
+ /** Target-owned images. A failed chain never replaces the composed image. */
3
7
  export declare class DisplayPostProcess {
4
8
  private readonly device;
5
9
  private textures;
@@ -10,5 +14,6 @@ export declare class DisplayPostProcess {
10
14
  getMemoryBytes(): number;
11
15
  private retire;
12
16
  dispose(): void;
13
- run(input: GPUTexture, passes: readonly PostProcess[], render: PostProcessContext['render']): void;
17
+ run(input: GPUTexture, passes: readonly PostProcess[], render: PostProcessContext['render'], display?: Size, options?: readonly PostProcessOptions[], crop?: Size): void;
14
18
  }
19
+ export {};
@@ -1,41 +1,74 @@
1
1
  import { textureBytes } from './gpuMemory.js';
2
- /** Target-owned ping-pong images. A failed chain never replaces the composed image. */
2
+ /** Target-owned images. A failed chain never replaces the composed image. */
3
3
  export class DisplayPostProcess {
4
4
  device;
5
- textures = [];
5
+ textures = new Map();
6
6
  image;
7
7
  constructor(device) {
8
8
  this.device = device;
9
9
  }
10
10
  get output() { return this.image; }
11
11
  reset() { this.image = undefined; }
12
- getMemoryBytes() { return this.textures.reduce((sum, texture) => sum + textureBytes(texture), 0); }
12
+ getMemoryBytes() { return [...this.textures.values()].flat().reduce((sum, texture) => sum + textureBytes(texture), 0); }
13
13
  retire(textures) {
14
14
  if (!textures.length)
15
15
  return;
16
16
  void this.device.queue.onSubmittedWorkDone().catch(() => { }).then(() => textures.forEach(texture => texture.destroy()));
17
17
  }
18
- dispose() { this.reset(); this.retire(this.textures); this.textures = []; }
19
- run(input, passes, render) {
18
+ dispose() { this.reset(); this.retire([...this.textures.values()].flat()); this.textures.clear(); }
19
+ run(input, passes, render, display = input, options = [], crop) {
20
20
  this.reset();
21
- if (!passes.length)
21
+ const cropped = crop && (crop.width !== input.width || crop.height !== input.height);
22
+ if (!passes.length && !cropped)
22
23
  return;
23
- if (this.textures.length === 0 || this.textures[0].width !== input.width || this.textures[0].height !== input.height || this.textures[0].format !== input.format) {
24
- this.retire(this.textures);
25
- this.textures = Array.from({ length: 2 }, (_, index) => this.device.createTexture({
26
- label: `Display post-process ${index}`, size: { width: input.width, height: input.height }, format: input.format,
24
+ const validate = (size) => {
25
+ const limit = this.device.limits.maxTextureDimension2D;
26
+ if (!size || !Number.isInteger(size.width) || !Number.isInteger(size.height) || size.width < 1 || size.height < 1 || size.width > limit || size.height > limit) {
27
+ throw new RangeError('Post-process output dimensions must be positive integers within maxTextureDimension2D.');
28
+ }
29
+ return { width: size.width, height: size.height };
30
+ };
31
+ // Evaluate the entire size chain before recording user commands.
32
+ let size = cropped ? validate(crop) : { width: input.width, height: input.height };
33
+ const sizes = passes.map((_, index) => size = validate(options[index]?.outputSize ? options[index].outputSize({ ...size }, { width: display.width, height: display.height }) : size));
34
+ const active = new Set();
35
+ const acquire = (size, previous) => {
36
+ const key = `${size.width}:${size.height}:${input.format}`;
37
+ active.add(key);
38
+ // Allocate the second image of a size only when consecutive passes need to ping-pong.
39
+ const pair = this.textures.get(key) ?? [];
40
+ this.textures.set(key, pair);
41
+ const index = pair[0] === previous ? 1 : 0;
42
+ pair[index] ??= this.device.createTexture({
43
+ label: `Display post-process ${index}`, size, format: input.format,
27
44
  usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST
28
- }));
29
- }
45
+ });
46
+ return pair[index];
47
+ };
48
+ const actual = render._output?.getMemory() ?? input;
30
49
  const encoder = this.device.createCommandEncoder();
31
50
  let previous = input;
32
- for (let index = 0; index < passes.length; index++) {
33
- const output = this.textures[index % 2];
34
- passes[index]({ device: this.device, encoder, input: previous, output, width: input.width, height: input.height, render });
35
- previous = output;
51
+ try {
52
+ if (cropped) {
53
+ const output = acquire(crop, previous);
54
+ encoder.copyTextureToTexture({ texture: input, origin: { x: Math.floor((input.width - crop.width) / 2), y: Math.floor((input.height - crop.height) / 2) } }, { texture: output }, crop);
55
+ previous = output;
56
+ }
57
+ for (let index = 0; index < passes.length; index++) {
58
+ const output = acquire(sizes[index], previous);
59
+ passes[index]({ device: this.device, encoder, input: previous, output, width: actual.width, height: actual.height, render });
60
+ previous = output;
61
+ }
62
+ this.device.queue.submit([encoder.finish()]);
63
+ this.image = previous;
64
+ }
65
+ finally {
66
+ for (const [key, pair] of this.textures)
67
+ if (!active.has(key)) {
68
+ this.textures.delete(key);
69
+ this.retire(pair);
70
+ }
36
71
  }
37
- this.device.queue.submit([encoder.finish()]);
38
- this.image = previous;
39
72
  }
40
73
  }
41
74
  //# sourceMappingURL=DisplayPostProcess.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayPostProcess.js","sourceRoot":"","sources":["../../src/renderer/DisplayPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,uFAAuF;AACvF,MAAM,OAAO,kBAAkB;IAGA;IAFrB,QAAQ,GAAiB,EAAE,CAAC;IAC5B,KAAK,CAAc;IAC3B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAClD,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IACnC,cAAc,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,MAAM,CAAC,QAAsB;QACnC,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO;QAC7B,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC1H,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,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAC,CAAC,CAAC;YACzH,QAAQ,GAAG,MAAM,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF","sourcesContent":["import type { PostProcess, PostProcessContext } from '../Display.js';\nimport {textureBytes} from './gpuMemory.js';\n\n/** Target-owned ping-pong images. A failed chain never replaces the composed image. */\nexport class DisplayPostProcess {\n private textures: GPUTexture[] = [];\n private image?: GPUTexture;\n constructor(private readonly device: GPUDevice) {}\n get output() { return this.image; }\n reset() { this.image = undefined; }\n getMemoryBytes() { return this.textures.reduce((sum, texture) => sum + textureBytes(texture), 0); }\n private retire(textures: GPUTexture[]) {\n if (!textures.length) return;\n void this.device.queue.onSubmittedWorkDone().catch(() => {}).then(() => textures.forEach(texture => texture.destroy()));\n }\n dispose() { this.reset(); this.retire(this.textures); this.textures = []; }\n run(input: GPUTexture, passes: readonly PostProcess[], render: PostProcessContext['render']) {\n this.reset();\n if (!passes.length) return;\n if (this.textures.length === 0 || this.textures[0].width !== input.width || this.textures[0].height !== input.height || this.textures[0].format !== input.format) {\n this.retire(this.textures);\n this.textures = Array.from({length: 2}, (_, index) => this.device.createTexture({\n label: `Display post-process ${index}`, size: {width: input.width, height: input.height}, format: input.format,\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST\n }));\n }\n const encoder = this.device.createCommandEncoder();\n let previous = input;\n for (let index = 0; index < passes.length; index++) {\n const output = this.textures[index % 2];\n passes[index]({device: this.device, encoder, input: previous, output, width: input.width, height: input.height, render});\n previous = output;\n }\n this.device.queue.submit([encoder.finish()]);\n this.image = previous;\n }\n}\n"]}
1
+ {"version":3,"file":"DisplayPostProcess.js","sourceRoot":"","sources":["../../src/renderer/DisplayPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,6EAA6E;AAC7E,MAAM,OAAO,kBAAkB;IAGA;IAFrB,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC3C,KAAK,CAAc;IAC3B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAClD,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IACnC,cAAc,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChH,MAAM,CAAC,QAAsB;QACnC,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO;QAC7B,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EA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AAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC/C,MAAM,CAAC,KAAK,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAC,CAAC,CAAC;gBAC3H,QAAQ,GAAG,MAAM,CAAC;YACpB,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAC7C,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;QACxB,CAAC;gBAAS,CAAC;YACT,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAC,CAAC;QAClH,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { PostProcess, PostProcessContext, PostProcessOptions } from '../Display.js';\nimport {textureBytes} from './gpuMemory.js';\n\ntype Size = {width: number; height: number};\n/** Target-owned images. A failed chain never replaces the composed image. */\nexport class DisplayPostProcess {\n private textures = new Map<string, GPUTexture[]>();\n private image?: GPUTexture;\n constructor(private readonly device: GPUDevice) {}\n get output() { return this.image; }\n reset() { this.image = undefined; }\n getMemoryBytes() { return [...this.textures.values()].flat().reduce((sum, texture) => sum + textureBytes(texture), 0); }\n private retire(textures: GPUTexture[]) {\n if (!textures.length) return;\n void this.device.queue.onSubmittedWorkDone().catch(() => {}).then(() => textures.forEach(texture => texture.destroy()));\n }\n dispose() { this.reset(); this.retire([...this.textures.values()].flat()); this.textures.clear(); }\n run(input: GPUTexture, passes: readonly PostProcess[], render: PostProcessContext['render'], display: Size = input,\n options: readonly PostProcessOptions[] = [], crop?: Size) {\n this.reset();\n const cropped = crop && (crop.width !== input.width || crop.height !== input.height);\n if (!passes.length && !cropped) return;\n const validate = (size: Size) => {\n const limit = this.device.limits.maxTextureDimension2D;\n if (!size || !Number.isInteger(size.width) || !Number.isInteger(size.height) || size.width < 1 || size.height < 1 || size.width > limit || size.height > limit) {\n throw new RangeError('Post-process output dimensions must be positive integers within maxTextureDimension2D.');\n }\n return {width: size.width, height: size.height};\n };\n // Evaluate the entire size chain before recording user commands.\n let size: Size = cropped ? validate(crop) : {width: input.width, height: input.height};\n const sizes = passes.map((_, index) => size = validate(options[index]?.outputSize ? options[index].outputSize!({...size}, {width: display.width, height: display.height}) : size));\n const active = new Set<string>();\n const acquire = (size: Size, previous: GPUTexture) => {\n const key = `${size.width}:${size.height}:${input.format}`;\n active.add(key);\n // Allocate the second image of a size only when consecutive passes need to ping-pong.\n const pair = this.textures.get(key) ?? [];\n this.textures.set(key, pair);\n const index = pair[0] === previous ? 1 : 0;\n pair[index] ??= this.device.createTexture({\n label: `Display post-process ${index}`, size, format: input.format,\n usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST\n });\n return pair[index];\n };\n const actual = render._output?.getMemory() ?? input;\n const encoder = this.device.createCommandEncoder();\n let previous = input;\n try {\n if (cropped) {\n const output = acquire(crop, previous);\n encoder.copyTextureToTexture({texture: input, origin: {x: Math.floor((input.width-crop.width)/2), y: Math.floor((input.height-crop.height)/2)}}, {texture: output}, crop);\n previous = output;\n }\n for (let index = 0; index < passes.length; index++) {\n const output = acquire(sizes[index], previous);\n passes[index]({device: this.device, encoder, input: previous, output, width: actual.width, height: actual.height, render});\n previous = output;\n }\n this.device.queue.submit([encoder.finish()]);\n this.image = previous;\n } finally {\n for (const [key, pair] of this.textures) if (!active.has(key)) { this.textures.delete(key); this.retire(pair); }\n }\n }\n}\n"]}
@@ -18,8 +18,13 @@ export default class MaterialData {
18
18
  this.textures = maps.textures.slice();
19
19
  for (const texture of lightTextures) {
20
20
  if (texture) {
21
- this.lightTexturesIndices.push(this.textures.length);
22
- this.textures.push(texture);
21
+ const existing = options.independentTextures ? this.textures.indexOf(texture) : -1;
22
+ if (existing >= 0)
23
+ this.lightTexturesIndices.push(existing);
24
+ else {
25
+ this.lightTexturesIndices.push(this.textures.length);
26
+ this.textures.push(texture);
27
+ }
23
28
  }
24
29
  else
25
30
  this.lightTexturesIndices.push(-1);
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialData.js","sourceRoot":"","sources":["../../src/renderer/MaterialData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAoD,MAAM,mBAAmB,CAAC;AAGvG,oFAAoF;AACpF,mFAAmF;AACnF,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,UAAU,CAAa;IACvB,QAAQ,CAAiB;IACzB,gBAAgB,CAAiB;IACjC,oBAAoB,GAAa,EAAE,CAAC;IACpC,OAAO,GAA2B,EAAE,CAAC;IACrC,KAAK,CAAmB;IACxB,YAAY,SAA0B,EAAE,aAA2C,EACjF,WAA8C,EAAE,UAAgC,EAAE,EAClF,YAAiD;QACjD,MAAM,IAAI,GAAG,0BAA0B,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;QAC3E,IAAI,CAAC,gBAAgB,GAAG,I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CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACrG,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QACnH,IAAI,CAAC,OAAO,GAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,CAAC;QAChD,KAAK,MAAM,IAAI,IAAI,sBAAsB,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9G,CAAC;IACH,CAAC;IACD,YAAY,CAAC,SAA0B,IAAI,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9F,cAAc,KAAK,OAAO,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;CACjE","sourcesContent":["import type MaterialState from '../scene/MaterialState.js';\nimport type TextureState from '../scene/TextureState.js';\nimport { MATERIAL_TEXTURE_NAMES, MATERIAL_TEXTURE_SLOTS } from './materialTextureSlots.js';\nimport { mergeTexturesFromMaterials } from './materialTextures.js';\nimport { createMaterialBufferData, repackMaterialParams } from './materialParams.js';\nimport { packMaterialBuffer } from './materialLayout.js';\nimport { planTextureAtlas, type MaterialTableOptions, type TextureAtlasPlan } from './textureAtlas.js';\nimport type { BufferData } from './materialBufferData.js';\n\n// CPU material preparation shared by browser uploads and native command generation.\n// The adapter describes source encoding; the core never decodes DOM/GPU resources.\nexport default class MaterialData {\n bufferData: BufferData;\n textures: TextureState[];\n displacementMaps: TextureState[];\n lightTexturesIndices: number[] = [];\n defines: Record<string, number> = {};\n atlas: TextureAtlasPlan;\n constructor(materials: MaterialState[], lightTextures: (TextureState | undefined)[],\n colorLinear: (texture: TextureState) => number, options: MaterialTableOptions = {},\n floatStorage?: (texture: TextureState) => boolean) {\n const maps = mergeTexturesFromMaterials(materials, MATERIAL_TEXTURE_NAMES);\n this.displacementMaps = maps.indices.displacementMap.map(index => maps.textures[index]).filter(texture => !!texture);\n this.textures = maps.textures.slice();\n for (const texture of lightTextures) {\n if (texture) { this.lightTexturesIndices.push(this.textures.length); this.textures.push(texture); }\n else this.lightTexturesIndices.push(-1);\n }\n this.bufferData = createMaterialBufferData(materials);\n this.bufferData.diffuseMapIndex = maps.indices.map;\n this.bufferData.alphaMapIndex = maps.indices.alphaMap;\n this.bufferData.normalMapIndex = maps.indices.normalMap;\n this.bufferData.emissiveMapIndex = maps.indices.emissiveMap;\n this.bufferData.metallicRoughnessMapIndex = maps.indices.metallicRoughnessMap;\n this.bufferData.roughnessMapIndex = maps.indices.roughnessMap;\n this.bufferData.metalnessMapIndex = maps.indices.metalnessMap;\n this.bufferData.transmissionMapIndex = maps.indices.transmissionMap;\n this.bufferData.thinFilmMapIndex = maps.indices.thinFilmMap;\n this.bufferData.displacementMapIndex = maps.indices.displacementMap;\n this.bufferData.coatWeightMapIndex = maps.indices.coatWeightMap;\n this.bufferData.coatRoughnessMapIndex = maps.indices.coatRoughnessMap;\n this.bufferData.fuzzColorMapIndex = maps.indices.fuzzColorMap;\n this.bufferData.fuzzRoughnessMapIndex = maps.indices.fuzzRoughnessMap;\n this.bufferData.specularWeightMapIndex = maps.indices.specularWeightMap;\n this.bufferData.specularColorMapIndex = maps.indices.specularColorMap;\n this.bufferData.anisotropyMapIndex = maps.indices.anisotropyMap;\n this.bufferData.coatNormalMapIndex = maps.indices.coatNormalMap;\n this.atlas = planTextureAtlas(this.textures, this.textures.map(colorLinear), options,\n floatStorage ? this.textures.some(floatStorage) : undefined);\n this.bufferData.mapInfo = this.atlas.mapInfo; this.bufferData.mapTransform = this.atlas.mapTransform;\n this.bufferData.mapWrap = this.atlas.mapWrap;\n this.bufferData.mapUvChannel = this.atlas.mapUvChannel; this.bufferData.mapColorLinear = this.atlas.mapColorLinear;\n this.defines = {NUM_MAPS: this.textures.length};\n for (const slot of MATERIAL_TEXTURE_SLOTS) {\n if (slot.define) this.defines[slot.define] = maps.indices[slot.property].filter(index => index >= 0).length;\n }\n }\n repackParams(materials: MaterialState[]) { repackMaterialParams(this.bufferData, materials); }\n getBufferArray() { return packMaterialBuffer(this.bufferData); }\n}\n"]}
1
+ {"version":3,"file":"MaterialData.js","sourceRoot":"","sources":["../../src/renderer/MaterialData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAoD,MAAM,mBAAmB,CAAC;AAGvG,oFAAoF;AACpF,mFAAmF;AACnF,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,UAAU,CAAa;IACvB,QAAQ,CAAiB;IACzB,gBAAgB,CAAiB;IACjC,oBAAoB,GAAa,EAAE,CAAC;IACpC,OAAO,GAA2B,EAAE,CAAC;IACrC,KAAK,CAAmB;IACxB,YAAY,SAA0B,EAAE,aAA2C,EACjF,WAA8C,EAAE,UAAgC,EAAE,EAClF,YAAiD;QACjD,MAAM,IAAI,GAAG,0BAA0B,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;QAC3E,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,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,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,OAAO,EAClF,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACrG,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QACnH,IAAI,CAAC,OAAO,GAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,CAAC;QAChD,KAAK,MAAM,IAAI,IAAI,sBAAsB,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9G,CAAC;IACH,CAAC;IACD,YAAY,CAAC,SAA0B,IAAI,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9F,cAAc,KAAK,OAAO,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;CACjE","sourcesContent":["import type MaterialState from '../scene/MaterialState.js';\nimport type TextureState from '../scene/TextureState.js';\nimport { MATERIAL_TEXTURE_NAMES, MATERIAL_TEXTURE_SLOTS } from './materialTextureSlots.js';\nimport { mergeTexturesFromMaterials } from './materialTextures.js';\nimport { createMaterialBufferData, repackMaterialParams } from './materialParams.js';\nimport { packMaterialBuffer } from './materialLayout.js';\nimport { planTextureAtlas, type MaterialTableOptions, type TextureAtlasPlan } from './textureAtlas.js';\nimport type { BufferData } from './materialBufferData.js';\n\n// CPU material preparation shared by browser uploads and native command generation.\n// The adapter describes source encoding; the core never decodes DOM/GPU resources.\nexport default class MaterialData {\n bufferData: BufferData;\n textures: TextureState[];\n displacementMaps: TextureState[];\n lightTexturesIndices: number[] = [];\n defines: Record<string, number> = {};\n atlas: TextureAtlasPlan;\n constructor(materials: MaterialState[], lightTextures: (TextureState | undefined)[],\n colorLinear: (texture: TextureState) => number, options: MaterialTableOptions = {},\n floatStorage?: (texture: TextureState) => boolean) {\n const maps = mergeTexturesFromMaterials(materials, MATERIAL_TEXTURE_NAMES);\n this.displacementMaps = maps.indices.displacementMap.map(index => maps.textures[index]).filter(texture => !!texture);\n this.textures = maps.textures.slice();\n for (const texture of lightTextures) {\n if (texture) {\n const existing = options.independentTextures ? this.textures.indexOf(texture) : -1;\n if (existing >= 0) this.lightTexturesIndices.push(existing);\n else { this.lightTexturesIndices.push(this.textures.length); this.textures.push(texture); }\n }\n else this.lightTexturesIndices.push(-1);\n }\n this.bufferData = createMaterialBufferData(materials);\n this.bufferData.diffuseMapIndex = maps.indices.map;\n this.bufferData.alphaMapIndex = maps.indices.alphaMap;\n this.bufferData.normalMapIndex = maps.indices.normalMap;\n this.bufferData.emissiveMapIndex = maps.indices.emissiveMap;\n this.bufferData.metallicRoughnessMapIndex = maps.indices.metallicRoughnessMap;\n this.bufferData.roughnessMapIndex = maps.indices.roughnessMap;\n this.bufferData.metalnessMapIndex = maps.indices.metalnessMap;\n this.bufferData.transmissionMapIndex = maps.indices.transmissionMap;\n this.bufferData.thinFilmMapIndex = maps.indices.thinFilmMap;\n this.bufferData.displacementMapIndex = maps.indices.displacementMap;\n this.bufferData.coatWeightMapIndex = maps.indices.coatWeightMap;\n this.bufferData.coatRoughnessMapIndex = maps.indices.coatRoughnessMap;\n this.bufferData.fuzzColorMapIndex = maps.indices.fuzzColorMap;\n this.bufferData.fuzzRoughnessMapIndex = maps.indices.fuzzRoughnessMap;\n this.bufferData.specularWeightMapIndex = maps.indices.specularWeightMap;\n this.bufferData.specularColorMapIndex = maps.indices.specularColorMap;\n this.bufferData.anisotropyMapIndex = maps.indices.anisotropyMap;\n this.bufferData.coatNormalMapIndex = maps.indices.coatNormalMap;\n this.atlas = planTextureAtlas(this.textures, this.textures.map(colorLinear), options,\n floatStorage ? this.textures.some(floatStorage) : undefined);\n this.bufferData.mapInfo = this.atlas.mapInfo; this.bufferData.mapTransform = this.atlas.mapTransform;\n this.bufferData.mapWrap = this.atlas.mapWrap;\n this.bufferData.mapUvChannel = this.atlas.mapUvChannel; this.bufferData.mapColorLinear = this.atlas.mapColorLinear;\n this.defines = {NUM_MAPS: this.textures.length};\n for (const slot of MATERIAL_TEXTURE_SLOTS) {\n if (slot.define) this.defines[slot.define] = maps.indices[slot.property].filter(index => index >= 0).length;\n }\n }\n repackParams(materials: MaterialState[]) { repackMaterialParams(this.bufferData, materials); }\n getBufferArray() { return packMaterialBuffer(this.bufferData); }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { SurfaceHit } from './surfaceHit.js';
1
2
  import type { PostProcess } from '../Display.js';
2
3
  import type Render from '../Render.js';
3
4
  import type { DenoiserHandle, OIDNWeb } from './denoiser.js';
@@ -184,6 +185,7 @@ export interface SceneResources {
184
185
  getDiagnostics(): RenderingDiagnostics;
185
186
  dispose(): void;
186
187
  readDepthSamples(area: DepthSampleArea): Promise<Float32Array | undefined>;
188
+ pickSurface?(x: number, y: number, aspect?: number): Promise<SurfaceHit | null | undefined>;
187
189
  }
188
190
  /** Explicit execution and composition for one accumulation. */
189
191
  export interface RenderPasses {
@@ -193,7 +195,11 @@ export interface RenderPasses {
193
195
  trace(camera: Camera, maxSamples: number): boolean;
194
196
  drawPostProcess(): void;
195
197
  /** Apply display-only passes to the last composed image; absent on WebGL. */
196
- applyPostProcesses?(passes: readonly PostProcess[], render: Render): void;
198
+ applyPostProcesses?(passes: readonly PostProcess[], render: Render, options?: readonly import('../Display.js').PostProcessOptions[], crop?: {
199
+ width: number;
200
+ height: number;
201
+ }): void;
202
+ getAovTexture?(kind: 'diffuseColor' | 'specularColor' | 'depth'): GPUTexture | undefined;
197
203
  getOutputTexture?(kind: 'hdr' | 'display'): GPUTexture | undefined;
198
204
  /** Configure deterministic headless batches used by offline frame export. */
199
205
  setOfflineRenderOptions(options: {
@@ -1 +1 @@
1
- {"version":3,"file":"RenderingPipeline.js","sourceRoot":"","sources":["../../src/renderer/RenderingPipeline.ts"],"names":[],"mappings":"AAyLA,OAAO,EAAC,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,qBAAqB,EAAC,MAAM,sBAAsB,CAAC","sourcesContent":["import type {PostProcess} from '../Display.js';\nimport type Render from '../Render.js';\nimport type {DenoiserHandle, OIDNWeb} from './denoiser.js';\nimport type {DenoiseSchedule} from '../Render.js';\nimport type { DepthSampleArea } from './depthQuery.js';\nimport Camera from '../scene/Camera.js';\nimport Mesh from '../scene/Mesh.js';\nimport Geometry from '../scene/Geometry.js';\nimport OpenPBRMaterial from '../scene/OpenPBRMaterial.js';\nimport type { SceneBackground, SceneLight } from '../scene/Scene.js';\nimport type { ColorRGB } from '../types.js';\nimport type { TextureAtlasStats } from './MaterialTable.js';\nimport type {\n OfflineAdaptiveSamplingOptions,\n OfflineAdaptiveSamplingResult\n} from './OfflineAdaptiveSampling.js';\n\nexport type ToneMapping =\n | 'agx'\n | 'aces'\n | 'cineon'\n | 'reinhard'\n | 'linear';\n\nexport interface ToneMappingParams {\n /** Linear exposure multiplier. Default `1`. */\n exposure?: number;\n /** Display tone mapper. Default `agx`. */\n toneMapping?: ToneMapping;\n /** Contrast multiplier. Default `1`. */\n contrast?: number;\n /** Saturation multiplier. Default `1`. */\n saturation?: number;\n /** Color temperature adjustment in [-1, 1]. Default `0`. */\n temperature?: number;\n /** Green/magenta adjustment in [-1, 1]. Default `0`. */\n tint?: number;\n /** Vignette strength in [0, 1]. Default `0`. */\n vignette?: number;\n}\n\nexport type DisplayChannel =\n | 'final'\n | 'shadow'\n | 'albedo'\n | 'normal'\n | 'shadowCatcher'\n | import('./aov.js').AovKind;\n\n/** Primary-ray policy for glTF BLEND materials. */\nexport type AlphaBlendStrategy =\n | 'stochastic'\n | 'deterministic-source-over';\n\n/** Generated source measurements for one shader module. */\nexport interface ShaderModuleCompilationDiagnostics {\n /** Module or pipeline diagnostic label. */\n label: string;\n /** Generated shader source size in bytes. */\n sourceBytes: number;\n /** Generated shader source line count. */\n sourceLines: number;\n /** Stable source-level fingerprint for diagnosing cache-key churn. */\n sourceFingerprint: string;\n}\n\n/** Compilation measurements for one shader pipeline/program. */\nexport interface ShaderPipelineCompilationDiagnostics {\n /** Module or pipeline diagnostic label. */\n label: string;\n /** Compute entry-point name. */\n entryPoint: string;\n /**\n * Whether this pipeline belongs to the minimum set needed to present a\n * usable first image. Optional reuse and quality stages are false even\n * while the current eager compiler still waits for them.\n */\n firstFrameRequired: boolean;\n /** Current compilation state. */\n status: 'queued' | 'compiling' | 'ready' | 'failed';\n /** Milliseconds from the start of this pipeline compilation batch. */\n startedAtMs?: number;\n /** Milliseconds from the start of this pipeline compilation batch. */\n endedAtMs?: number;\n /** Pipeline compilation duration in milliseconds; undefined until completed. */\n durationMs?: number;\n /** Number of pipelines compiling when this one started; undefined before start. */\n concurrentCompilationCount?: number;\n /** Failure message; undefined without a compilation error. */\n error?: string;\n}\n\n/** Source generation and asynchronous pipeline compilation measurements. */\nexport interface ShaderCompilationDiagnostics {\n /** Current compilation state. */\n status: 'compiling' | 'ready' | 'failed';\n /** Generated shader source size in bytes. */\n sourceBytes: number;\n /** Generated shader source line count. */\n sourceLines: number;\n /** Total pipelines in the batch. */\n pipelineCount: number;\n /** Number of pipelines successfully completed. */\n completedPipelineCount: number;\n /** CPU shader source generation time in milliseconds. */\n sourceGenerationTimeMs: number;\n /** Shader module creation time in milliseconds. */\n moduleCreationTimeMs: number;\n /** Per-module source measurements. */\n modules: ShaderModuleCompilationDiagnostics[];\n /** Per-pipeline timing and status measurements. */\n pipelines: ShaderPipelineCompilationDiagnostics[];\n /** Configured pool size, capped to the number of pipelines in this batch. */\n maximumConcurrentPipelineCount: number;\n /** Largest number of createComputePipelineAsync calls active at once. */\n peakConcurrentPipelineCount: number;\n /** Batch pipeline compilation time in milliseconds; undefined until completed. */\n pipelineCompilationTimeMs?: number;\n /** Total batch preparation time in milliseconds; undefined until completed. */\n totalTimeMs?: number;\n /** Failure message; undefined without a compilation error. */\n error?: string;\n}\n\nexport interface RenderingDiagnostics {\n /** Label of the last complete target presented; undefined before the first image. */\n presentedTarget?: string;\n /** Whether the displayed target contains a complete image. Default false. */\n presentedComplete?: boolean;\n /** Resident target dimensions and allocated GPU bytes, including denoise resources. */\n targets?: { label: string; width: number; height: number; bytes: number }[];\n hdrPresentation?: {\n requested: boolean;\n active: boolean;\n /** Largest encoded RGB component sent to the HDR presentation pass. */\n peakDisplayValue?: number;\n };\n textureAtlas?: TextureAtlasStats;\n /** Material texture storage selection and estimated payload; driver allocation overhead is excluded. */\n materialTextures?: {\n requested: 'atlas' | 'auto';\n active: 'atlas' | 'bindless';\n /** Reason auto selected atlas; undefined when no fallback occurred. */\n fallbackReason?: string;\n textureCount: number;\n estimatedBytes: number;\n scale: number;\n /** Metadata buffer bytes; zero for atlas. */\n metadataBytes: number;\n /** Resource-table slots; zero for atlas. */\n resourceTableCapacity: number;\n /** Payload and metadata waiting for previous GPU submissions; zero when none. */\n retiredBytes: number;\n };\n /** Shader compilation measurements: current WebGPU batch or cumulative WebGL programs. */\n shaderCompilation?: ShaderCompilationDiagnostics;\n /** Light-selection table summary (WebGPU). */\n lightSampling?: {\n emissiveTriangles: number;\n activeChoices: number;\n totalWeight: number;\n domains: Record<\n 'environment' | 'infinite' | 'localAndEmissive',\n { count: number; weight: number; pmf: number }\n >;\n };\n /** Traversal stack capacities compiled into the current WebGPU shader. */\n bvh?: {\n tlasTraversalStackSize?: number;\n blasTraversalStackSize?: number;\n /** Last static preparation statistics, excluding queue and WASM loading time. */\n lastBuild?: { geometryCount: number; bvhTimeMs: number };\n };\n gpuTraceTiming?: {\n /** Last light-tracing batch time in milliseconds. Default undefined until measured. */ causticTimeMs?:number;\n /** Last photon-map batch time in milliseconds. Default undefined until measured. */ photonMappingTimeMs?:number;\n /** Photon emission, count, block scan, sum scan and scatter times in milliseconds. Default undefined until measured. */ photonStagesMs?:number[];\n /** Camera path kernel time in milliseconds. Default undefined until measured. */ pathTracingTimeMs?:number;\n tileTimeMs: number;\n tileTimePerSampleMs?: number;\n estimatedFullFrameTimeMs: number;\n tileCount: number;\n };\n}\n\nexport {DEFAULT_BEVEL_SAMPLES, MIN_BEVEL_SAMPLES, MAX_BEVEL_SAMPLES, DEFAULT_DIRECT_LIGHT_CANDIDATES, MIN_DIRECT_LIGHT_CANDIDATES, MAX_DIRECT_LIGHT_CANDIDATES, normalizeDirectLightCandidates, normalizeBevelSamples} from './renderingLimits.js';\n\n/** Shared scene resources; uploaded once per committed revision. */\nexport interface SceneResources {\n /** Returns true when scene geometry, materials, or instance transforms changed. */\n setMeshes(meshes: Mesh[], update?: {\n transforms?: readonly Mesh[];\n colors?: readonly Mesh[];\n geometries?: readonly Geometry[];\n materials?: readonly OpenPBRMaterial[];\n }): boolean;\n /** Changes the software memory guard used when packing material textures. */\n setTextureAtlasBudget(maxBytes: number): boolean;\n setLights(lights: SceneLight[]): void;\n setBackground(background?: SceneBackground): void;\n getDiagnostics(): RenderingDiagnostics;\n dispose(): void;\n readDepthSamples(area: DepthSampleArea): Promise<Float32Array | undefined>;\n}\n/** Explicit execution and composition for one accumulation. */\nexport interface RenderPasses {\n isFirstFrame(): boolean;\n /** Discard accumulated samples and any asynchronous denoise output. */\n restartSamples(): void;\n trace(camera: Camera, maxSamples: number): boolean;\n drawPostProcess(): void;\n /** Apply display-only passes to the last composed image; absent on WebGL. */\n applyPostProcesses?(passes: readonly PostProcess[], render: Render): void;\n getOutputTexture?(kind: 'hdr' | 'display'): GPUTexture | undefined;\n /** Configure deterministic headless batches used by offline frame export. */\n setOfflineRenderOptions(options: {\n samplesPerBatch: number;\n deferPostProcess: boolean;\n sampleSequenceOffset: number;\n }): void;\n /** Store luminance second moments in the normal output during a pilot pass. */\n setVarianceMoments(enabled: boolean): void;\n /** Skip pixels once their independent final-pass target has been reached. */\n setAdaptiveSamplingTargets(targets?: {\n width: number;\n height: number;\n data: Float32Array;\n }): void;\n /** Generate final sample targets on GPU; WebGL returns undefined. */\n prepareOfflineAdaptiveSampling(\n options: OfflineAdaptiveSamplingOptions\n ): Promise<OfflineAdaptiveSamplingResult | undefined>;\n /** Enables extended-range float canvas presentation when the host supports it. */\n setHDROutputEnabled?(enabled: boolean): boolean;\n setToneMappingParams(params: ToneMappingParams): boolean;\n setSize(width: number, height: number): void;\n /**\n * Denoises the current image with an explicitly selected built-in or custom filter. Resolves whether the result is now displayed.\n */\n performDenoise?(\n denoiser: DenoiserHandle,\n alphaDenoiser?: OIDNWeb,\n schedule?: DenoiseSchedule,\n signal?: AbortSignal\n ): Promise<boolean>;\n /** Drops a denoise in flight; the next draw invalidates its output. */\n cancelDenoise?(): void;\n /** Keep the last completed OIDN image visible while static while-converging batches accumulate. */\n setPreserveDenoisedOutput?(preserve: boolean): void;\n getTotalSamplesRendered(): number;\n getDiagnostics(): RenderingDiagnostics;\n /** Waits for asynchronous timestamp diagnostics without changing samples. */\n flushDiagnostics(): Promise<void>;\n setShadowCatcherParams(color: ColorRGB, alpha: number): boolean;\n setBloomParams(opts: {\n intensity: number;\n threshold: number;\n radius: number;\n }): boolean;\n setOnSampleRendered(\n cb: (sampleCount: number, isFirstFrame: boolean, frameTime: number) => void\n ): void;\n setOutput(output: DisplayChannel): boolean;\n setAovDisplayOptions?(options: import('./aovDisplay.js').AovDisplayOptions): void;\n dispose(): void;\n aovReady?(kind: import('./aov.js').AovKind): boolean;\n /** Updates optional surface outputs without tracing beauty; false while compiling. */\n refineAovs?(camera: Camera, samples?: number): boolean;\n restartAovs?(): void;\n getAovSamples?(): number;\n readAov?(kind: import('./aov.js').AovKind): Promise<{width: number; height: number; data: Float32Array | Uint32Array}>;\n readOutput(kind: 'hdr' | 'denoised' | 'albedo' | 'normal'): Promise<{\n data: Float32Array;\n width: number;\n height: number;\n }>;\n}\n"]}
1
+ {"version":3,"file":"RenderingPipeline.js","sourceRoot":"","sources":["../../src/renderer/RenderingPipeline.ts"],"names":[],"mappings":"AA0LA,OAAO,EAAC,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,qBAAqB,EAAC,MAAM,sBAAsB,CAAC","sourcesContent":["import type {SurfaceHit} from './surfaceHit.js';\nimport type {PostProcess} from '../Display.js';\nimport type Render from '../Render.js';\nimport type {DenoiserHandle, OIDNWeb} from './denoiser.js';\nimport type {DenoiseSchedule} from '../Render.js';\nimport type { DepthSampleArea } from './depthQuery.js';\nimport Camera from '../scene/Camera.js';\nimport Mesh from '../scene/Mesh.js';\nimport Geometry from '../scene/Geometry.js';\nimport OpenPBRMaterial from '../scene/OpenPBRMaterial.js';\nimport type { SceneBackground, SceneLight } from '../scene/Scene.js';\nimport type { ColorRGB } from '../types.js';\nimport type { TextureAtlasStats } from './MaterialTable.js';\nimport type {\n OfflineAdaptiveSamplingOptions,\n OfflineAdaptiveSamplingResult\n} from './OfflineAdaptiveSampling.js';\n\nexport type ToneMapping =\n | 'agx'\n | 'aces'\n | 'cineon'\n | 'reinhard'\n | 'linear';\n\nexport interface ToneMappingParams {\n /** Linear exposure multiplier. Default `1`. */\n exposure?: number;\n /** Display tone mapper. Default `agx`. */\n toneMapping?: ToneMapping;\n /** Contrast multiplier. Default `1`. */\n contrast?: number;\n /** Saturation multiplier. Default `1`. */\n saturation?: number;\n /** Color temperature adjustment in [-1, 1]. Default `0`. */\n temperature?: number;\n /** Green/magenta adjustment in [-1, 1]. Default `0`. */\n tint?: number;\n /** Vignette strength in [0, 1]. Default `0`. */\n vignette?: number;\n}\n\nexport type DisplayChannel =\n | 'final'\n | 'shadow'\n | 'albedo'\n | 'normal'\n | 'shadowCatcher'\n | import('./aov.js').AovKind;\n\n/** Primary-ray policy for glTF BLEND materials. */\nexport type AlphaBlendStrategy =\n | 'stochastic'\n | 'deterministic-source-over';\n\n/** Generated source measurements for one shader module. */\nexport interface ShaderModuleCompilationDiagnostics {\n /** Module or pipeline diagnostic label. */\n label: string;\n /** Generated shader source size in bytes. */\n sourceBytes: number;\n /** Generated shader source line count. */\n sourceLines: number;\n /** Stable source-level fingerprint for diagnosing cache-key churn. */\n sourceFingerprint: string;\n}\n\n/** Compilation measurements for one shader pipeline/program. */\nexport interface ShaderPipelineCompilationDiagnostics {\n /** Module or pipeline diagnostic label. */\n label: string;\n /** Compute entry-point name. */\n entryPoint: string;\n /**\n * Whether this pipeline belongs to the minimum set needed to present a\n * usable first image. Optional reuse and quality stages are false even\n * while the current eager compiler still waits for them.\n */\n firstFrameRequired: boolean;\n /** Current compilation state. */\n status: 'queued' | 'compiling' | 'ready' | 'failed';\n /** Milliseconds from the start of this pipeline compilation batch. */\n startedAtMs?: number;\n /** Milliseconds from the start of this pipeline compilation batch. */\n endedAtMs?: number;\n /** Pipeline compilation duration in milliseconds; undefined until completed. */\n durationMs?: number;\n /** Number of pipelines compiling when this one started; undefined before start. */\n concurrentCompilationCount?: number;\n /** Failure message; undefined without a compilation error. */\n error?: string;\n}\n\n/** Source generation and asynchronous pipeline compilation measurements. */\nexport interface ShaderCompilationDiagnostics {\n /** Current compilation state. */\n status: 'compiling' | 'ready' | 'failed';\n /** Generated shader source size in bytes. */\n sourceBytes: number;\n /** Generated shader source line count. */\n sourceLines: number;\n /** Total pipelines in the batch. */\n pipelineCount: number;\n /** Number of pipelines successfully completed. */\n completedPipelineCount: number;\n /** CPU shader source generation time in milliseconds. */\n sourceGenerationTimeMs: number;\n /** Shader module creation time in milliseconds. */\n moduleCreationTimeMs: number;\n /** Per-module source measurements. */\n modules: ShaderModuleCompilationDiagnostics[];\n /** Per-pipeline timing and status measurements. */\n pipelines: ShaderPipelineCompilationDiagnostics[];\n /** Configured pool size, capped to the number of pipelines in this batch. */\n maximumConcurrentPipelineCount: number;\n /** Largest number of createComputePipelineAsync calls active at once. */\n peakConcurrentPipelineCount: number;\n /** Batch pipeline compilation time in milliseconds; undefined until completed. */\n pipelineCompilationTimeMs?: number;\n /** Total batch preparation time in milliseconds; undefined until completed. */\n totalTimeMs?: number;\n /** Failure message; undefined without a compilation error. */\n error?: string;\n}\n\nexport interface RenderingDiagnostics {\n /** Label of the last complete target presented; undefined before the first image. */\n presentedTarget?: string;\n /** Whether the displayed target contains a complete image. Default false. */\n presentedComplete?: boolean;\n /** Resident target dimensions and allocated GPU bytes, including denoise resources. */\n targets?: { label: string; width: number; height: number; bytes: number }[];\n hdrPresentation?: {\n requested: boolean;\n active: boolean;\n /** Largest encoded RGB component sent to the HDR presentation pass. */\n peakDisplayValue?: number;\n };\n textureAtlas?: TextureAtlasStats;\n /** Material texture storage selection and estimated payload; driver allocation overhead is excluded. */\n materialTextures?: {\n requested: 'atlas' | 'auto';\n active: 'atlas' | 'bindless';\n /** Reason auto selected atlas; undefined when no fallback occurred. */\n fallbackReason?: string;\n textureCount: number;\n estimatedBytes: number;\n scale: number;\n /** Metadata buffer bytes; zero for atlas. */\n metadataBytes: number;\n /** Resource-table slots; zero for atlas. */\n resourceTableCapacity: number;\n /** Payload and metadata waiting for previous GPU submissions; zero when none. */\n retiredBytes: number;\n };\n /** Shader compilation measurements: current WebGPU batch or cumulative WebGL programs. */\n shaderCompilation?: ShaderCompilationDiagnostics;\n /** Light-selection table summary (WebGPU). */\n lightSampling?: {\n emissiveTriangles: number;\n activeChoices: number;\n totalWeight: number;\n domains: Record<\n 'environment' | 'infinite' | 'localAndEmissive',\n { count: number; weight: number; pmf: number }\n >;\n };\n /** Traversal stack capacities compiled into the current WebGPU shader. */\n bvh?: {\n tlasTraversalStackSize?: number;\n blasTraversalStackSize?: number;\n /** Last static preparation statistics, excluding queue and WASM loading time. */\n lastBuild?: { geometryCount: number; bvhTimeMs: number };\n };\n gpuTraceTiming?: {\n /** Last light-tracing batch time in milliseconds. Default undefined until measured. */ causticTimeMs?:number;\n /** Last photon-map batch time in milliseconds. Default undefined until measured. */ photonMappingTimeMs?:number;\n /** Photon emission, count, block scan, sum scan and scatter times in milliseconds. Default undefined until measured. */ photonStagesMs?:number[];\n /** Camera path kernel time in milliseconds. Default undefined until measured. */ pathTracingTimeMs?:number;\n tileTimeMs: number;\n tileTimePerSampleMs?: number;\n estimatedFullFrameTimeMs: number;\n tileCount: number;\n };\n}\n\nexport {DEFAULT_BEVEL_SAMPLES, MIN_BEVEL_SAMPLES, MAX_BEVEL_SAMPLES, DEFAULT_DIRECT_LIGHT_CANDIDATES, MIN_DIRECT_LIGHT_CANDIDATES, MAX_DIRECT_LIGHT_CANDIDATES, normalizeDirectLightCandidates, normalizeBevelSamples} from './renderingLimits.js';\n\n/** Shared scene resources; uploaded once per committed revision. */\nexport interface SceneResources {\n /** Returns true when scene geometry, materials, or instance transforms changed. */\n setMeshes(meshes: Mesh[], update?: {\n transforms?: readonly Mesh[];\n colors?: readonly Mesh[];\n geometries?: readonly Geometry[];\n materials?: readonly OpenPBRMaterial[];\n }): boolean;\n /** Changes the software memory guard used when packing material textures. */\n setTextureAtlasBudget(maxBytes: number): boolean;\n setLights(lights: SceneLight[]): void;\n setBackground(background?: SceneBackground): void;\n getDiagnostics(): RenderingDiagnostics;\n dispose(): void;\n readDepthSamples(area: DepthSampleArea): Promise<Float32Array | undefined>;\n pickSurface?(x: number, y: number, aspect?: number): Promise<SurfaceHit | null | undefined>;\n}\n/** Explicit execution and composition for one accumulation. */\nexport interface RenderPasses {\n isFirstFrame(): boolean;\n /** Discard accumulated samples and any asynchronous denoise output. */\n restartSamples(): void;\n trace(camera: Camera, maxSamples: number): boolean;\n drawPostProcess(): void;\n /** Apply display-only passes to the last composed image; absent on WebGL. */\n applyPostProcesses?(passes: readonly PostProcess[], render: Render, options?: readonly import('../Display.js').PostProcessOptions[], crop?: {width: number; height: number}): void;\n getAovTexture?(kind: 'diffuseColor' | 'specularColor' | 'depth'): GPUTexture | undefined;\n getOutputTexture?(kind: 'hdr' | 'display'): GPUTexture | undefined;\n /** Configure deterministic headless batches used by offline frame export. */\n setOfflineRenderOptions(options: {\n samplesPerBatch: number;\n deferPostProcess: boolean;\n sampleSequenceOffset: number;\n }): void;\n /** Store luminance second moments in the normal output during a pilot pass. */\n setVarianceMoments(enabled: boolean): void;\n /** Skip pixels once their independent final-pass target has been reached. */\n setAdaptiveSamplingTargets(targets?: {\n width: number;\n height: number;\n data: Float32Array;\n }): void;\n /** Generate final sample targets on GPU; WebGL returns undefined. */\n prepareOfflineAdaptiveSampling(\n options: OfflineAdaptiveSamplingOptions\n ): Promise<OfflineAdaptiveSamplingResult | undefined>;\n /** Enables extended-range float canvas presentation when the host supports it. */\n setHDROutputEnabled?(enabled: boolean): boolean;\n setToneMappingParams(params: ToneMappingParams): boolean;\n setSize(width: number, height: number): void;\n /**\n * Denoises the current image with an explicitly selected built-in or custom filter. Resolves whether the result is now displayed.\n */\n performDenoise?(\n denoiser: DenoiserHandle,\n alphaDenoiser?: OIDNWeb,\n schedule?: DenoiseSchedule,\n signal?: AbortSignal\n ): Promise<boolean>;\n /** Drops a denoise in flight; the next draw invalidates its output. */\n cancelDenoise?(): void;\n /** Keep the last completed OIDN image visible while static while-converging batches accumulate. */\n setPreserveDenoisedOutput?(preserve: boolean): void;\n getTotalSamplesRendered(): number;\n getDiagnostics(): RenderingDiagnostics;\n /** Waits for asynchronous timestamp diagnostics without changing samples. */\n flushDiagnostics(): Promise<void>;\n setShadowCatcherParams(color: ColorRGB, alpha: number): boolean;\n setBloomParams(opts: {\n intensity: number;\n threshold: number;\n radius: number;\n }): boolean;\n setOnSampleRendered(\n cb: (sampleCount: number, isFirstFrame: boolean, frameTime: number) => void\n ): void;\n setOutput(output: DisplayChannel): boolean;\n setAovDisplayOptions?(options: import('./aovDisplay.js').AovDisplayOptions): void;\n dispose(): void;\n aovReady?(kind: import('./aov.js').AovKind): boolean;\n /** Updates optional surface outputs without tracing beauty; false while compiling. */\n refineAovs?(camera: Camera, samples?: number): boolean;\n restartAovs?(): void;\n getAovSamples?(): number;\n readAov?(kind: import('./aov.js').AovKind): Promise<{width: number; height: number; data: Float32Array | Uint32Array}>;\n readOutput(kind: 'hdr' | 'denoised' | 'albedo' | 'normal'): Promise<{\n data: Float32Array;\n width: number;\n height: number;\n }>;\n}\n"]}
@@ -18,7 +18,7 @@ export declare function makeTileRender(gl?: WebGL2RenderingContext): {
18
18
  setDesiredMsPerTile(time: number): void;
19
19
  getDesiredMsPerTile(): number;
20
20
  };
21
- export declare function makeTileRenderWithPredict(): {
21
+ export declare function makeTileRenderWithPredict(minimumTileSize?: number): {
22
22
  nextTile: () => {
23
23
  xIndex: number;
24
24
  yIndex: number;
@@ -37,7 +37,7 @@ export declare function makeTileRenderWithPredict(): {
37
37
  setMaxTiles(maxTiles: number): void;
38
38
  setDesiredMsPerTile(time: number): void;
39
39
  needsUpdatePredicting(): void;
40
- setLastTraceTime(time: number): void;
40
+ setLastTraceTime(time: number, timedColumns?: number, timedRows?: number): void;
41
41
  getLastTraceTime(): number;
42
42
  getDesiredMsPerTile(): number;
43
43
  };