@zephyr3d/scene 0.9.26 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/README.md +60 -27
  2. package/dist/animation/animation_bank.js +634 -0
  3. package/dist/animation/animation_bank.js.map +1 -0
  4. package/dist/animation/animation_bank_gpu.js +256 -0
  5. package/dist/animation/animation_bank_gpu.js.map +1 -0
  6. package/dist/animation/animationset.js +146 -30
  7. package/dist/animation/animationset.js.map +1 -1
  8. package/dist/animation/cloth/gpu_cloth_component.js +406 -0
  9. package/dist/animation/cloth/gpu_cloth_component.js.map +1 -0
  10. package/dist/animation/cloth/gpu_cloth_system.js +332 -202
  11. package/dist/animation/cloth/gpu_cloth_system.js.map +1 -1
  12. package/dist/animation/gpu_animation_driver.js +289 -0
  13. package/dist/animation/gpu_animation_driver.js.map +1 -0
  14. package/dist/animation/joint_dynamics/collision.js +112 -1
  15. package/dist/animation/joint_dynamics/collision.js.map +1 -1
  16. package/dist/animation/joint_dynamics/controller.js +6 -0
  17. package/dist/animation/joint_dynamics/controller.js.map +1 -1
  18. package/dist/animation/joint_dynamics/joint_dynamics_system.js +11 -0
  19. package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
  20. package/dist/animation/joint_dynamics/solver.js +50 -12
  21. package/dist/animation/joint_dynamics/solver.js.map +1 -1
  22. package/dist/animation/joint_dynamics/types.js.map +1 -1
  23. package/dist/animation/skeleton.js +300 -56
  24. package/dist/animation/skeleton.js.map +1 -1
  25. package/dist/animation/skin_palette_atlas.js +252 -0
  26. package/dist/animation/skin_palette_atlas.js.map +1 -0
  27. package/dist/animation/spring/multi_chain_spring_system.js +298 -38
  28. package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
  29. package/dist/animation/spring/spring_chain.js +2 -0
  30. package/dist/animation/spring/spring_chain.js.map +1 -1
  31. package/dist/animation/spring/spring_collider.js +159 -21
  32. package/dist/animation/spring/spring_collider.js.map +1 -1
  33. package/dist/animation/spring/spring_particle.js +1 -0
  34. package/dist/animation/spring/spring_particle.js.map +1 -1
  35. package/dist/animation/spring/spring_solver.js +173 -0
  36. package/dist/animation/spring/spring_solver.js.map +1 -0
  37. package/dist/animation/spring/spring_system.js +249 -24
  38. package/dist/animation/spring/spring_system.js.map +1 -1
  39. package/dist/animation/spring_modifier.js +32 -1
  40. package/dist/animation/spring_modifier.js.map +1 -1
  41. package/dist/app/app.js +26 -0
  42. package/dist/app/app.js.map +1 -1
  43. package/dist/app/engine.js +86 -15
  44. package/dist/app/engine.js.map +1 -1
  45. package/dist/app/gamepad.js +191 -0
  46. package/dist/app/gamepad.js.map +1 -0
  47. package/dist/app/inputactions.js +271 -0
  48. package/dist/app/inputactions.js.map +1 -0
  49. package/dist/app/inputmgr.js +331 -22
  50. package/dist/app/inputmgr.js.map +1 -1
  51. package/dist/app/loading.js +138 -0
  52. package/dist/app/loading.js.map +1 -0
  53. package/dist/app/pipelinecache.js +209 -0
  54. package/dist/app/pipelinecache.js.map +1 -0
  55. package/dist/app/runtimescript.js +25 -0
  56. package/dist/app/runtimescript.js.map +1 -1
  57. package/dist/app/scriptingsystem.js +54 -0
  58. package/dist/app/scriptingsystem.js.map +1 -1
  59. package/dist/app/scriptregistry.js +7 -2
  60. package/dist/app/scriptregistry.js.map +1 -1
  61. package/dist/asset/asset_manifest.js +59 -0
  62. package/dist/asset/asset_manifest.js.map +1 -0
  63. package/dist/asset/asset_preload.js +258 -0
  64. package/dist/asset/asset_preload.js.map +1 -0
  65. package/dist/asset/assetmanager.js +117 -65
  66. package/dist/asset/assetmanager.js.map +1 -1
  67. package/dist/asset/loaders/ktx2/basis/LICENSE +201 -0
  68. package/dist/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
  69. package/dist/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
  70. package/dist/asset/loaders/ktx2/basis_location.js +17 -0
  71. package/dist/asset/loaders/ktx2/basis_location.js.map +1 -0
  72. package/dist/asset/loaders/ktx2/ktx2_loader.js +88 -0
  73. package/dist/asset/loaders/ktx2/ktx2_loader.js.map +1 -0
  74. package/dist/asset/loaders/ktx2/ktx2_targets.js +118 -0
  75. package/dist/asset/loaders/ktx2/ktx2_targets.js.map +1 -0
  76. package/dist/asset/loaders/ktx2/transcoder_pool.js +259 -0
  77. package/dist/asset/loaders/ktx2/transcoder_pool.js.map +1 -0
  78. package/dist/asset/mesh_lod_builder.js +104 -0
  79. package/dist/asset/mesh_lod_builder.js.map +1 -0
  80. package/dist/asset/mesh_settings.js +111 -0
  81. package/dist/asset/mesh_settings.js.map +1 -0
  82. package/dist/asset/meshopt_decoder.js +18 -0
  83. package/dist/asset/meshopt_decoder.js.map +1 -0
  84. package/dist/asset/meshopt_simplifier.js +26 -0
  85. package/dist/asset/meshopt_simplifier.js.map +1 -0
  86. package/dist/asset/model.js +177 -3
  87. package/dist/asset/model.js.map +1 -1
  88. package/dist/asset/texture_settings.js +231 -0
  89. package/dist/asset/texture_settings.js.map +1 -0
  90. package/dist/asset/zmsh_binary.js +131 -0
  91. package/dist/asset/zmsh_binary.js.map +1 -0
  92. package/dist/asset/zsdf_binary.js +111 -0
  93. package/dist/asset/zsdf_binary.js.map +1 -0
  94. package/dist/blitter/bilateralblur.js +1 -2
  95. package/dist/blitter/bilateralblur.js.map +1 -1
  96. package/dist/blitter/gaussianblur.js +1 -6
  97. package/dist/blitter/gaussianblur.js.map +1 -1
  98. package/dist/camera/base.js +31 -10
  99. package/dist/camera/base.js.map +1 -1
  100. package/dist/camera/camera.js +178 -200
  101. package/dist/camera/camera.js.map +1 -1
  102. package/dist/camera/follow.js +342 -0
  103. package/dist/camera/follow.js.map +1 -0
  104. package/dist/camera/fps.js +9 -7
  105. package/dist/camera/fps.js.map +1 -1
  106. package/dist/camera/orbit.js +46 -19
  107. package/dist/camera/orbit.js.map +1 -1
  108. package/dist/index.d.ts +30475 -19865
  109. package/dist/index.js +67 -12
  110. package/dist/index.js.map +1 -1
  111. package/dist/material/blinn.js +3 -0
  112. package/dist/material/blinn.js.map +1 -1
  113. package/dist/material/eye.js +1 -1
  114. package/dist/material/eye.js.map +1 -1
  115. package/dist/material/hair.js +2 -3
  116. package/dist/material/hair.js.map +1 -1
  117. package/dist/material/hairstrand.js +235 -235
  118. package/dist/material/hairstrand.js.map +1 -1
  119. package/dist/material/lambert.js +4 -1
  120. package/dist/material/lambert.js.map +1 -1
  121. package/dist/material/material.js +362 -300
  122. package/dist/material/material.js.map +1 -1
  123. package/dist/material/meshmaterial.js +118 -45
  124. package/dist/material/meshmaterial.js.map +1 -1
  125. package/dist/material/mixins/lightmodel/blinnphong.js +1 -1
  126. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  127. package/dist/material/mixins/lightmodel/lambert.js +1 -1
  128. package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
  129. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +34 -61
  130. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
  131. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +16 -2
  132. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  133. package/dist/material/mixins/lightmodel/pbrspecularglossness.js +2 -1
  134. package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
  135. package/dist/material/mixins/lit.js +223 -83
  136. package/dist/material/mixins/lit.js.map +1 -1
  137. package/dist/material/mixins/pbr/common.js +31 -206
  138. package/dist/material/mixins/pbr/common.js.map +1 -1
  139. package/dist/material/mtoon.js +1 -1
  140. package/dist/material/mtoon.js.map +1 -1
  141. package/dist/material/pbrmr.js +3 -0
  142. package/dist/material/pbrmr.js.map +1 -1
  143. package/dist/material/pbrsg.js +3 -0
  144. package/dist/material/pbrsg.js.map +1 -1
  145. package/dist/material/sdf_debug.js +78 -0
  146. package/dist/material/sdf_debug.js.map +1 -0
  147. package/dist/material/shader/helper.js +733 -190
  148. package/dist/material/shader/helper.js.map +1 -1
  149. package/dist/material/shader/terrain_blend.js +204 -43
  150. package/dist/material/shader/terrain_blend.js.map +1 -1
  151. package/dist/material/skin.js +331 -297
  152. package/dist/material/skin.js.map +1 -1
  153. package/dist/material/skinprofile.js +1058 -0
  154. package/dist/material/skinprofile.js.map +1 -0
  155. package/dist/material/sss.js +353 -0
  156. package/dist/material/sss.js.map +1 -0
  157. package/dist/material/sss_kernel.js +265 -0
  158. package/dist/material/sss_kernel.js.map +1 -0
  159. package/dist/material/sssprofile.js +879 -0
  160. package/dist/material/sssprofile.js.map +1 -0
  161. package/dist/material/subsurfaceprofile.js +4 -8
  162. package/dist/material/subsurfaceprofile.js.map +1 -1
  163. package/dist/material/terrain-cm.js +464 -188
  164. package/dist/material/terrain-cm.js.map +1 -1
  165. package/dist/material/unlit.js +3 -0
  166. package/dist/material/unlit.js.map +1 -1
  167. package/dist/material/water.js +2009 -201
  168. package/dist/material/water.js.map +1 -1
  169. package/dist/node_modules/meshoptimizer/LICENSE +21 -0
  170. package/dist/node_modules/meshoptimizer/meshopt_decoder.js +197 -0
  171. package/dist/node_modules/meshoptimizer/meshopt_decoder.js.map +1 -0
  172. package/dist/node_modules/meshoptimizer/meshopt_simplifier.js +677 -0
  173. package/dist/node_modules/meshoptimizer/meshopt_simplifier.js.map +1 -0
  174. package/dist/physics/character.js +226 -0
  175. package/dist/physics/character.js.map +1 -0
  176. package/dist/physics/collider.js +209 -0
  177. package/dist/physics/collider.js.map +1 -0
  178. package/dist/physics/events.js +79 -0
  179. package/dist/physics/events.js.map +1 -0
  180. package/dist/physics/joint.js +272 -0
  181. package/dist/physics/joint.js.map +1 -0
  182. package/dist/physics/node_physics.js +234 -0
  183. package/dist/physics/node_physics.js.map +1 -0
  184. package/dist/physics/part.js +91 -0
  185. package/dist/physics/part.js.map +1 -0
  186. package/dist/physics/rigid_body.js +379 -0
  187. package/dist/physics/rigid_body.js.map +1 -0
  188. package/dist/physics/vehicle.js +335 -0
  189. package/dist/physics/vehicle.js.map +1 -0
  190. package/dist/physics/world.js +25 -0
  191. package/dist/physics/world.js.map +1 -0
  192. package/dist/posteffect/bloom.js +49 -14
  193. package/dist/posteffect/bloom.js.map +1 -1
  194. package/dist/posteffect/motionblur.js +668 -63
  195. package/dist/posteffect/motionblur.js.map +1 -1
  196. package/dist/posteffect/posteffect.js +12 -1
  197. package/dist/posteffect/posteffect.js.map +1 -1
  198. package/dist/posteffect/postsss.js +572 -0
  199. package/dist/posteffect/postsss.js.map +1 -0
  200. package/dist/posteffect/sao.js +48 -50
  201. package/dist/posteffect/sao.js.map +1 -1
  202. package/dist/posteffect/skinsss.js +605 -355
  203. package/dist/posteffect/skinsss.js.map +1 -1
  204. package/dist/posteffect/ssgi.js +91 -162
  205. package/dist/posteffect/ssgi.js.map +1 -1
  206. package/dist/posteffect/ssr.js +3 -11
  207. package/dist/posteffect/ssr.js.map +1 -1
  208. package/dist/posteffect/sss.js +34 -15
  209. package/dist/posteffect/sss.js.map +1 -1
  210. package/dist/posteffect/taa.js +1 -0
  211. package/dist/posteffect/taa.js.map +1 -1
  212. package/dist/render/abuffer_oit.js +40 -39
  213. package/dist/render/abuffer_oit.js.map +1 -1
  214. package/dist/render/clipmap.js +328 -62
  215. package/dist/render/clipmap.js.map +1 -1
  216. package/dist/render/cluster_light.js +958 -224
  217. package/dist/render/cluster_light.js.map +1 -1
  218. package/dist/render/cull_visitor.js +26 -5
  219. package/dist/render/cull_visitor.js.map +1 -1
  220. package/dist/render/debug_views.js +37 -0
  221. package/dist/render/debug_views.js.map +1 -0
  222. package/dist/render/depthpass.js +5 -1
  223. package/dist/render/depthpass.js.map +1 -1
  224. package/dist/render/drawable_mixin.js +53 -6
  225. package/dist/render/drawable_mixin.js.map +1 -1
  226. package/dist/render/dualdepthpeeling_oit.js +53 -53
  227. package/dist/render/dualdepthpeeling_oit.js.map +1 -1
  228. package/dist/render/envlight.js +196 -113
  229. package/dist/render/envlight.js.map +1 -1
  230. package/dist/render/fbm_wavegenerator.js +8 -13
  231. package/dist/render/fbm_wavegenerator.js.map +1 -1
  232. package/dist/render/fft_wavegenerator.js +268 -136
  233. package/dist/render/fft_wavegenerator.js.map +1 -1
  234. package/dist/render/gerstner_wavegenerator.js +113 -28
  235. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  236. package/dist/render/gi/probe_volume.js +1334 -0
  237. package/dist/render/gi/probe_volume.js.map +1 -0
  238. package/dist/render/gi/scene_gi.js +282 -0
  239. package/dist/render/gi/scene_gi.js.map +1 -0
  240. package/dist/render/gi/voxel_atlas.js +198 -0
  241. package/dist/render/gi/voxel_atlas.js.map +1 -0
  242. package/dist/render/gi/voxel_lighting.js +652 -0
  243. package/dist/render/gi/voxel_lighting.js.map +1 -0
  244. package/dist/render/gi/voxel_scene.js +642 -0
  245. package/dist/render/gi/voxel_scene.js.map +1 -0
  246. package/dist/render/gi/voxelize_pass.js +223 -0
  247. package/dist/render/gi/voxelize_pass.js.map +1 -0
  248. package/dist/render/globalbindgroup_allocator.js +3 -2
  249. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  250. package/dist/render/gpu_picking.js +9 -36
  251. package/dist/render/gpu_picking.js.map +1 -1
  252. package/dist/render/hzb.js +80 -22
  253. package/dist/render/hzb.js.map +1 -1
  254. package/dist/render/instance_culling.js +499 -0
  255. package/dist/render/instance_culling.js.map +1 -0
  256. package/dist/render/lightpass.js +23 -9
  257. package/dist/render/lightpass.js.map +1 -1
  258. package/dist/render/lod.js +46 -0
  259. package/dist/render/lod.js.map +1 -0
  260. package/dist/render/oit.js +11 -11
  261. package/dist/render/oit.js.map +1 -1
  262. package/dist/render/primitive.js +301 -9
  263. package/dist/render/primitive.js.map +1 -1
  264. package/dist/render/primitive_readback.js +209 -0
  265. package/dist/render/primitive_readback.js.map +1 -0
  266. package/dist/render/render_queue.js +198 -11
  267. package/dist/render/render_queue.js.map +1 -1
  268. package/dist/render/renderer.js +14 -7
  269. package/dist/render/renderer.js.map +1 -1
  270. package/dist/render/rendergraph/blackboard.js +15 -1
  271. package/dist/render/rendergraph/blackboard.js.map +1 -1
  272. package/dist/render/rendergraph/executor.js +136 -0
  273. package/dist/render/rendergraph/executor.js.map +1 -1
  274. package/dist/render/rendergraph/forward_plus_builder.js +585 -59
  275. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
  276. package/dist/render/rendergraph/frame_resource_requirements.js +1 -0
  277. package/dist/render/rendergraph/frame_resource_requirements.js.map +1 -1
  278. package/dist/render/rendergraph/history_resources.js +8 -1
  279. package/dist/render/rendergraph/history_resources.js.map +1 -1
  280. package/dist/render/rendergraph/scene_render_context.js +31 -2
  281. package/dist/render/rendergraph/scene_render_context.js.map +1 -1
  282. package/dist/render/rendergraph/types.js.map +1 -1
  283. package/dist/render/renderpass.js +28 -5
  284. package/dist/render/renderpass.js.map +1 -1
  285. package/dist/render/sdf/box_allocator.js +98 -0
  286. package/dist/render/sdf/box_allocator.js.map +1 -0
  287. package/dist/render/sdf/global_sdf.js +865 -0
  288. package/dist/render/sdf/global_sdf.js.map +1 -0
  289. package/dist/render/sdf/scene_sdf.js +562 -0
  290. package/dist/render/sdf/scene_sdf.js.map +1 -0
  291. package/dist/render/sdf/sdf_atlas.js +227 -0
  292. package/dist/render/sdf/sdf_atlas.js.map +1 -0
  293. package/dist/render/sdf/sdf_programs.js +42 -0
  294. package/dist/render/sdf/sdf_programs.js.map +1 -0
  295. package/dist/render/sdf/sdf_view.js +199 -0
  296. package/dist/render/sdf/sdf_view.js.map +1 -0
  297. package/dist/render/sdf/waterline.js +610 -0
  298. package/dist/render/sdf/waterline.js.map +1 -0
  299. package/dist/render/shadow_mask_pass.js +142 -25
  300. package/dist/render/shadow_mask_pass.js.map +1 -1
  301. package/dist/render/shore_wave_generator.js +1193 -0
  302. package/dist/render/shore_wave_generator.js.map +1 -0
  303. package/dist/render/sky.js +516 -86
  304. package/dist/render/sky.js.map +1 -1
  305. package/dist/render/transmission_thickness_pass.js +477 -0
  306. package/dist/render/transmission_thickness_pass.js.map +1 -0
  307. package/dist/render/underwater.js +524 -0
  308. package/dist/render/underwater.js.map +1 -0
  309. package/dist/render/virtualtexture/virtual_texture.js +1214 -0
  310. package/dist/render/virtualtexture/virtual_texture.js.map +1 -0
  311. package/dist/render/volumetric_cloud/cloud_common.js +472 -0
  312. package/dist/render/volumetric_cloud/cloud_common.js.map +1 -0
  313. package/dist/render/volumetric_cloud/cloud_noise.js +189 -0
  314. package/dist/render/volumetric_cloud/cloud_noise.js.map +1 -0
  315. package/dist/render/volumetric_cloud/debug_view.js +131 -0
  316. package/dist/render/volumetric_cloud/debug_view.js.map +1 -0
  317. package/dist/render/volumetric_cloud/resources.js +380 -0
  318. package/dist/render/volumetric_cloud/resources.js.map +1 -0
  319. package/dist/render/volumetric_cloud/sky_cache.js +380 -0
  320. package/dist/render/volumetric_cloud/sky_cache.js.map +1 -0
  321. package/dist/render/volumetric_cloud/volumetric_cloud.js +318 -0
  322. package/dist/render/volumetric_cloud/volumetric_cloud.js.map +1 -0
  323. package/dist/render/water_caustics.js +1195 -0
  324. package/dist/render/water_caustics.js.map +1 -0
  325. package/dist/render/water_foam.js +627 -0
  326. package/dist/render/water_foam.js.map +1 -0
  327. package/dist/render/water_interaction.js +1795 -0
  328. package/dist/render/water_interaction.js.map +1 -0
  329. package/dist/render/weightedblended_oit.js +36 -36
  330. package/dist/render/weightedblended_oit.js.map +1 -1
  331. package/dist/scene/basesprite.js +9 -4
  332. package/dist/scene/basesprite.js.map +1 -1
  333. package/dist/scene/batchgroup.js +108 -12
  334. package/dist/scene/batchgroup.js.map +1 -1
  335. package/dist/scene/environment.js +28 -7
  336. package/dist/scene/environment.js.map +1 -1
  337. package/dist/scene/foliage.js +1020 -0
  338. package/dist/scene/foliage.js.map +1 -0
  339. package/dist/scene/foliage_buckets.js +147 -0
  340. package/dist/scene/foliage_buckets.js.map +1 -0
  341. package/dist/scene/foliage_mask.js +358 -0
  342. package/dist/scene/foliage_mask.js.map +1 -0
  343. package/dist/scene/hair.js +15 -4
  344. package/dist/scene/hair.js.map +1 -1
  345. package/dist/scene/light.js +179 -13
  346. package/dist/scene/light.js.map +1 -1
  347. package/dist/scene/mesh.js +327 -45
  348. package/dist/scene/mesh.js.map +1 -1
  349. package/dist/scene/meshdrawable.js +6 -0
  350. package/dist/scene/meshdrawable.js.map +1 -1
  351. package/dist/scene/msdftext.js +9 -3
  352. package/dist/scene/msdftext.js.map +1 -1
  353. package/dist/scene/msdftextsprite.js +9 -3
  354. package/dist/scene/msdftextsprite.js.map +1 -1
  355. package/dist/scene/particlesys.js +8 -2
  356. package/dist/scene/particlesys.js.map +1 -1
  357. package/dist/scene/physics_settings.js +157 -0
  358. package/dist/scene/physics_settings.js.map +1 -0
  359. package/dist/scene/scene.js +190 -44
  360. package/dist/scene/scene.js.map +1 -1
  361. package/dist/scene/scene_node.js +147 -6
  362. package/dist/scene/scene_node.js.map +1 -1
  363. package/dist/scene/terrain-cm/bladegrassmaterial.js +735 -0
  364. package/dist/scene/terrain-cm/bladegrassmaterial.js.map +1 -0
  365. package/dist/scene/terrain-cm/grass.js +881 -42
  366. package/dist/scene/terrain-cm/grass.js.map +1 -1
  367. package/dist/scene/terrain-cm/grass_gpu.js +929 -0
  368. package/dist/scene/terrain-cm/grass_gpu.js.map +1 -0
  369. package/dist/scene/terrain-cm/grassmaterial.js +180 -9
  370. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  371. package/dist/scene/terrain-cm/terrain-cm.js +465 -36
  372. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  373. package/dist/scene/terrain-cm/terrain_gi_albedo.js +257 -0
  374. package/dist/scene/terrain-cm/terrain_gi_albedo.js.map +1 -0
  375. package/dist/scene/terrain-cm/terrain_rvt.js +395 -0
  376. package/dist/scene/terrain-cm/terrain_rvt.js.map +1 -0
  377. package/dist/scene/update_queue.js +54 -0
  378. package/dist/scene/update_queue.js.map +1 -0
  379. package/dist/scene/water.js +997 -96
  380. package/dist/scene/water.js.map +1 -1
  381. package/dist/scene/water_surface_sampler.js +324 -0
  382. package/dist/scene/water_surface_sampler.js.map +1 -0
  383. package/dist/scene/wind.js +317 -0
  384. package/dist/scene/wind.js.map +1 -0
  385. package/dist/shaders/atmosphere.js +388 -166
  386. package/dist/shaders/atmosphere.js.map +1 -1
  387. package/dist/shaders/fog.js +100 -32
  388. package/dist/shaders/fog.js.map +1 -1
  389. package/dist/shaders/gi.js +365 -0
  390. package/dist/shaders/gi.js.map +1 -0
  391. package/dist/shaders/ltc_rect.js +202 -0
  392. package/dist/shaders/ltc_rect.js.map +1 -0
  393. package/dist/shaders/misc.js +1 -10
  394. package/dist/shaders/misc.js.map +1 -1
  395. package/dist/shaders/noise.js +5 -1
  396. package/dist/shaders/noise.js.map +1 -1
  397. package/dist/shaders/probes.js +309 -0
  398. package/dist/shaders/probes.js.map +1 -0
  399. package/dist/shaders/sdf.js +537 -0
  400. package/dist/shaders/sdf.js.map +1 -0
  401. package/dist/shaders/shadow.js +104 -70
  402. package/dist/shaders/shadow.js.map +1 -1
  403. package/dist/shaders/skin_brdf.js +243 -0
  404. package/dist/shaders/skin_brdf.js.map +1 -0
  405. package/dist/shaders/ssr.js +6 -159
  406. package/dist/shaders/ssr.js.map +1 -1
  407. package/dist/shaders/temporal.js +38 -27
  408. package/dist/shaders/temporal.js.map +1 -1
  409. package/dist/shaders/water.js +40 -87
  410. package/dist/shaders/water.js.map +1 -1
  411. package/dist/shaders/water_medium.js +42 -0
  412. package/dist/shaders/water_medium.js.map +1 -0
  413. package/dist/shadow/dom.js +110 -19
  414. package/dist/shadow/dom.js.map +1 -1
  415. package/dist/shadow/esm.js +3 -3
  416. package/dist/shadow/esm.js.map +1 -1
  417. package/dist/shadow/pcf_opt.js +15 -48
  418. package/dist/shadow/pcf_opt.js.map +1 -1
  419. package/dist/shadow/pcf_pd.js +15 -53
  420. package/dist/shadow/pcf_pd.js.map +1 -1
  421. package/dist/shadow/pcss.js +34 -9
  422. package/dist/shadow/pcss.js.map +1 -1
  423. package/dist/shadow/shadow_impl.js +3 -8
  424. package/dist/shadow/shadow_impl.js.map +1 -1
  425. package/dist/shadow/shadow_region.js +87 -49
  426. package/dist/shadow/shadow_region.js.map +1 -1
  427. package/dist/shadow/shadowmapper.js +93 -53
  428. package/dist/shadow/shadowmapper.js.map +1 -1
  429. package/dist/shadow/ssm.js +18 -72
  430. package/dist/shadow/ssm.js.map +1 -1
  431. package/dist/shadow/vsm.js +3 -3
  432. package/dist/shadow/vsm.js.map +1 -1
  433. package/dist/shapes/shape.js +44 -1
  434. package/dist/shapes/shape.js.map +1 -1
  435. package/dist/utility/buoyancy.js +287 -0
  436. package/dist/utility/buoyancy.js.map +1 -0
  437. package/dist/utility/physical.js +10 -1
  438. package/dist/utility/physical.js.map +1 -1
  439. package/dist/utility/pmrem.js +17 -43
  440. package/dist/utility/pmrem.js.map +1 -1
  441. package/dist/utility/sdf/bake.js +435 -0
  442. package/dist/utility/sdf/bake.js.map +1 -0
  443. package/dist/utility/sdf/bvh.js +576 -0
  444. package/dist/utility/sdf/bvh.js.map +1 -0
  445. package/dist/utility/serialization/manager.js +36 -6
  446. package/dist/utility/serialization/manager.js.map +1 -1
  447. package/dist/utility/serialization/scene/animation.js +77 -7
  448. package/dist/utility/serialization/scene/animation.js.map +1 -1
  449. package/dist/utility/serialization/scene/batch.js +11 -4
  450. package/dist/utility/serialization/scene/batch.js.map +1 -1
  451. package/dist/utility/serialization/scene/camera.js +140 -279
  452. package/dist/utility/serialization/scene/camera.js.map +1 -1
  453. package/dist/utility/serialization/scene/cloth.js +25 -0
  454. package/dist/utility/serialization/scene/cloth.js.map +1 -0
  455. package/dist/utility/serialization/scene/common.js +14 -6
  456. package/dist/utility/serialization/scene/common.js.map +1 -1
  457. package/dist/utility/serialization/scene/foliage.js +821 -0
  458. package/dist/utility/serialization/scene/foliage.js.map +1 -0
  459. package/dist/utility/serialization/scene/hair.js +11 -4
  460. package/dist/utility/serialization/scene/hair.js.map +1 -1
  461. package/dist/utility/serialization/scene/light.js +115 -7
  462. package/dist/utility/serialization/scene/light.js.map +1 -1
  463. package/dist/utility/serialization/scene/material.js +388 -220
  464. package/dist/utility/serialization/scene/material.js.map +1 -1
  465. package/dist/utility/serialization/scene/mesh.js +69 -4
  466. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  467. package/dist/utility/serialization/scene/node.js +140 -5
  468. package/dist/utility/serialization/scene/node.js.map +1 -1
  469. package/dist/utility/serialization/scene/node_physics.js +1318 -0
  470. package/dist/utility/serialization/scene/node_physics.js.map +1 -0
  471. package/dist/utility/serialization/scene/particle.js +11 -4
  472. package/dist/utility/serialization/scene/particle.js.map +1 -1
  473. package/dist/utility/serialization/scene/physics.js +120 -0
  474. package/dist/utility/serialization/scene/physics.js.map +1 -0
  475. package/dist/utility/serialization/scene/primitive.js +124 -10
  476. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  477. package/dist/utility/serialization/scene/scene.js +1687 -51
  478. package/dist/utility/serialization/scene/scene.js.map +1 -1
  479. package/dist/utility/serialization/scene/sprite.js +11 -4
  480. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  481. package/dist/utility/serialization/scene/terrain.js +163 -33
  482. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  483. package/dist/utility/serialization/scene/text.js +11 -4
  484. package/dist/utility/serialization/scene/text.js.map +1 -1
  485. package/dist/utility/serialization/scene/water.js +2473 -114
  486. package/dist/utility/serialization/scene/water.js.map +1 -1
  487. package/dist/utility/serialization/types.js.map +1 -1
  488. package/dist/utility/shprojector.js +97 -109
  489. package/dist/utility/shprojector.js.map +1 -1
  490. package/dist/utility/textures/foam.js +170 -0
  491. package/dist/utility/textures/foam.js.map +1 -0
  492. package/dist/utility/textures/ggxlut.js +17 -43
  493. package/dist/utility/textures/ggxlut.js.map +1 -1
  494. package/dist/utility/textures/ltcdata.js +4 -4
  495. package/dist/utility/textures/ltcdata.js.map +1 -1
  496. package/dist/utility/textures/ltclut.js +16 -6
  497. package/dist/utility/textures/ltclut.js.map +1 -1
  498. package/dist/utility/unsupported.js +24 -0
  499. package/dist/utility/unsupported.js.map +1 -0
  500. package/dist/values.js +13 -1
  501. package/dist/values.js.map +1 -1
  502. package/package.json +25 -12
  503. package/src/asset/loaders/ktx2/basis/LICENSE +201 -0
  504. package/src/asset/loaders/ktx2/basis/basis_transcoder.js +2 -0
  505. package/src/asset/loaders/ktx2/basis/basis_transcoder.wasm +0 -0
  506. package/src/asset/meshoptimizer/LICENSE +21 -0
@@ -1,12 +1,11 @@
1
- import { halton23, Matrix4x4, Vector4, DEPTH_CLEAR_VALUE, DRef, Vector2, REVERSE_Z, Vector3, Ray, Frustum } from '@zephyr3d/base';
1
+ import { halton23, Matrix4x4, Vector4, DEPTH_CLEAR_VALUE, DRef, Vector2, DEBUG_VIEWS, REVERSE_Z, Vector3, Ray, Frustum } from '@zephyr3d/base';
2
2
  import { SceneNode } from '../scene/scene_node.js';
3
3
  import { Compositor } from '../posteffect/compositor.js';
4
4
  import { TAA } from '../posteffect/taa.js';
5
5
  import { SSGI } from '../posteffect/ssgi.js';
6
6
  import { SSR } from '../posteffect/ssr.js';
7
7
  import { SSS } from '../posteffect/sss.js';
8
- import { SkinSSS } from '../posteffect/skinsss.js';
9
- import { SubsurfaceProfile } from '../material/subsurfaceprofile.js';
8
+ import { PostSSS } from '../posteffect/postsss.js';
10
9
  import { Tonemap } from '../posteffect/tonemap.js';
11
10
  import { FXAA } from '../posteffect/fxaa.js';
12
11
  import { Bloom } from '../posteffect/bloom.js';
@@ -20,6 +19,7 @@ import { WeightedBlendedOIT } from '../render/weightedblended_oit.js';
20
19
  import { DualDepthPeelingOIT } from '../render/dualdepthpeeling_oit.js';
21
20
  import { RGHistoryResources } from '../render/rendergraph/history_resources.js';
22
21
  import { calculateEV100, calculatePhysicalExposure } from '../utility/physical.js';
22
+ import { checkDebugViews } from '../render/debug_views.js';
23
23
 
24
24
  const SSGI_QUALITY_PRESET_SETTINGS = {
25
25
  quality: {
@@ -123,8 +123,13 @@ const SSS_QUALITY_PRESET_SETTINGS = {
123
123
  /** @internal Whether to perform a depth pre-pass. */ _depthPrePass;
124
124
  /** @internal Render path selection for scene renderer. */ _renderPath;
125
125
  /** @internal Whether command buffers may be reused for optimization. */ _commandBufferReuse;
126
+ /** @internal Scale of mesh level of detail screen sizes. */ _lodDistanceScale;
127
+ /** @internal Whether meshes are drawn as wireframes in this view. */ _wireframe;
128
+ /** @internal Whether meshes are colored by their level of detail in this view. */ _lodColoration;
126
129
  /** @internal Hi-Z acceleration enable (primarily for SSR). */ _HiZ;
130
+ _HiZNearest;
127
131
  /** @internal Screen-space shadow mask enable (Forward+ deferred shadows). */ _screenSpaceShadowMask;
132
+ /** @internal */ _contactShadows;
128
133
  /** @internal If true, a float point backbuffer will be used. The default value is true */ _HDR;
129
134
  /** @internal Tonemap enable flag (via post effect). */ _toneMap;
130
135
  /** @internal Tonemap post effect reference. */ _postEffectTonemap;
@@ -137,6 +142,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
137
142
  /** @internal Motion blur enable flag (via post effect). */ _motionBlur;
138
143
  /** @internal Motion blur post effect reference. */ _postEffectMotionBlur;
139
144
  /** @internal Motion blur strength. */ _motionBlurStrength;
145
+ /** @internal Motion blur shutter bias. */ _motionBlurShutterBias;
146
+ /** @internal Motion blur maximum streak length in pixels. */ _motionBlurMaxLength;
140
147
  /** @internal Bloom enable flag (via post effect). */ _bloom;
141
148
  /** @internal Bloom post effect reference. */ _postEffectBloom;
142
149
  /** @internal Bloom downsample level cap. */ _bloomMaxDownsampleLevels;
@@ -197,25 +204,13 @@ const SSS_QUALITY_PRESET_SETTINGS = {
197
204
  /** @internal SSS multi-scatter energy compensation. */ _sssMultiScatter;
198
205
  /** @internal Cached runtime SSS settings after applying the quality preset. */ _sssResolvedSettings;
199
206
  /** @internal SSS debug visualization mode. */ _sssDebugView;
200
- /** @internal Skin SSS enable flag (via post effect). */ _skinSSS;
201
- /** @internal Skin SSS post effect reference. */ _postEffectSkinSSS;
202
- /** @internal Skin SSS final blend strength. */ _skinSSSStrength;
203
- /** @internal Skin SSS mask opacity bias. */ _skinSSSOpacity;
204
- /** @internal Skin SSS maximum blur tap spacing in pixels. */ _skinSSSSampleStep;
205
- /** @internal Skin SSS world-space scatter radius. */ _skinSSSScatterRadius;
206
- /** @internal Skin SSS smoothing ("beauty filter") amount. */ _skinSSSSmoothness;
207
- /** @internal Skin SSS depth rejection scale. */ _skinSSSDepthScale;
208
- /** @internal Skin SSS blurred multiplier boost. */ _skinSSSColorBoost;
209
- _skinSSSGlow;
210
- _skinSSSProfilePreset;
211
- _skinSSSProfile;
212
- _skinSSSScatterTint;
207
+ /** @internal Skin SSS post effect reference. */ _postEffectPostSSS;
208
+ _SSSDebugOutput;
213
209
  /** @internal SSAO enable flag (via post effect). */ _SSAO;
214
210
  /** @internal SSAO post effect reference. */ _postEffectSSAO;
215
- /** @internal SSAO scale (sampling radius multiplier). */ _SSAOScale;
211
+ /** @internal SSAO scale (sampling radius multiplier). */ _SSAOOcclusionRadius;
216
212
  /** @internal SSAO bias (self-shadowing reduction). */ _SSAOBias;
217
- /** @internal SSAO sample radius. */ _SSAORadius;
218
- /** @internal SSAO intensity. */ _SSAOIntensity;
213
+ /** @internal SSAO sample radius. */ /** @internal SSAO intensity. */ _SSAOIntensity;
219
214
  /** @internal SSAO blur depth cutoff. */ _SSAOBlurDepthCutoff;
220
215
  /** @internal Pending GPU-pick promise (one-shot). */ _pickResultPromise;
221
216
  /** @internal Resolver for the pending pick promise. */ _pickResultResolve;
@@ -270,7 +265,9 @@ const SSS_QUALITY_PRESET_SETTINGS = {
270
265
  this._screenAdapter = new ScreenAdapter();
271
266
  this._adapted = false;
272
267
  this._HiZ = false;
268
+ this._HiZNearest = false;
273
269
  this._screenSpaceShadowMask = true;
270
+ this._contactShadows = true;
274
271
  this._HDR = true;
275
272
  this._toneMap = true;
276
273
  this._postEffectTonemap = new DRef();
@@ -283,6 +280,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
283
280
  this._motionBlur = false;
284
281
  this._postEffectMotionBlur = new DRef();
285
282
  this._motionBlurStrength = 1;
283
+ this._motionBlurShutterBias = 0.5;
284
+ this._motionBlurMaxLength = 40;
286
285
  this._bloom = false;
287
286
  this._postEffectBloom = new DRef();
288
287
  this._bloomMaxDownsampleLevels = 4;
@@ -354,28 +353,19 @@ const SSS_QUALITY_PRESET_SETTINGS = {
354
353
  };
355
354
  this.updateSSSResolvedSettings();
356
355
  this._sssDebugView = 'none';
357
- this._skinSSS = false;
358
- this._postEffectSkinSSS = new DRef();
359
- this._skinSSSStrength = 1;
360
- this._skinSSSOpacity = 0.18;
361
- this._skinSSSSampleStep = 2;
362
- this._skinSSSScatterRadius = 0.02;
363
- this._skinSSSSmoothness = 0;
364
- this._skinSSSDepthScale = 80;
365
- this._skinSSSColorBoost = 1;
366
- this._skinSSSGlow = 0;
367
- this._skinSSSProfilePreset = 'skin_default';
368
- this._skinSSSProfile = null;
369
- this._skinSSSScatterTint = new Vector4(1, 1, 1, 1);
356
+ this._postEffectPostSSS = new DRef();
357
+ this._SSSDebugOutput = 'none';
370
358
  this._SSAO = false;
371
359
  this._postEffectSSAO = new DRef();
372
- this._SSAOScale = 10;
373
- this._SSAOBias = 1;
374
- this._SSAOIntensity = 0.025;
375
- this._SSAORadius = 100;
360
+ this._SSAOOcclusionRadius = 0.25;
361
+ this._SSAOBias = 0.05;
362
+ this._SSAOIntensity = 1;
376
363
  this._SSAOBlurDepthCutoff = 2;
377
364
  this._pickResult = null;
378
365
  this._commandBufferReuse = true;
366
+ this._lodDistanceScale = 1;
367
+ this._wireframe = false;
368
+ this._lodColoration = false;
379
369
  this._jitteredVPMatrix = new Matrix4x4();
380
370
  this._jitteredInvVPMatrix = new Matrix4x4();
381
371
  this._jitterValue = new Vector2(0, 0);
@@ -443,6 +433,24 @@ const SSS_QUALITY_PRESET_SETTINGS = {
443
433
  this._HiZ = !!val;
444
434
  }
445
435
  /**
436
+ * Whether the Hi-Z pyramid carries its nearest-depth channel.
437
+ *
438
+ * The pyramid's own channel answers "what is the farthest thing in this screen
439
+ * region", which is what occlusion and ray marching want; this one answers
440
+ * "what is the nearest", which is what a proximity query wants. It doubles the
441
+ * pyramid's bandwidth, so it is off unless something asks for it.
442
+ *
443
+ * Materials that query it - water's shoreline foam - turn it on by themselves,
444
+ * the way a transmissive material turns on the scene colour copy, so this only
445
+ * has to be set to force the channel on for something the renderer cannot see
446
+ * coming.
447
+ */ get HiZNearest() {
448
+ return this._HiZNearest;
449
+ }
450
+ set HiZNearest(val) {
451
+ this._HiZNearest = !!val;
452
+ }
453
+ /**
446
454
  * Whether the screen-space shadow mask is enabled.
447
455
  *
448
456
  * When enabled, shadow-casting lights are lit through the clustered pass and
@@ -456,6 +464,18 @@ const SSS_QUALITY_PRESET_SETTINGS = {
456
464
  this._screenSpaceShadowMask = !!val;
457
465
  }
458
466
  /**
467
+ * Whether lights with a non-zero {@link PunctualLight.contactShadowLength}
468
+ * trace contact shadows.
469
+ *
470
+ * Contact shadows are traced inside the screen-space shadow mask, so they
471
+ * also require {@link Camera.screenSpaceShadowMask}.
472
+ */ get contactShadows() {
473
+ return this._contactShadows;
474
+ }
475
+ set contactShadows(val) {
476
+ this._contactShadows = !!val;
477
+ }
478
+ /**
459
479
  * Render path used by the scene renderer.
460
480
  */ get renderPath() {
461
481
  return this._renderPath;
@@ -499,6 +519,38 @@ const SSS_QUALITY_PRESET_SETTINGS = {
499
519
  }
500
520
  }
501
521
  /**
522
+ * How much of the motion blur streak lies ahead of where an object is now,
523
+ * as a fraction of its length. 0 trails the streak fully behind the object,
524
+ * 0.5 (the default) centres it. See {@link MotionBlur.shutterBias}.
525
+ */ get motionBlurShutterBias() {
526
+ return this._motionBlurShutterBias;
527
+ }
528
+ set motionBlurShutterBias(val) {
529
+ this._motionBlurShutterBias = val;
530
+ if (this._postEffectMotionBlur.get()) {
531
+ this._postEffectMotionBlur.get().shutterBias = val;
532
+ // The effect clamps; read it back so the camera and the effect cannot
533
+ // disagree about what was actually applied.
534
+ this._motionBlurShutterBias = this._postEffectMotionBlur.get().shutterBias;
535
+ }
536
+ }
537
+ /**
538
+ * Longest motion blur streak, in pixels at render resolution. This is the
539
+ * ceiling {@link Camera.motionBlurStrength} runs into; raising it costs
540
+ * samples in proportion. See {@link MotionBlur.maxBlurLength}.
541
+ */ get motionBlurMaxLength() {
542
+ return this._motionBlurMaxLength;
543
+ }
544
+ set motionBlurMaxLength(val) {
545
+ this._motionBlurMaxLength = val;
546
+ if (this._postEffectMotionBlur.get()) {
547
+ this._postEffectMotionBlur.get().maxBlurLength = val;
548
+ // The effect clamps; read it back so the camera and the effect cannot
549
+ // disagree about what was actually applied.
550
+ this._motionBlurMaxLength = this._postEffectMotionBlur.get().maxBlurLength;
551
+ }
552
+ }
553
+ /**
502
554
  * Gets whether Bloom is enabled.
503
555
  */ get bloom() {
504
556
  return this._postEffectBloom.get().enabled;
@@ -581,7 +633,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
581
633
  *
582
634
  * @remarks
583
635
  * See {@link Bloom.karisAverage}. On by default; costs a little halo reach in exchange for
584
- * stability on high-frequency speculars.
636
+ * stability on high-frequency speculars. Legacy lighting only: physical lighting always averages
637
+ * linearly.
585
638
  */ get bloomKarisAverage() {
586
639
  return this._bloomKarisAverage;
587
640
  }
@@ -866,7 +919,7 @@ const SSS_QUALITY_PRESET_SETTINGS = {
866
919
  this.invalidateSSGIHistory();
867
920
  }
868
921
  }
869
- /** Pixel stride used by the WebGL linear ray marcher. */ get ssgiStride() {
922
+ /** Pixel stride of the linear ray marcher, used when no Hi-Z pyramid is available. */ get ssgiStride() {
870
923
  return this._ssgiStride;
871
924
  }
872
925
  set ssgiStride(val) {
@@ -886,7 +939,7 @@ const SSS_QUALITY_PRESET_SETTINGS = {
886
939
  this.invalidateSSGIHistory();
887
940
  }
888
941
  }
889
- /** Whether SSGI temporal accumulation is enabled. Has no effect on WebGL1, which has no motion vectors. */ get ssgiTemporal() {
942
+ /** Whether SSGI temporal accumulation is enabled. */ get ssgiTemporal() {
890
943
  return this._ssgiTemporal;
891
944
  }
892
945
  set ssgiTemporal(val) {
@@ -1092,143 +1145,34 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1092
1145
  set sssDebugView(val) {
1093
1146
  this._sssDebugView = val ?? 'none';
1094
1147
  }
1095
- /** Gets whether the dedicated Skin SSS post effect is enabled. */ get skinSSS() {
1096
- return this._postEffectSkinSSS.get().enabled;
1097
- }
1098
- set skinSSS(val) {
1099
- this._postEffectSkinSSS.get().enabled = !!val;
1100
- }
1101
- /** Final blend strength for the dedicated Skin SSS post effect. */ get skinSSSStrength() {
1102
- return this._skinSSSStrength;
1103
- }
1104
- set skinSSSStrength(val) {
1105
- this._skinSSSStrength = Math.max(0, val ?? 0);
1106
- if (this._postEffectSkinSSS.get()) {
1107
- this._postEffectSkinSSS.get().strength = this._skinSSSStrength;
1108
- }
1109
- }
1110
- /** Bias subtracted from the blurred skin mask before compositing. */ get skinSSSOpacity() {
1111
- return this._skinSSSOpacity;
1112
- }
1113
- set skinSSSOpacity(val) {
1114
- this._skinSSSOpacity = Math.max(0, Math.min(1, val ?? 0));
1115
- if (this._postEffectSkinSSS.get()) {
1116
- this._postEffectSkinSSS.get().opacity = this._skinSSSOpacity;
1117
- }
1118
- }
1119
- /** Maximum pixel spacing between blur taps. Caps the projected scatter radius for close-ups. */ get skinSSSSampleStep() {
1120
- return this._skinSSSSampleStep;
1121
- }
1122
- set skinSSSSampleStep(val) {
1123
- this._skinSSSSampleStep = Math.max(0.25, val ?? 0.25);
1124
- if (this._postEffectSkinSSS.get()) {
1125
- this._postEffectSkinSSS.get().sampleStep = this._skinSSSSampleStep;
1126
- }
1127
- }
1128
- /** World-space scatter radius. The blur width shrinks with distance to keep this constant. */ get skinSSSScatterRadius() {
1129
- return this._skinSSSScatterRadius;
1130
- }
1131
- set skinSSSScatterRadius(val) {
1132
- this._skinSSSScatterRadius = Math.max(0, val ?? 0);
1133
- if (this._postEffectSkinSSS.get()) {
1134
- this._postEffectSkinSSS.get().scatterRadius = this._skinSSSScatterRadius;
1135
- }
1136
- }
1137
- /** Skin smoothing ("beauty filter") amount for the dedicated Skin SSS post effect. */ get skinSSSSmoothness() {
1138
- return this._skinSSSSmoothness;
1139
- }
1140
- set skinSSSSmoothness(val) {
1141
- this._skinSSSSmoothness = Math.max(0, Math.min(1, val ?? 0));
1142
- if (this._postEffectSkinSSS.get()) {
1143
- this._postEffectSkinSSS.get().smoothness = this._skinSSSSmoothness;
1144
- }
1145
- }
1146
- /** Depth rejection scale. The reference shader uses 80. */ get skinSSSDepthScale() {
1147
- return this._skinSSSDepthScale;
1148
- }
1149
- set skinSSSDepthScale(val) {
1150
- this._skinSSSDepthScale = Math.max(0, val ?? 0);
1151
- if (this._postEffectSkinSSS.get()) {
1152
- this._postEffectSkinSSS.get().depthScale = this._skinSSSDepthScale;
1153
- }
1154
- }
1155
- /** Multiplier applied to the blurred skin lighting multiplier before compositing. */ get skinSSSColorBoost() {
1156
- return this._skinSSSColorBoost;
1157
- }
1158
- set skinSSSColorBoost(val) {
1159
- this._skinSSSColorBoost = Math.max(0, val ?? 0);
1160
- if (this._postEffectSkinSSS.get()) {
1161
- this._postEffectSkinSSS.get().colorBoost = this._skinSSSColorBoost;
1162
- }
1163
- }
1164
1148
  /**
1165
- * Additive, deliberately non-conserving bleed for the Skin SSS post effect.
1149
+ * Switches the skin diffusion on or off for the coming frame.
1166
1150
  *
1167
1151
  * @remarks
1168
- * 0 (the default) keeps the effect energy conserving: light added to the dark
1169
- * side of the terminator is light removed from the lit side. Raising it adds
1170
- * the diffused term again without subtracting anything, for skin that reads as
1171
- * lit from within; around 1 approximates the look the effect had before it
1172
- * conserved energy.
1173
- */ get skinSSSGlow() {
1174
- return this._skinSSSGlow;
1175
- }
1176
- set skinSSSGlow(val) {
1177
- this._skinSSSGlow = Math.max(0, val ?? 0);
1178
- if (this._postEffectSkinSSS.get()) {
1179
- this._postEffectSkinSSS.get().glow = this._skinSSSGlow;
1180
- }
1181
- }
1182
- /**
1183
- * Subsurface profile preset driving the Skin SSS per-channel scatter radii.
1152
+ * Driven by the render graph from whether the frame actually draws a skin
1153
+ * material, not by the application: an effect with nothing to scatter would
1154
+ * only cost a blit.
1184
1155
  *
1185
- * @remarks
1186
- * The ratio between the red, green and blue radii is what gives a scattering
1187
- * surface its character - red travels furthest in skin, which is the
1188
- * red-to-yellow gradient at the terminator. Switching presets changes that
1189
- * ratio, so `wax` and `jade` are the same code path rather than special cases;
1190
- * {@link Camera.skinSSSScatterRadius} still sets how far the light reaches.
1191
- *
1192
- * Applies to the whole pass. Per-material profiles need the profile-slot path
1193
- * used by {@link SSS} instead.
1194
- */ get skinSSSProfilePreset() {
1195
- return this._skinSSSProfilePreset;
1196
- }
1197
- set skinSSSProfilePreset(val) {
1198
- this._skinSSSProfilePreset = val ?? 'skin_default';
1199
- if (this._skinSSSProfile) {
1200
- this._skinSSSProfile.preset = this._skinSSSProfilePreset;
1201
- }
1202
- if (this._postEffectSkinSSS.get()) {
1203
- this._postEffectSkinSSS.get().profile = this.getSkinSSSProfile();
1204
- }
1205
- }
1206
- /**
1207
- * The profile object backing {@link Camera.skinSSSProfilePreset}, created on
1208
- * first use so that cameras which never enable Skin SSS do not consume one of
1209
- * the 255 global profile slots.
1210
1156
  * @internal
1211
- */ getSkinSSSProfile() {
1212
- if (!this._skinSSSProfile) {
1213
- this._skinSSSProfile = new SubsurfaceProfile();
1214
- this._skinSSSProfile.preset = this._skinSSSProfilePreset;
1157
+ */ setPostSSSActive(active) {
1158
+ const effect = this._postEffectPostSSS.get();
1159
+ if (effect) {
1160
+ effect.enabled = active;
1215
1161
  }
1216
- return this._skinSSSProfile;
1217
1162
  }
1218
1163
  /**
1219
- * Tint applied to the light the Skin SSS post effect redistributes.
1164
+ * Intermediate Skin SSS quantity to visualize instead of the shaded result.
1220
1165
  *
1221
1166
  * @remarks
1222
- * White (the default) leaves the effect energy conserving. Because it
1223
- * multiplies only the difference between the diffused and original diffuse, a
1224
- * warm tint colors the terminator without washing the whole surface.
1225
- */ get skinSSSScatterTint() {
1226
- return this._skinSSSScatterTint;
1167
+ * `'none'` renders normally. Use this to tell an input problem from a kernel
1168
+ * problem when the diffusion does not look right.
1169
+ */ get SSSDebugOutput() {
1170
+ return this._SSSDebugOutput;
1227
1171
  }
1228
- set skinSSSScatterTint(val) {
1229
- this._skinSSSScatterTint.set(val);
1230
- if (this._postEffectSkinSSS.get()) {
1231
- this._postEffectSkinSSS.get().scatterTint = this._skinSSSScatterTint;
1172
+ set SSSDebugOutput(val) {
1173
+ this._SSSDebugOutput = val ?? 'none';
1174
+ if (this._postEffectPostSSS.get()) {
1175
+ this._postEffectPostSSS.get().debugOutput = this._SSSDebugOutput;
1232
1176
  }
1233
1177
  }
1234
1178
  /** @internal */ get ssrParams() {
@@ -1242,13 +1186,19 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1242
1186
  set SSAO(val) {
1243
1187
  this._postEffectSSAO.get().enabled = !!val;
1244
1188
  }
1245
- /** SSAO scale */ get SSAOScale() {
1246
- return this._SSAOScale;
1189
+ /**
1190
+ * SSAO occlusion radius, in world units (metres).
1191
+ *
1192
+ * @remarks
1193
+ * Replaces the old `SSAOScale`, which was a far-plane-relative multiplier and
1194
+ * carried no physical meaning.
1195
+ */ get SSAOOcclusionRadius() {
1196
+ return this._SSAOOcclusionRadius;
1247
1197
  }
1248
- set SSAOScale(val) {
1249
- this._SSAOScale = val;
1198
+ set SSAOOcclusionRadius(val) {
1199
+ this._SSAOOcclusionRadius = val;
1250
1200
  if (this._postEffectSSAO.get()) {
1251
- this._postEffectSSAO.get().scale = val;
1201
+ this._postEffectSSAO.get().occlusionRadius = val;
1252
1202
  }
1253
1203
  }
1254
1204
  /** SSAO bias */ get SSAOBias() {
@@ -1260,15 +1210,6 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1260
1210
  this._postEffectSSAO.get().bias = val;
1261
1211
  }
1262
1212
  }
1263
- /** SSAO radius */ get SSAORadius() {
1264
- return this._SSAORadius;
1265
- }
1266
- set SSAORadius(val) {
1267
- this._SSAORadius = val;
1268
- if (this._postEffectSSAO.get()) {
1269
- this._postEffectSSAO.get().radius = val;
1270
- }
1271
- }
1272
1213
  /** SSAO intensity */ get SSAOIntensity() {
1273
1214
  return this._SSAOIntensity;
1274
1215
  }
@@ -1299,6 +1240,41 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1299
1240
  set commandBufferReuse(val) {
1300
1241
  this._commandBufferReuse = !!val;
1301
1242
  }
1243
+ /**
1244
+ * Scale of the mesh level of detail switch sizes in this view: above 1 meshes switch to
1245
+ * coarser levels closer to the camera, below 1 farther away. Default 1.
1246
+ */ get lodDistanceScale() {
1247
+ return this._lodDistanceScale;
1248
+ }
1249
+ set lodDistanceScale(val) {
1250
+ this._lodDistanceScale = Math.max(0, Number(val) || 0);
1251
+ }
1252
+ /**
1253
+ * Whether everything in this view is drawn as the edges of its triangles, at the level of detail
1254
+ * in use, to inspect geometry; shadows and picking keep the triangles. A debug view, see
1255
+ * DEBUG_VIEWS, not saved with the camera. Default false.
1256
+ */ get wireframe() {
1257
+ return DEBUG_VIEWS && this._wireframe;
1258
+ }
1259
+ set wireframe(val) {
1260
+ if (val) {
1261
+ checkDebugViews('Camera.wireframe');
1262
+ }
1263
+ this._wireframe = !!val;
1264
+ }
1265
+ /**
1266
+ * Whether every mesh of this view is shaded in the color of the level of detail it is drawn at,
1267
+ * white, red, green, blue, yellow, fuchsia, cyan and purple for levels 0 to 7. A debug view, not
1268
+ * saved with the camera; meshes are not batched while it is on. Default false.
1269
+ */ get lodColoration() {
1270
+ return DEBUG_VIEWS && this._lodColoration;
1271
+ }
1272
+ set lodColoration(val) {
1273
+ if (val) {
1274
+ checkDebugViews('Camera.lodColoration');
1275
+ }
1276
+ this._lodColoration = !!val;
1277
+ }
1302
1278
  /** Whether this camera is adapted to screen settins */ get adapted() {
1303
1279
  return this._adapted;
1304
1280
  }
@@ -1689,28 +1665,18 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1689
1665
  this._postEffectSSS.set(sss);
1690
1666
  this._compositor.appendPostEffect(sss);
1691
1667
  }
1692
- if (!this._postEffectSkinSSS.get()) {
1693
- const skinSSS = new SkinSSS();
1694
- skinSSS.enabled = false;
1695
- skinSSS.strength = this._skinSSSStrength;
1696
- skinSSS.opacity = this._skinSSSOpacity;
1697
- skinSSS.sampleStep = this._skinSSSSampleStep;
1698
- skinSSS.scatterRadius = this._skinSSSScatterRadius;
1699
- skinSSS.smoothness = this._skinSSSSmoothness;
1700
- skinSSS.depthScale = this._skinSSSDepthScale;
1701
- skinSSS.colorBoost = this._skinSSSColorBoost;
1702
- skinSSS.glow = this._skinSSSGlow;
1703
- skinSSS.profile = this.getSkinSSSProfile();
1704
- skinSSS.scatterTint = this._skinSSSScatterTint;
1705
- this._postEffectSkinSSS.set(skinSSS);
1706
- this._compositor.appendPostEffect(skinSSS);
1668
+ if (!this._postEffectPostSSS.get()) {
1669
+ const postSSS = new PostSSS();
1670
+ postSSS.enabled = false;
1671
+ postSSS.debugOutput = this._SSSDebugOutput;
1672
+ this._postEffectPostSSS.set(postSSS);
1673
+ this._compositor.appendPostEffect(postSSS);
1707
1674
  }
1708
1675
  if (!this._postEffectSSAO.get()) {
1709
1676
  const ssao = new SAO();
1710
1677
  ssao.enabled = false;
1711
- ssao.scale = this._SSAOScale;
1678
+ ssao.occlusionRadius = this._SSAOOcclusionRadius;
1712
1679
  ssao.bias = this._SSAOBias;
1713
- ssao.radius = this._SSAORadius;
1714
1680
  ssao.intensity = this._SSAOIntensity;
1715
1681
  ssao.blurDepthCutoff = this._SSAOBlurDepthCutoff;
1716
1682
  this._postEffectSSAO.set(ssao);
@@ -1742,6 +1708,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1742
1708
  const motionBlur = new MotionBlur();
1743
1709
  motionBlur.enabled = false;
1744
1710
  motionBlur.strength = this._motionBlurStrength;
1711
+ motionBlur.shutterBias = this._motionBlurShutterBias;
1712
+ motionBlur.maxBlurLength = this._motionBlurMaxLength;
1745
1713
  this._postEffectMotionBlur.set(motionBlur);
1746
1714
  this._compositor.appendPostEffect(motionBlur);
1747
1715
  }
@@ -1925,9 +1893,19 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1925
1893
  return this._pickPosY;
1926
1894
  }
1927
1895
  /**
1928
- * Updates the controller state
1929
- */ updateController() {
1930
- this._controller?.update();
1896
+ * Updates the controller state.
1897
+ *
1898
+ * The scene calls this for its main camera twice per frame, once per phase;
1899
+ * the controller is updated only in the phase it declares. Called without a
1900
+ * phase, the controller is updated unconditionally.
1901
+ *
1902
+ * @param deltaTime - Time since the last frame in seconds; defaults to the device's frame time.
1903
+ * @param phase - Only update a controller whose `updatePhase` is this.
1904
+ */ updateController(deltaTime, phase) {
1905
+ const controller = this._controller;
1906
+ if (controller && (!phase || controller.updatePhase === phase)) {
1907
+ controller.update(deltaTime);
1908
+ }
1931
1909
  }
1932
1910
  /**
1933
1911
  * Reset the controller
@@ -2025,7 +2003,7 @@ const SSS_QUALITY_PRESET_SETTINGS = {
2025
2003
  this._postEffectMotionBlur.dispose();
2026
2004
  this._postEffectSSAO.dispose();
2027
2005
  this._postEffectSSS.dispose();
2028
- this._postEffectSkinSSS.dispose();
2006
+ this._postEffectPostSSS.dispose();
2029
2007
  this._postEffectSSGI.dispose();
2030
2008
  this._postEffectSSR.dispose();
2031
2009
  this._postEffectTAA.dispose();