@zephyr3d/scene 0.6.0 → 0.7.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.
- package/README.md +1 -1
- package/dist/animation/animation.js +149 -27
- package/dist/animation/animation.js.map +1 -1
- package/dist/animation/animationset.js +173 -73
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/animationtrack.js +65 -10
- package/dist/animation/animationtrack.js.map +1 -1
- package/dist/animation/eulerrotationtrack.js +41 -20
- package/dist/animation/eulerrotationtrack.js.map +1 -1
- package/dist/animation/morphtarget.js +14 -38
- package/dist/animation/morphtarget.js.map +1 -1
- package/dist/animation/morphtrack.js +59 -22
- package/dist/animation/morphtrack.js.map +1 -1
- package/dist/animation/proptrack.js +190 -0
- package/dist/animation/proptrack.js.map +1 -0
- package/dist/animation/rotationtrack.js +29 -11
- package/dist/animation/rotationtrack.js.map +1 -1
- package/dist/animation/scaletrack.js +29 -11
- package/dist/animation/scaletrack.js.map +1 -1
- package/dist/animation/skeleton.js +241 -78
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/translationtrack.js +30 -11
- package/dist/animation/translationtrack.js.map +1 -1
- package/dist/app/api.js +43 -0
- package/dist/app/api.js.map +1 -0
- package/dist/app/app.js +153 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/engine.js +312 -0
- package/dist/app/engine.js.map +1 -0
- package/dist/app/inputmgr.js +351 -0
- package/dist/app/inputmgr.js.map +1 -0
- package/dist/app/runtimescript.js +62 -0
- package/dist/app/runtimescript.js.map +1 -0
- package/dist/app/scriptingsystem.js +220 -0
- package/dist/app/scriptingsystem.js.map +1 -0
- package/dist/app/scriptregistry.js +432 -0
- package/dist/app/scriptregistry.js.map +1 -0
- package/dist/asset/assetmanager.js +772 -291
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/builtin.js +7 -43
- package/dist/asset/builtin.js.map +1 -1
- package/dist/asset/loaders/dds/dds.js +17 -93
- package/dist/asset/loaders/dds/dds.js.map +1 -1
- package/dist/asset/loaders/dds/dds_loader.js +8 -18
- package/dist/asset/loaders/dds/dds_loader.js.map +1 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +36 -42
- package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
- package/dist/asset/loaders/gltf/helpers.js +27 -14
- package/dist/asset/loaders/gltf/helpers.js.map +1 -1
- package/dist/asset/loaders/hdr/hdr.js +17 -12
- package/dist/asset/loaders/hdr/hdr.js.map +1 -1
- package/dist/asset/loaders/image/tga_Loader.js +13 -16
- package/dist/asset/loaders/image/tga_Loader.js.map +1 -1
- package/dist/asset/loaders/image/webimage_loader.js +51 -50
- package/dist/asset/loaders/image/webimage_loader.js.map +1 -1
- package/dist/asset/loaders/loader.js.map +1 -1
- package/dist/asset/model.js +158 -4
- package/dist/asset/model.js.map +1 -1
- package/dist/blitter/bilateralblur.js +0 -1
- package/dist/blitter/bilateralblur.js.map +1 -1
- package/dist/blitter/blitter.js +22 -23
- package/dist/blitter/blitter.js.map +1 -1
- package/dist/blitter/box.js.map +1 -1
- package/dist/blitter/copy.js.map +1 -1
- package/dist/blitter/gaussianblur.js +23 -23
- package/dist/blitter/gaussianblur.js.map +1 -1
- package/dist/camera/base.js +141 -34
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +653 -149
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/fps.js +2 -10
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +132 -59
- package/dist/camera/orbit.js.map +1 -1
- package/dist/camera/orthocamera.js +37 -12
- package/dist/camera/orthocamera.js.map +1 -1
- package/dist/camera/perspectivecamera.js +37 -20
- package/dist/camera/perspectivecamera.js.map +1 -1
- package/dist/index.d.ts +18268 -6982
- package/dist/index.js +49 -16
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +5 -0
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/grassmaterial.js +6 -1
- package/dist/material/grassmaterial.js.map +1 -1
- package/dist/material/lambert.js +6 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +346 -73
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +498 -156
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +5 -1
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/foliage.js +3 -3
- package/dist/material/mixins/foliage.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +18 -5
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +6 -6
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +235 -0
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -0
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +52 -15
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +27 -9
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +16 -4
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/brdf.js +134 -0
- package/dist/material/mixins/pbr/brdf.js.map +1 -0
- package/dist/material/mixins/pbr/common.js +68 -85
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mixins/texture.js +98 -83
- package/dist/material/mixins/texture.js.map +1 -1
- package/dist/material/mixins/vertexcolor.js +6 -2
- package/dist/material/mixins/vertexcolor.js.map +1 -1
- package/dist/material/particle.js +272 -0
- package/dist/material/particle.js.map +1 -0
- package/dist/material/pbrblueprint.js +186 -0
- package/dist/material/pbrblueprint.js.map +1 -0
- package/dist/material/pbrmr.js +10 -0
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/pbrsg.js +10 -0
- package/dist/material/pbrsg.js.map +1 -1
- package/dist/material/shader/helper.js +521 -287
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/terrain-cm.js +607 -0
- package/dist/material/terrain-cm.js.map +1 -0
- package/dist/material/terrainmaterial.js +59 -54
- package/dist/material/terrainmaterial.js.map +1 -1
- package/dist/material/unlit.js +5 -0
- package/dist/material/unlit.js.map +1 -1
- package/dist/material/water.js +415 -0
- package/dist/material/water.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +38 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +10 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +127 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +1 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +263 -0
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +1 -0
- package/dist/node_modules/es-module-lexer/dist/lexer.js +5 -0
- package/dist/node_modules/es-module-lexer/dist/lexer.js.map +1 -0
- package/dist/posteffect/bloom.js +39 -54
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/compositor.js +95 -128
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/fxaa.js +10 -18
- package/dist/posteffect/fxaa.js.map +1 -1
- package/dist/posteffect/grayscale.js +9 -17
- package/dist/posteffect/grayscale.js.map +1 -1
- package/dist/posteffect/motionblur.js +105 -0
- package/dist/posteffect/motionblur.js.map +1 -0
- package/dist/posteffect/posteffect.js +66 -35
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/sao.js +13 -21
- package/dist/posteffect/sao.js.map +1 -1
- package/dist/posteffect/ssr.js +60 -100
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/taa.js +175 -0
- package/dist/posteffect/taa.js.map +1 -0
- package/dist/posteffect/tonemap.js +12 -20
- package/dist/posteffect/tonemap.js.map +1 -1
- package/dist/render/abuffer_oit.js +30 -19
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/clipmap.js +429 -101
- package/dist/render/clipmap.js.map +1 -1
- package/dist/render/cluster_light.js +7 -5
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/cull_visitor.js +43 -3
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/depthpass.js +14 -5
- package/dist/render/depthpass.js.map +1 -1
- package/dist/render/drawable_mixin.js +113 -40
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/envlight.js +86 -141
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +234 -0
- package/dist/render/fbm_wavegenerator.js.map +1 -0
- package/dist/render/fft_wavegenerator.js +64 -50
- package/dist/render/fft_wavegenerator.js.map +1 -1
- package/dist/render/fullscreenquad.js +2 -2
- package/dist/render/fullscreenquad.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +98 -48
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +4 -2
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/hzb.js +6 -3
- package/dist/render/hzb.js.map +1 -1
- package/dist/render/lightpass.js +19 -18
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/objectcolorpass.js +4 -4
- package/dist/render/objectcolorpass.js.map +1 -1
- package/dist/render/primitive.js +213 -104
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +40 -20
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderbundle_wrapper.js +65 -15
- package/dist/render/renderbundle_wrapper.js.map +1 -1
- package/dist/render/renderer.js +326 -185
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/renderpass.js +20 -36
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/shadowmap_pass.js +3 -3
- package/dist/render/shadowmap_pass.js.map +1 -1
- package/dist/render/sky.js +864 -541
- package/dist/render/sky.js.map +1 -1
- package/dist/render/weightedblended_oit.js +13 -15
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/batchgroup.js +18 -5
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +78 -48
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/graph_node.js +2 -3
- package/dist/scene/graph_node.js.map +1 -1
- package/dist/scene/light.js +28 -89
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +218 -87
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/octree.js +371 -162
- package/dist/scene/octree.js.map +1 -1
- package/dist/scene/particlesys.js +684 -0
- package/dist/scene/particlesys.js.map +1 -0
- package/dist/scene/raycast_visitor.js +34 -5
- package/dist/scene/raycast_visitor.js.map +1 -1
- package/dist/scene/scene.js +309 -85
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +675 -102
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/terrain/grass.js +48 -49
- package/dist/scene/terrain/grass.js.map +1 -1
- package/dist/scene/terrain/heightfield.js +46 -44
- package/dist/scene/terrain/heightfield.js.map +1 -1
- package/dist/scene/terrain/patch.js +20 -29
- package/dist/scene/terrain/patch.js.map +1 -1
- package/dist/scene/terrain/quadtree.js +58 -27
- package/dist/scene/terrain/quadtree.js.map +1 -1
- package/dist/scene/terrain/terrain.js +31 -45
- package/dist/scene/terrain/terrain.js.map +1 -1
- package/dist/scene/terrain-cm/grass.js +603 -0
- package/dist/scene/terrain-cm/grass.js.map +1 -0
- package/dist/scene/terrain-cm/grassmaterial.js +160 -0
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -0
- package/dist/scene/terrain-cm/terrain-cm.js +533 -0
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -0
- package/dist/scene/water.js +378 -0
- package/dist/scene/water.js.map +1 -0
- package/dist/shaders/atmosphere.js +957 -0
- package/dist/shaders/atmosphere.js.map +1 -0
- package/dist/shaders/fog.js +116 -0
- package/dist/shaders/fog.js.map +1 -0
- package/dist/shaders/misc.js.map +1 -1
- package/dist/shaders/noise.js +217 -8
- package/dist/shaders/noise.js.map +1 -1
- package/dist/shaders/pbr.js.map +1 -1
- package/dist/shaders/shadow.js +8 -8
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shaders/ssr.js +87 -39
- package/dist/shaders/ssr.js.map +1 -1
- package/dist/shaders/temporal.js +216 -0
- package/dist/shaders/temporal.js.map +1 -0
- package/dist/shaders/water.js +42 -20
- package/dist/shaders/water.js.map +1 -1
- package/dist/shadow/esm.js +31 -13
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +12 -13
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +12 -13
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/shader.js +38 -0
- package/dist/shadow/shader.js.map +1 -0
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadowmapper.js +67 -26
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/ssm.js +15 -16
- package/dist/shadow/ssm.js.map +1 -1
- package/dist/shadow/vsm.js +33 -16
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/shapes/box.js +181 -83
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/cylinder.js +101 -43
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +70 -29
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/shape.js +120 -17
- package/dist/shapes/shape.js.map +1 -1
- package/dist/shapes/sphere.js +78 -44
- package/dist/shapes/sphere.js.map +1 -1
- package/dist/shapes/tetrahedron.js +256 -0
- package/dist/shapes/tetrahedron.js.map +1 -0
- package/dist/shapes/torus.js +76 -55
- package/dist/shapes/torus.js.map +1 -1
- package/dist/src/animation/animation.js +127 -0
- package/dist/src/animation/animation.js.map +1 -0
- package/dist/src/animation/animationset.js +255 -0
- package/dist/src/animation/animationset.js.map +1 -0
- package/dist/src/animation/animationtrack.js +34 -0
- package/dist/src/animation/animationtrack.js.map +1 -0
- package/dist/src/animation/eulerrotationtrack.js +52 -0
- package/dist/src/animation/eulerrotationtrack.js.map +1 -0
- package/dist/src/animation/morphtarget.js +93 -0
- package/dist/src/animation/morphtarget.js.map +1 -0
- package/dist/src/animation/morphtrack.js +70 -0
- package/dist/src/animation/morphtrack.js.map +1 -0
- package/dist/src/animation/proptrack.js +161 -0
- package/dist/src/animation/proptrack.js.map +1 -0
- package/dist/src/animation/rotationtrack.js +51 -0
- package/dist/src/animation/rotationtrack.js.map +1 -0
- package/dist/src/animation/scaletrack.js +50 -0
- package/dist/src/animation/scaletrack.js.map +1 -0
- package/dist/src/animation/skeleton.js +204 -0
- package/dist/src/animation/skeleton.js.map +1 -0
- package/dist/src/animation/translationtrack.js +50 -0
- package/dist/src/animation/translationtrack.js.map +1 -0
- package/dist/{app.js → src/app/app.js} +18 -40
- package/dist/src/app/app.js.map +1 -0
- package/dist/{input → src/app}/inputmgr.js +41 -16
- package/dist/src/app/inputmgr.js.map +1 -0
- package/dist/src/asset/assetmanager.js +404 -0
- package/dist/src/asset/assetmanager.js.map +1 -0
- package/dist/src/asset/builtin.js +337 -0
- package/dist/src/asset/builtin.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds.js +470 -0
- package/dist/src/asset/loaders/dds/dds.js.map +1 -0
- package/dist/src/asset/loaders/dds/dds_loader.js +28 -0
- package/dist/src/asset/loaders/dds/dds_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js +1265 -0
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +1 -0
- package/dist/src/asset/loaders/gltf/helpers.js +327 -0
- package/dist/src/asset/loaders/gltf/helpers.js.map +1 -0
- package/dist/src/asset/loaders/hdr/hdr.js +180 -0
- package/dist/src/asset/loaders/hdr/hdr.js.map +1 -0
- package/dist/src/asset/loaders/image/tga_Loader.js +116 -0
- package/dist/src/asset/loaders/image/tga_Loader.js.map +1 -0
- package/dist/src/asset/loaders/image/webimage_loader.js +63 -0
- package/dist/src/asset/loaders/image/webimage_loader.js.map +1 -0
- package/dist/src/asset/loaders/loader.js +45 -0
- package/dist/src/asset/loaders/loader.js.map +1 -0
- package/dist/src/asset/model.js +414 -0
- package/dist/src/asset/model.js.map +1 -0
- package/dist/{blitter/depthlimitedgaussion.js → src/blitter/bilateralblur.js} +1 -2
- package/dist/src/blitter/bilateralblur.js.map +1 -0
- package/dist/src/blitter/blitter.js +390 -0
- package/dist/src/blitter/blitter.js.map +1 -0
- package/dist/src/blitter/box.js +118 -0
- package/dist/src/blitter/box.js.map +1 -0
- package/dist/src/blitter/copy.js +22 -0
- package/dist/src/blitter/copy.js.map +1 -0
- package/dist/src/blitter/gaussianblur.js +228 -0
- package/dist/src/blitter/gaussianblur.js.map +1 -0
- package/dist/src/camera/base.js +92 -0
- package/dist/src/camera/base.js.map +1 -0
- package/dist/src/camera/camera.js +1005 -0
- package/dist/src/camera/camera.js.map +1 -0
- package/dist/src/camera/fps.js +238 -0
- package/dist/src/camera/fps.js.map +1 -0
- package/dist/src/camera/orbit.js +245 -0
- package/dist/src/camera/orbit.js.map +1 -0
- package/dist/src/camera/orthocamera.js +167 -0
- package/dist/src/camera/orthocamera.js.map +1 -0
- package/dist/src/camera/perspectivecamera.js +141 -0
- package/dist/src/camera/perspectivecamera.js.map +1 -0
- package/dist/src/index.js +120 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/material/blinn.js +81 -0
- package/dist/src/material/blinn.js.map +1 -0
- package/dist/src/material/grassmaterial.js +113 -0
- package/dist/src/material/grassmaterial.js.map +1 -0
- package/dist/src/material/lambert.js +92 -0
- package/dist/src/material/lambert.js.map +1 -0
- package/dist/src/material/material.js +301 -0
- package/dist/src/material/material.js.map +1 -0
- package/dist/src/material/meshmaterial.js +704 -0
- package/dist/src/material/meshmaterial.js.map +1 -0
- package/dist/src/material/mixins/albedocolor.js +76 -0
- package/dist/src/material/mixins/albedocolor.js.map +1 -0
- package/dist/src/material/mixins/foliage.js +47 -0
- package/dist/src/material/mixins/foliage.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js +112 -0
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/lambert.js +58 -0
- package/dist/src/material/mixins/lightmodel/lambert.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +178 -0
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +139 -0
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
- package/dist/src/material/mixins/lit.js +476 -0
- package/dist/src/material/mixins/lit.js.map +1 -0
- package/dist/src/material/mixins/pbr/common.js +918 -0
- package/dist/src/material/mixins/pbr/common.js.map +1 -0
- package/dist/src/material/mixins/texture.js +172 -0
- package/dist/src/material/mixins/texture.js.map +1 -0
- package/dist/src/material/mixins/vertexcolor.js +56 -0
- package/dist/src/material/mixins/vertexcolor.js.map +1 -0
- package/dist/src/material/particle.js +178 -0
- package/dist/src/material/particle.js.map +1 -0
- package/dist/src/material/pbrmr.js +97 -0
- package/dist/src/material/pbrmr.js.map +1 -0
- package/dist/src/material/pbrsg.js +97 -0
- package/dist/src/material/pbrsg.js.map +1 -0
- package/dist/src/material/shader/helper.js +1209 -0
- package/dist/src/material/shader/helper.js.map +1 -0
- package/dist/src/material/terrain-cm.js +606 -0
- package/dist/src/material/terrain-cm.js.map +1 -0
- package/dist/src/material/terrainmaterial.js +375 -0
- package/dist/src/material/terrainmaterial.js.map +1 -0
- package/dist/src/material/unlit.js +41 -0
- package/dist/src/material/unlit.js.map +1 -0
- package/dist/src/material/water.js +417 -0
- package/dist/src/material/water.js.map +1 -0
- package/dist/src/posteffect/bloom.js +361 -0
- package/dist/src/posteffect/bloom.js.map +1 -0
- package/dist/src/posteffect/compositor.js +226 -0
- package/dist/src/posteffect/compositor.js.map +1 -0
- package/dist/src/posteffect/fxaa.js +273 -0
- package/dist/src/posteffect/fxaa.js.map +1 -0
- package/dist/src/posteffect/grayscale.js +69 -0
- package/dist/src/posteffect/grayscale.js.map +1 -0
- package/dist/src/posteffect/motionblur.js +96 -0
- package/dist/src/posteffect/motionblur.js.map +1 -0
- package/dist/src/posteffect/posteffect.js +126 -0
- package/dist/src/posteffect/posteffect.js.map +1 -0
- package/dist/src/posteffect/sao.js +324 -0
- package/dist/src/posteffect/sao.js.map +1 -0
- package/dist/src/posteffect/ssr.js +489 -0
- package/dist/src/posteffect/ssr.js.map +1 -0
- package/dist/src/posteffect/taa.js +172 -0
- package/dist/src/posteffect/taa.js.map +1 -0
- package/dist/src/posteffect/tonemap.js +94 -0
- package/dist/src/posteffect/tonemap.js.map +1 -0
- package/dist/src/render/abuffer_oit.js +361 -0
- package/dist/src/render/abuffer_oit.js.map +1 -0
- package/dist/src/render/clipmap.js +851 -0
- package/dist/src/render/clipmap.js.map +1 -0
- package/dist/src/render/cluster_light.js +333 -0
- package/dist/src/render/cluster_light.js.map +1 -0
- package/dist/src/render/cull_visitor.js +187 -0
- package/dist/src/render/cull_visitor.js.map +1 -0
- package/dist/src/render/depthpass.js +68 -0
- package/dist/src/render/depthpass.js.map +1 -0
- package/dist/src/render/drawable_mixin.js +227 -0
- package/dist/src/render/drawable_mixin.js.map +1 -0
- package/dist/src/render/envlight.js +463 -0
- package/dist/src/render/envlight.js.map +1 -0
- package/dist/src/render/fbm_wavegenerator.js +251 -0
- package/dist/src/render/fbm_wavegenerator.js.map +1 -0
- package/dist/src/render/fft_wavegenerator.js +1006 -0
- package/dist/src/render/fft_wavegenerator.js.map +1 -0
- package/dist/src/render/fullscreenquad.js +38 -0
- package/dist/src/render/fullscreenquad.js.map +1 -0
- package/dist/src/render/gerstner_wavegenerator.js +314 -0
- package/dist/src/render/gerstner_wavegenerator.js.map +1 -0
- package/dist/src/render/globalbindgroup_allocator.js +60 -0
- package/dist/src/render/globalbindgroup_allocator.js.map +1 -0
- package/dist/src/render/hzb.js +273 -0
- package/dist/src/render/hzb.js.map +1 -0
- package/dist/src/render/lightpass.js +172 -0
- package/dist/src/render/lightpass.js.map +1 -0
- package/dist/src/render/objectcolorpass.js +51 -0
- package/dist/src/render/objectcolorpass.js.map +1 -0
- package/dist/src/render/primitive.js +364 -0
- package/dist/src/render/primitive.js.map +1 -0
- package/dist/src/render/render_queue.js +467 -0
- package/dist/src/render/render_queue.js.map +1 -0
- package/dist/src/render/renderbundle_wrapper.js +152 -0
- package/dist/src/render/renderbundle_wrapper.js.map +1 -0
- package/dist/src/render/renderer.js +455 -0
- package/dist/src/render/renderer.js.map +1 -0
- package/dist/src/render/renderpass.js +200 -0
- package/dist/src/render/renderpass.js.map +1 -0
- package/dist/src/render/shadowmap_pass.js +56 -0
- package/dist/src/render/shadowmap_pass.js.map +1 -0
- package/dist/src/render/sky.js +1103 -0
- package/dist/src/render/sky.js.map +1 -0
- package/dist/src/render/weightedblended_oit.js +168 -0
- package/dist/src/render/weightedblended_oit.js.map +1 -0
- package/dist/src/scene/batchgroup.js +162 -0
- package/dist/src/scene/batchgroup.js.map +1 -0
- package/dist/src/scene/environment.js +209 -0
- package/dist/src/scene/environment.js.map +1 -0
- package/dist/src/scene/graph_node.js +72 -0
- package/dist/src/scene/graph_node.js.map +1 -0
- package/dist/src/scene/light.js +416 -0
- package/dist/src/scene/light.js.map +1 -0
- package/dist/src/scene/mesh.js +341 -0
- package/dist/src/scene/mesh.js.map +1 -0
- package/dist/src/scene/octree.js +649 -0
- package/dist/src/scene/octree.js.map +1 -0
- package/dist/src/scene/particlesys.js +738 -0
- package/dist/src/scene/particlesys.js.map +1 -0
- package/dist/src/scene/raycast_visitor.js +103 -0
- package/dist/src/scene/raycast_visitor.js.map +1 -0
- package/dist/src/scene/scene.js +284 -0
- package/dist/src/scene/scene.js.map +1 -0
- package/dist/src/scene/scene_node.js +732 -0
- package/dist/src/scene/scene_node.js.map +1 -0
- package/dist/src/scene/terrain/grass.js +278 -0
- package/dist/src/scene/terrain/grass.js.map +1 -0
- package/dist/src/scene/terrain/heightfield.js +475 -0
- package/dist/src/scene/terrain/heightfield.js.map +1 -0
- package/dist/src/scene/terrain/patch.js +530 -0
- package/dist/src/scene/terrain/patch.js.map +1 -0
- package/dist/src/scene/terrain/quadtree.js +461 -0
- package/dist/src/scene/terrain/quadtree.js.map +1 -0
- package/dist/src/scene/terrain/terrain.js +246 -0
- package/dist/src/scene/terrain/terrain.js.map +1 -0
- package/dist/src/scene/terrain-cm/grass.js +594 -0
- package/dist/src/scene/terrain-cm/grass.js.map +1 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js +159 -0
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +1 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js +538 -0
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +1 -0
- package/dist/src/scene/water.js +374 -0
- package/dist/src/scene/water.js.map +1 -0
- package/dist/src/shaders/atmosphere.js +957 -0
- package/dist/src/shaders/atmosphere.js.map +1 -0
- package/dist/src/shaders/fog.js +112 -0
- package/dist/src/shaders/fog.js.map +1 -0
- package/dist/src/shaders/misc.js +266 -0
- package/dist/src/shaders/misc.js.map +1 -0
- package/dist/src/shaders/noise.js +222 -0
- package/dist/src/shaders/noise.js.map +1 -0
- package/dist/src/shaders/pbr.js +51 -0
- package/dist/src/shaders/pbr.js.map +1 -0
- package/dist/src/shaders/shadow.js +636 -0
- package/dist/src/shaders/shadow.js.map +1 -0
- package/dist/src/shaders/ssr.js +490 -0
- package/dist/src/shaders/ssr.js.map +1 -0
- package/dist/src/shaders/temporal.js +215 -0
- package/dist/src/shaders/temporal.js.map +1 -0
- package/dist/src/shaders/water.js +756 -0
- package/dist/src/shaders/water.js.map +1 -0
- package/dist/src/shadow/esm.js +237 -0
- package/dist/src/shadow/esm.js.map +1 -0
- package/dist/src/shadow/pcf_opt.js +181 -0
- package/dist/src/shadow/pcf_opt.js.map +1 -0
- package/dist/src/shadow/pcf_pd.js +189 -0
- package/dist/src/shadow/pcf_pd.js.map +1 -0
- package/dist/src/shadow/shader.js +37 -0
- package/dist/src/shadow/shader.js.map +1 -0
- package/dist/src/shadow/shadow_impl.js +15 -0
- package/dist/src/shadow/shadow_impl.js.map +1 -0
- package/dist/src/shadow/shadowmapper.js +790 -0
- package/dist/src/shadow/shadowmapper.js.map +1 -0
- package/dist/src/shadow/ssm.js +159 -0
- package/dist/src/shadow/ssm.js.map +1 -0
- package/dist/src/shadow/vsm.js +297 -0
- package/dist/src/shadow/vsm.js.map +1 -0
- package/dist/src/shapes/box.js +386 -0
- package/dist/src/shapes/box.js.map +1 -0
- package/dist/src/shapes/cylinder.js +125 -0
- package/dist/src/shapes/cylinder.js.map +1 -0
- package/dist/src/shapes/plane.js +88 -0
- package/dist/src/shapes/plane.js.map +1 -0
- package/dist/src/shapes/shape.js +87 -0
- package/dist/src/shapes/shape.js.map +1 -0
- package/dist/src/shapes/sphere.js +114 -0
- package/dist/src/shapes/sphere.js.map +1 -0
- package/dist/src/shapes/tetrahedron.js +188 -0
- package/dist/src/shapes/tetrahedron.js.map +1 -0
- package/dist/src/shapes/torus.js +111 -0
- package/dist/src/shapes/torus.js.map +1 -0
- package/dist/src/utility/aabbtree.js +400 -0
- package/dist/src/utility/aabbtree.js.map +1 -0
- package/dist/src/utility/bounding_volume.js +29 -0
- package/dist/src/utility/bounding_volume.js.map +1 -0
- package/dist/src/utility/debug.js +28 -0
- package/dist/src/utility/debug.js.map +1 -0
- package/dist/src/utility/draco/decoder.js +116 -0
- package/dist/src/utility/draco/decoder.js.map +1 -0
- package/dist/src/utility/misc.js +105 -0
- package/dist/src/utility/misc.js.map +1 -0
- package/dist/src/utility/panorama.js +163 -0
- package/dist/src/utility/panorama.js.map +1 -0
- package/dist/src/utility/pmrem.js +354 -0
- package/dist/src/utility/pmrem.js.map +1 -0
- package/dist/src/utility/rendermipmap.js +115 -0
- package/dist/src/utility/rendermipmap.js.map +1 -0
- package/dist/src/utility/serialization/json.js +402 -0
- package/dist/src/utility/serialization/json.js.map +1 -0
- package/dist/src/utility/serialization/manager.js +623 -0
- package/dist/src/utility/serialization/manager.js.map +1 -0
- package/dist/src/utility/serialization/scene/animation.js +248 -0
- package/dist/src/utility/serialization/scene/animation.js.map +1 -0
- package/dist/src/utility/serialization/scene/batch.js +59 -0
- package/dist/src/utility/serialization/scene/batch.js.map +1 -0
- package/dist/src/utility/serialization/scene/camera.js +790 -0
- package/dist/src/utility/serialization/scene/camera.js.map +1 -0
- package/dist/src/utility/serialization/scene/common.js +222 -0
- package/dist/src/utility/serialization/scene/common.js.map +1 -0
- package/dist/src/utility/serialization/scene/light.js +575 -0
- package/dist/src/utility/serialization/scene/light.js.map +1 -0
- package/dist/src/utility/serialization/scene/material.js +1111 -0
- package/dist/src/utility/serialization/scene/material.js.map +1 -0
- package/dist/src/utility/serialization/scene/mesh.js +148 -0
- package/dist/src/utility/serialization/scene/mesh.js.map +1 -0
- package/dist/src/utility/serialization/scene/misc.js +39 -0
- package/dist/src/utility/serialization/scene/misc.js.map +1 -0
- package/dist/src/utility/serialization/scene/node.js +451 -0
- package/dist/src/utility/serialization/scene/node.js.map +1 -0
- package/dist/src/utility/serialization/scene/particle.js +425 -0
- package/dist/src/utility/serialization/scene/particle.js.map +1 -0
- package/dist/src/utility/serialization/scene/primitive.js +692 -0
- package/dist/src/utility/serialization/scene/primitive.js.map +1 -0
- package/dist/src/utility/serialization/scene/scene.js +704 -0
- package/dist/src/utility/serialization/scene/scene.js.map +1 -0
- package/dist/src/utility/serialization/scene/terrain.js +488 -0
- package/dist/src/utility/serialization/scene/terrain.js.map +1 -0
- package/dist/src/utility/serialization/scene/water.js +465 -0
- package/dist/src/utility/serialization/scene/water.js.map +1 -0
- package/dist/src/utility/shprojector.js +297 -0
- package/dist/src/utility/shprojector.js.map +1 -0
- package/dist/{material/mixins → src/utility/textures}/ggxlut.js +1 -1
- package/dist/src/utility/textures/ggxlut.js.map +1 -0
- package/dist/src/utility/textures/gradientnoise.js +62 -0
- package/dist/src/utility/textures/gradientnoise.js.map +1 -0
- package/dist/src/utility/textures/randomnoise.js +41 -0
- package/dist/src/utility/textures/randomnoise.js.map +1 -0
- package/dist/src/values.js +162 -0
- package/dist/src/values.js.map +1 -0
- package/dist/utility/aabbtree.js +15 -5
- package/dist/utility/aabbtree.js.map +1 -1
- package/dist/utility/blueprint/common/constants.js +851 -0
- package/dist/utility/blueprint/common/constants.js.map +1 -0
- package/dist/utility/blueprint/common/math.js +2045 -0
- package/dist/utility/blueprint/common/math.js.map +1 -0
- package/dist/utility/blueprint/common.js +7 -0
- package/dist/utility/blueprint/common.js.map +1 -0
- package/dist/utility/blueprint/material/common.js +7 -0
- package/dist/utility/blueprint/material/common.js.map +1 -0
- package/dist/utility/blueprint/material/func.js +521 -0
- package/dist/utility/blueprint/material/func.js.map +1 -0
- package/dist/utility/blueprint/material/inputs.js +1659 -0
- package/dist/utility/blueprint/material/inputs.js.map +1 -0
- package/dist/utility/blueprint/material/ir.js +1311 -0
- package/dist/utility/blueprint/material/ir.js.map +1 -0
- package/dist/utility/blueprint/material/pbr.js +362 -0
- package/dist/utility/blueprint/material/pbr.js.map +1 -0
- package/dist/utility/blueprint/material/texture.js +1099 -0
- package/dist/utility/blueprint/material/texture.js.map +1 -0
- package/dist/utility/blueprint/node.js +187 -0
- package/dist/utility/blueprint/node.js.map +1 -0
- package/dist/utility/bounding_volume.js +0 -1
- package/dist/utility/bounding_volume.js.map +1 -1
- package/dist/utility/debug.js +26 -0
- package/dist/utility/debug.js.map +1 -0
- package/dist/utility/draco/decoder.js +1 -1
- package/dist/utility/draco/decoder.js.map +1 -1
- package/dist/utility/misc.js +18 -6
- package/dist/utility/misc.js.map +1 -1
- package/dist/utility/panorama.js +8 -6
- package/dist/utility/panorama.js.map +1 -1
- package/dist/utility/pmrem.js +30 -18
- package/dist/utility/pmrem.js.map +1 -1
- package/dist/utility/rendermipmap.js +116 -0
- package/dist/utility/rendermipmap.js.map +1 -0
- package/dist/utility/serialization/blueprint/constants.js +255 -0
- package/dist/utility/serialization/blueprint/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/constants.js +203 -0
- package/dist/utility/serialization/blueprint/material/constants.js.map +1 -0
- package/dist/utility/serialization/blueprint/material/texture.js +165 -0
- package/dist/utility/serialization/blueprint/material/texture.js.map +1 -0
- package/dist/utility/serialization/json.js +402 -0
- package/dist/utility/serialization/json.js.map +1 -0
- package/dist/utility/serialization/manager.js +1176 -0
- package/dist/utility/serialization/manager.js.map +1 -0
- package/dist/utility/serialization/scene/animation.js +699 -0
- package/dist/utility/serialization/scene/animation.js.map +1 -0
- package/dist/utility/serialization/scene/batch.js +53 -0
- package/dist/utility/serialization/scene/batch.js.map +1 -0
- package/dist/utility/serialization/scene/camera.js +808 -0
- package/dist/utility/serialization/scene/camera.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +224 -0
- package/dist/utility/serialization/scene/common.js.map +1 -0
- package/dist/utility/serialization/scene/light.js +589 -0
- package/dist/utility/serialization/scene/light.js.map +1 -0
- package/dist/utility/serialization/scene/material.js +942 -0
- package/dist/utility/serialization/scene/material.js.map +1 -0
- package/dist/utility/serialization/scene/mesh.js +374 -0
- package/dist/utility/serialization/scene/mesh.js.map +1 -0
- package/dist/utility/serialization/scene/misc.js +39 -0
- package/dist/utility/serialization/scene/misc.js.map +1 -0
- package/dist/utility/serialization/scene/node.js +391 -0
- package/dist/utility/serialization/scene/node.js.map +1 -0
- package/dist/utility/serialization/scene/particle.js +425 -0
- package/dist/utility/serialization/scene/particle.js.map +1 -0
- package/dist/utility/serialization/scene/primitive.js +582 -0
- package/dist/utility/serialization/scene/primitive.js.map +1 -0
- package/dist/utility/serialization/scene/scene.js +763 -0
- package/dist/utility/serialization/scene/scene.js.map +1 -0
- package/dist/utility/serialization/scene/terrain.js +495 -0
- package/dist/utility/serialization/scene/terrain.js.map +1 -0
- package/dist/utility/serialization/scene/water.js +465 -0
- package/dist/utility/serialization/scene/water.js.map +1 -0
- package/dist/utility/shprojector.js +313 -0
- package/dist/utility/shprojector.js.map +1 -0
- package/dist/utility/textures/ggxlut.js +4 -5
- package/dist/utility/textures/ggxlut.js.map +1 -1
- package/dist/utility/textures/gradientnoise.js +2 -1
- package/dist/utility/textures/gradientnoise.js.map +1 -1
- package/dist/utility/textures/randomnoise.js +1 -0
- package/dist/utility/textures/randomnoise.js.map +1 -1
- package/dist/values.js +91 -4
- package/dist/values.js.map +1 -1
- package/package.json +29 -15
- package/dist/app.js.map +0 -1
- package/dist/blitter/depthlimitedgaussion.js.map +0 -1
- package/dist/input/inputmgr.js.map +0 -1
- package/dist/material/mixins/ggxlut.js.map +0 -1
- package/dist/posteffect/water.js +0 -508
- package/dist/posteffect/water.js.map +0 -1
- package/dist/render/oit.js +0 -16
- package/dist/render/oit.js.map +0 -1
- package/dist/render/scatteringlut.js +0 -634
- package/dist/render/scatteringlut.js.map +0 -1
- package/dist/render/watermesh.js +0 -193
- package/dist/render/watermesh.js.map +0 -1
- package/dist/render/wavegenerator.js +0 -8
- package/dist/render/wavegenerator.js.map +0 -1
- package/dist/scene/xform.js +0 -247
- package/dist/scene/xform.js.map +0 -1
- package/dist/utility/shprojection.js +0 -442
- package/dist/utility/shprojection.js.map +0 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Vector3, Vector2 } from '@zephyr3d/base';
|
|
2
|
+
import { BUILTIN_ASSET_TEXTURE_SHEEN_LUT } from '../values.js';
|
|
3
|
+
import { Application } from '../app/app.js';
|
|
4
|
+
|
|
5
|
+
/** @internal */ function getSheenLutLoader(textureSize) {
|
|
6
|
+
const bits = new Uint32Array(1);
|
|
7
|
+
//Van der Corput radical inverse
|
|
8
|
+
function radicalInverse_VdC(i) {
|
|
9
|
+
bits[0] = i;
|
|
10
|
+
bits[0] = (bits[0] << 16 | bits[0] >> 16) >>> 0;
|
|
11
|
+
bits[0] = (bits[0] & 0x55555555) << 1 | (bits[0] & 0xaaaaaaaa) >>> 1 >>> 0;
|
|
12
|
+
bits[0] = (bits[0] & 0x33333333) << 2 | (bits[0] & 0xcccccccc) >>> 2 >>> 0;
|
|
13
|
+
bits[0] = (bits[0] & 0x0f0f0f0f) << 4 | (bits[0] & 0xf0f0f0f0) >>> 4 >>> 0;
|
|
14
|
+
bits[0] = (bits[0] & 0x00ff00ff) << 8 | (bits[0] & 0xff00ff00) >>> 8 >>> 0;
|
|
15
|
+
return bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296
|
|
16
|
+
}
|
|
17
|
+
function hammersley(i, iN, out) {
|
|
18
|
+
out.setXY(i * iN, radicalInverse_VdC(i));
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
function hammersley(i: number, iN: number, out: Vector2) {
|
|
22
|
+
const tof = 0.5 / 0x80000000;
|
|
23
|
+
let bits = i;
|
|
24
|
+
bits = (bits << 16) | (bits >>> 16);
|
|
25
|
+
bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >>> 1);
|
|
26
|
+
bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >>> 2);
|
|
27
|
+
bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >>> 4);
|
|
28
|
+
bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >>> 8);
|
|
29
|
+
out.setXY(i * iN, (bits >>> 0) * tof);
|
|
30
|
+
}
|
|
31
|
+
*/ /*
|
|
32
|
+
function generateTBN(normal: Vector3, out: Matrix3x3) {
|
|
33
|
+
bitangent.setXYZ(0.0, 1.0, 0.0);
|
|
34
|
+
const NdotUp = Vector3.dot(normal, up);
|
|
35
|
+
const epsilon = 0.0000001;
|
|
36
|
+
if (1.0 - Math.abs(NdotUp) <= epsilon) {
|
|
37
|
+
// Sampling +Y or -Y, so we need a more robust bitangent.
|
|
38
|
+
if (NdotUp > 0.0) {
|
|
39
|
+
bitangent.setXYZ(0.0, 0.0, 1.0);
|
|
40
|
+
} else {
|
|
41
|
+
bitangent.setXYZ(0.0, 0.0, -1.0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
Vector3.cross(bitangent, normal, tangent).inplaceNormalize();
|
|
45
|
+
Vector3.cross(normal, tangent, bitangent);
|
|
46
|
+
out.setCol(0, tangent);
|
|
47
|
+
out.setCol(1, bitangent);
|
|
48
|
+
out.setCol(2, normal);
|
|
49
|
+
}
|
|
50
|
+
function mix(x: number, y: number, a: number): number {
|
|
51
|
+
return x * (1 - a) + y * a;
|
|
52
|
+
}
|
|
53
|
+
function l(x: number, alphaG: number): number {
|
|
54
|
+
const oneMinusAlphaSq = (1 - alphaG) * (1 - alphaG);
|
|
55
|
+
const a = mix(21.5473, 25.3245, oneMinusAlphaSq);
|
|
56
|
+
const b = mix(3.82987, 3.32435, oneMinusAlphaSq);
|
|
57
|
+
const c = mix(0.19823, 0.16801, oneMinusAlphaSq);
|
|
58
|
+
const d = mix(-1.9776, -1.27393, oneMinusAlphaSq);
|
|
59
|
+
const e = mix(-4.32054, -4.85967, oneMinusAlphaSq);
|
|
60
|
+
return a / (1 + b * Math.pow(x, c)) + d * x + e;
|
|
61
|
+
}
|
|
62
|
+
function lambdaSheen(cosTheta: number, alphaG: number): number {
|
|
63
|
+
return Math.abs(cosTheta) < 0.5
|
|
64
|
+
? Math.exp(l(Math.abs(cosTheta), alphaG))
|
|
65
|
+
: Math.exp(2 * l(0.5, alphaG) - l(1 - Math.abs(cosTheta), alphaG));
|
|
66
|
+
}
|
|
67
|
+
function visibilityCharlie(NdotV: number, NdotL: number, a: number): number {
|
|
68
|
+
const alphaG = a;
|
|
69
|
+
return 1 / ((1 + lambdaSheen(NdotV, alphaG) + lambdaSheen(NdotL, alphaG)) * (4 * NdotV * NdotL));
|
|
70
|
+
}
|
|
71
|
+
*/ function distributionCharlie(NdotH, roughness) {
|
|
72
|
+
// roughness = Math.max(roughness, 0.000001);
|
|
73
|
+
const invAlpha = 1 / roughness;
|
|
74
|
+
const cos2h = NdotH * NdotH;
|
|
75
|
+
const sin2h = 1 - cos2h;
|
|
76
|
+
return (2 + invAlpha) * Math.pow(sin2h, invAlpha * 0.5) / (2 * Math.PI);
|
|
77
|
+
}
|
|
78
|
+
/*
|
|
79
|
+
function charlie(xi: Vector2, roughness: number, sample: MicrofacetDistributionSample) {
|
|
80
|
+
const alpha = roughness * roughness;
|
|
81
|
+
sample.sinTheta = Math.pow(xi.y, alpha / (2 * alpha + 1));
|
|
82
|
+
sample.cosTheta = Math.sqrt(1 - sample.sinTheta * sample.sinTheta);
|
|
83
|
+
sample.phi = 2 * Math.PI * xi.x;
|
|
84
|
+
sample.pdf = distributionCharlie(sample.cosTheta, Math.max(alpha, 0.000001)) / 4;
|
|
85
|
+
}
|
|
86
|
+
function getImportanceSample(
|
|
87
|
+
sampleIndex: number,
|
|
88
|
+
sampleCount: number,
|
|
89
|
+
N: Vector3,
|
|
90
|
+
roughness: number,
|
|
91
|
+
out: Vector4
|
|
92
|
+
) {
|
|
93
|
+
// generate a quasi monte carlo point in the unit square [0.1)^2
|
|
94
|
+
hammersley(sampleIndex, 1 / sampleCount, xi);
|
|
95
|
+
// generate the points on the hemisphere with a fitting mapping for
|
|
96
|
+
// the distribution (e.g. lambertian uses a cosine importance)
|
|
97
|
+
charlie(xi, roughness, importanceSample);
|
|
98
|
+
|
|
99
|
+
// transform the hemisphere sample to the normal coordinate frame
|
|
100
|
+
// i.e. rotate the hemisphere to the normal direction
|
|
101
|
+
localSpaceDirection
|
|
102
|
+
.setXYZ(
|
|
103
|
+
importanceSample.sinTheta * Math.cos(importanceSample.phi),
|
|
104
|
+
importanceSample.sinTheta * Math.sin(importanceSample.phi),
|
|
105
|
+
importanceSample.cosTheta
|
|
106
|
+
)
|
|
107
|
+
.inplaceNormalize();
|
|
108
|
+
generateTBN(N, TBN);
|
|
109
|
+
TBN.transform(localSpaceDirection, direction);
|
|
110
|
+
out.setXYZW(direction.x, direction.y, direction.z, importanceSample.pdf);
|
|
111
|
+
}
|
|
112
|
+
function lut(NdotV: number, roughness: number, numSamples: number, out: Vector4) {
|
|
113
|
+
V.setXYZ(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);
|
|
114
|
+
N.setXYZ(0, 0, 1);
|
|
115
|
+
const A = 0;
|
|
116
|
+
const B = 0;
|
|
117
|
+
let C = 0;
|
|
118
|
+
const importanceSample = new Vector4();
|
|
119
|
+
for (let i = 0; i < numSamples; i++) {
|
|
120
|
+
getImportanceSample(i, numSamples, N, roughness, importanceSample);
|
|
121
|
+
H.setXYZ(importanceSample.x, importanceSample.y, importanceSample.z);
|
|
122
|
+
// do reflect L = normalize(reflect(-V, H)) = normalize(-V - 2.0 * dot(H, -V) * H) = normalize(2 * dot(H, V) * H - V)
|
|
123
|
+
Vector3.scale(H, Vector3.dot(V, H) * 2, L)
|
|
124
|
+
.subBy(V)
|
|
125
|
+
.inplaceNormalize();
|
|
126
|
+
const NdotL = Math.min(Math.max(L.z, 0), 1);
|
|
127
|
+
const NdotH = Math.min(Math.max(H.z, 0), 1);
|
|
128
|
+
const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);
|
|
129
|
+
if (NdotL > 0) {
|
|
130
|
+
const sheenDistribution = distributionCharlie(NdotH, roughness);
|
|
131
|
+
// const sheenVisibility = visibilityAshikhmin(NdotV, NdotL);
|
|
132
|
+
const sheenVisibility = visibilityCharlie(NdotV, NdotL, roughness);
|
|
133
|
+
C += sheenVisibility * sheenDistribution * NdotL * VdotH;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
out.setXYZW(4 * A, 4 * B, 4 * 2 * Math.PI * C, 0).scaleBy(1 / numSamples);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function createSheenLUT(): Promise<Texture2D> {
|
|
140
|
+
const tex = Application.instance.device.createTexture2D('rgba8unorm', textureSize, textureSize);
|
|
141
|
+
const image = new Uint8Array(textureSize * textureSize * 4);
|
|
142
|
+
let p = 0;
|
|
143
|
+
const c = new Vector4();
|
|
144
|
+
for (let y = 0; y < textureSize; y++) {
|
|
145
|
+
const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);
|
|
146
|
+
const roughness = coord;
|
|
147
|
+
for (let x = 0; x < textureSize; x++) {
|
|
148
|
+
const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);
|
|
149
|
+
// const c = dfvCharlieUniform(NdotV, roughness, 1024);
|
|
150
|
+
// const c = Math.min(Math.max(Math.round(t * 255), 0), 255);
|
|
151
|
+
lut(NdotV, roughness, 1024, c);
|
|
152
|
+
image[p++] = Math.min(Math.max(Math.round(c.x * 255), 0), 255);
|
|
153
|
+
image[p++] = Math.min(Math.max(Math.round(c.y * 255), 0), 255);
|
|
154
|
+
image[p++] = Math.min(Math.max(Math.round(c.z * 255), 0), 255);
|
|
155
|
+
image[p++] = 255;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
tex.update(image, 0, 0, textureSize, textureSize);
|
|
159
|
+
tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;
|
|
160
|
+
return tex;
|
|
161
|
+
}
|
|
162
|
+
*/ //////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
163
|
+
function visibilityAshikhmin(NdotV, NdotL) {
|
|
164
|
+
return Math.min(Math.max(1 / (4 * (NdotL + NdotV - NdotL * NdotV)), 0), 1);
|
|
165
|
+
}
|
|
166
|
+
function hemisphereUniformSample(u, out) {
|
|
167
|
+
const phi = 2 * Math.PI * u.x;
|
|
168
|
+
const cosTheta = 1 - u.y;
|
|
169
|
+
const sinTheta = Math.sqrt(1 - cosTheta * cosTheta);
|
|
170
|
+
out.setXYZ(sinTheta * Math.cos(phi), sinTheta * Math.sin(phi), cosTheta);
|
|
171
|
+
}
|
|
172
|
+
function dfvCharlieUniform(NdotV, roughness, numSamples) {
|
|
173
|
+
let r = 0;
|
|
174
|
+
const V = new Vector3(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);
|
|
175
|
+
const u = new Vector2();
|
|
176
|
+
const H = new Vector3();
|
|
177
|
+
const L = new Vector3();
|
|
178
|
+
for(let i = 0; i < numSamples; i++){
|
|
179
|
+
hammersley(i, 1 / numSamples, u);
|
|
180
|
+
hemisphereUniformSample(u, H);
|
|
181
|
+
Vector3.scale(H, Vector3.dot(V, H) * 2, L).subBy(V);
|
|
182
|
+
const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);
|
|
183
|
+
const NdotL = Math.min(Math.max(L.z, 0), 1);
|
|
184
|
+
const NdotH = Math.min(Math.max(H.z, 0), 1);
|
|
185
|
+
if (NdotL > 0) {
|
|
186
|
+
const v = visibilityAshikhmin(NdotV, NdotL);
|
|
187
|
+
// const v = visibilityCharlie(NdotV, NdotL, roughness);
|
|
188
|
+
const d = distributionCharlie(NdotH, roughness);
|
|
189
|
+
r += v * d * NdotL * VdotH;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return r * (4 * 2 * Math.PI / numSamples);
|
|
193
|
+
}
|
|
194
|
+
const _tables = function _generateTables() {
|
|
195
|
+
// float32 to float16 helpers
|
|
196
|
+
const buffer = new ArrayBuffer(4);
|
|
197
|
+
const floatView = new Float32Array(buffer);
|
|
198
|
+
const uint32View = new Uint32Array(buffer);
|
|
199
|
+
const baseTable = new Uint32Array(512);
|
|
200
|
+
const shiftTable = new Uint32Array(512);
|
|
201
|
+
for(let i = 0; i < 256; ++i){
|
|
202
|
+
const e = i - 127;
|
|
203
|
+
// very small number (0, -0)
|
|
204
|
+
if (e < -27) {
|
|
205
|
+
baseTable[i] = 0x0000;
|
|
206
|
+
baseTable[i | 0x100] = 0x8000;
|
|
207
|
+
shiftTable[i] = 24;
|
|
208
|
+
shiftTable[i | 0x100] = 24;
|
|
209
|
+
// small number (denorm)
|
|
210
|
+
} else if (e < -14) {
|
|
211
|
+
baseTable[i] = 0x0400 >> -e - 14;
|
|
212
|
+
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
213
|
+
shiftTable[i] = -e - 1;
|
|
214
|
+
shiftTable[i | 0x100] = -e - 1;
|
|
215
|
+
// normal number
|
|
216
|
+
} else if (e <= 15) {
|
|
217
|
+
baseTable[i] = e + 15 << 10;
|
|
218
|
+
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
219
|
+
shiftTable[i] = 13;
|
|
220
|
+
shiftTable[i | 0x100] = 13;
|
|
221
|
+
// large number (Infinity, -Infinity)
|
|
222
|
+
} else if (e < 128) {
|
|
223
|
+
baseTable[i] = 0x7c00;
|
|
224
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
225
|
+
shiftTable[i] = 24;
|
|
226
|
+
shiftTable[i | 0x100] = 24;
|
|
227
|
+
// stay (NaN, Infinity, -Infinity)
|
|
228
|
+
} else {
|
|
229
|
+
baseTable[i] = 0x7c00;
|
|
230
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
231
|
+
shiftTable[i] = 13;
|
|
232
|
+
shiftTable[i | 0x100] = 13;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// float16 to float32 helpers
|
|
236
|
+
const mantissaTable = new Uint32Array(2048);
|
|
237
|
+
const exponentTable = new Uint32Array(64);
|
|
238
|
+
const offsetTable = new Uint32Array(64);
|
|
239
|
+
for(let i = 1; i < 1024; ++i){
|
|
240
|
+
let m = i << 13; // zero pad mantissa bits
|
|
241
|
+
let e = 0; // zero exponent
|
|
242
|
+
// normalized
|
|
243
|
+
while((m & 0x00800000) === 0){
|
|
244
|
+
m <<= 1;
|
|
245
|
+
e -= 0x00800000; // decrement exponent
|
|
246
|
+
}
|
|
247
|
+
m &= -8388609; // clear leading 1 bit
|
|
248
|
+
e += 0x38800000; // adjust bias
|
|
249
|
+
mantissaTable[i] = m | e;
|
|
250
|
+
}
|
|
251
|
+
for(let i = 1024; i < 2048; ++i){
|
|
252
|
+
mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
|
|
253
|
+
}
|
|
254
|
+
for(let i = 1; i < 31; ++i){
|
|
255
|
+
exponentTable[i] = i << 23;
|
|
256
|
+
}
|
|
257
|
+
exponentTable[31] = 0x47800000;
|
|
258
|
+
exponentTable[32] = 0x80000000;
|
|
259
|
+
for(let i = 33; i < 63; ++i){
|
|
260
|
+
exponentTable[i] = 0x80000000 + (i - 32 << 23);
|
|
261
|
+
}
|
|
262
|
+
exponentTable[63] = 0xc7800000;
|
|
263
|
+
for(let i = 1; i < 64; ++i){
|
|
264
|
+
if (i !== 32) {
|
|
265
|
+
offsetTable[i] = 1024;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
floatView: floatView,
|
|
270
|
+
uint32View: uint32View,
|
|
271
|
+
baseTable: baseTable,
|
|
272
|
+
shiftTable: shiftTable,
|
|
273
|
+
mantissaTable: mantissaTable,
|
|
274
|
+
exponentTable: exponentTable,
|
|
275
|
+
offsetTable: offsetTable
|
|
276
|
+
};
|
|
277
|
+
}();
|
|
278
|
+
function encodeF16(val) {
|
|
279
|
+
val = Math.min(Math.max(val, -65504), 65504);
|
|
280
|
+
_tables.floatView[0] = val;
|
|
281
|
+
const f = _tables.uint32View[0];
|
|
282
|
+
const e = f >> 23 & 0x1ff;
|
|
283
|
+
return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);
|
|
284
|
+
}
|
|
285
|
+
/*
|
|
286
|
+
function decodeF16(val: number) {
|
|
287
|
+
const exponent = (val & 0x7c00) >> 10;
|
|
288
|
+
const fraction = val & 0x03ff;
|
|
289
|
+
return (
|
|
290
|
+
(val >> 15 ? -1 : 1) *
|
|
291
|
+
(exponent
|
|
292
|
+
? exponent === 0x1f
|
|
293
|
+
? fraction
|
|
294
|
+
? NaN
|
|
295
|
+
: Infinity
|
|
296
|
+
: Math.pow(2, exponent - 15) * (1 + fraction / 0x400)
|
|
297
|
+
: 6.103515625e-5 * (fraction / 0x400))
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
*/ function createSheenLUTFilament(assetManager, texture) {
|
|
301
|
+
if (texture) {
|
|
302
|
+
if (!texture.isTexture2D()) {
|
|
303
|
+
throw new Error('can not reload sheen lut texture: invalid texture type');
|
|
304
|
+
}
|
|
305
|
+
if (texture.format !== 'rgba16f') {
|
|
306
|
+
throw new Error('can not reload sheen lut texture: invalid texture format');
|
|
307
|
+
}
|
|
308
|
+
if (texture.width !== textureSize || texture.height !== textureSize) {
|
|
309
|
+
throw new Error('can not reload sheen lut texture: invalid texture size');
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const tex = texture || Application.instance.device.createTexture2D('rgba16f', textureSize, textureSize);
|
|
313
|
+
const image = new Uint16Array(textureSize * textureSize * 4);
|
|
314
|
+
let p = 0;
|
|
315
|
+
const one = encodeF16(1);
|
|
316
|
+
for(let y = textureSize - 1; y >= 0; y--){
|
|
317
|
+
const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);
|
|
318
|
+
const roughness = coord * coord;
|
|
319
|
+
for(let x = 0; x < textureSize; x++){
|
|
320
|
+
const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);
|
|
321
|
+
const c = dfvCharlieUniform(NdotV, roughness, 512);
|
|
322
|
+
const f16 = encodeF16(c);
|
|
323
|
+
image[p++] = 0;
|
|
324
|
+
image[p++] = 0;
|
|
325
|
+
image[p++] = f16;
|
|
326
|
+
image[p++] = one;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
tex.update(image, 0, 0, textureSize, textureSize);
|
|
330
|
+
tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;
|
|
331
|
+
return tex;
|
|
332
|
+
}
|
|
333
|
+
return createSheenLUTFilament;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export { getSheenLutLoader };
|
|
337
|
+
//# sourceMappingURL=builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.js","sources":["../../../src/asset/builtin.ts"],"sourcesContent":["import { Vector2, Vector3, Vector4 } from '@zephyr3d/base';\r\nimport { BUILTIN_ASSET_TEXTURE_SHEEN_LUT } from '../values';\r\nimport type { Texture2D, BaseTexture, TextureCube } from '@zephyr3d/device';\r\nimport type { AssetManager } from './assetmanager';\r\nimport { Application } from '../app/app';\r\n\r\n/*\r\ninterface MicrofacetDistributionSample {\r\n pdf?: number;\r\n cosTheta?: number;\r\n sinTheta?: number;\r\n phi?: number;\r\n}\r\n*/\r\n/** @internal */\r\nexport function testCubemapLoader(): TextureCube {\r\n const tex = Application.instance.device.createCubeTexture('rgba8unorm', 32, {\r\n samplerOptions: { mipFilter: 'none' }\r\n });\r\n const fb = Application.instance.device.createFrameBuffer([tex], null);\r\n Application.instance.device.pushDeviceStates();\r\n Application.instance.device.setFramebuffer(fb);\r\n const colors = [\r\n new Vector4(1, 0, 0, 1),\r\n new Vector4(0.2, 0, 0, 1),\r\n new Vector4(0, 1, 0, 1),\r\n new Vector4(0, 0.2, 0, 1),\r\n new Vector4(0, 0, 1, 1),\r\n new Vector4(0, 0, 0.2, 1)\r\n ];\r\n for (let i = 0; i < 6; i++) {\r\n fb.setColorAttachmentCubeFace(0, i);\r\n Application.instance.device.clearFrameBuffer(colors[i], null, null);\r\n }\r\n Application.instance.device.popDeviceStates();\r\n fb.dispose();\r\n\r\n return tex;\r\n}\r\n\r\n/** @internal */\r\nexport function getSheenLutLoader(textureSize: number): (assetManager: AssetManager) => Texture2D {\r\n const bits = new Uint32Array(1);\r\n\r\n //Van der Corput radical inverse\r\n function radicalInverse_VdC(i: number) {\r\n bits[0] = i;\r\n bits[0] = ((bits[0] << 16) | (bits[0] >> 16)) >>> 0;\r\n bits[0] = ((bits[0] & 0x55555555) << 1) | (((bits[0] & 0xaaaaaaaa) >>> 1) >>> 0);\r\n bits[0] = ((bits[0] & 0x33333333) << 2) | (((bits[0] & 0xcccccccc) >>> 2) >>> 0);\r\n bits[0] = ((bits[0] & 0x0f0f0f0f) << 4) | (((bits[0] & 0xf0f0f0f0) >>> 4) >>> 0);\r\n bits[0] = ((bits[0] & 0x00ff00ff) << 8) | (((bits[0] & 0xff00ff00) >>> 8) >>> 0);\r\n return bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296\r\n }\r\n\r\n function hammersley(i: number, iN: number, out: Vector2) {\r\n out.setXY(i * iN, radicalInverse_VdC(i));\r\n }\r\n /*\r\n function hammersley(i: number, iN: number, out: Vector2) {\r\n const tof = 0.5 / 0x80000000;\r\n let bits = i;\r\n bits = (bits << 16) | (bits >>> 16);\r\n bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >>> 1);\r\n bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >>> 2);\r\n bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >>> 4);\r\n bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >>> 8);\r\n out.setXY(i * iN, (bits >>> 0) * tof);\r\n }\r\n */\r\n /*\r\n function generateTBN(normal: Vector3, out: Matrix3x3) {\r\n bitangent.setXYZ(0.0, 1.0, 0.0);\r\n const NdotUp = Vector3.dot(normal, up);\r\n const epsilon = 0.0000001;\r\n if (1.0 - Math.abs(NdotUp) <= epsilon) {\r\n // Sampling +Y or -Y, so we need a more robust bitangent.\r\n if (NdotUp > 0.0) {\r\n bitangent.setXYZ(0.0, 0.0, 1.0);\r\n } else {\r\n bitangent.setXYZ(0.0, 0.0, -1.0);\r\n }\r\n }\r\n Vector3.cross(bitangent, normal, tangent).inplaceNormalize();\r\n Vector3.cross(normal, tangent, bitangent);\r\n out.setCol(0, tangent);\r\n out.setCol(1, bitangent);\r\n out.setCol(2, normal);\r\n }\r\n function mix(x: number, y: number, a: number): number {\r\n return x * (1 - a) + y * a;\r\n }\r\n function l(x: number, alphaG: number): number {\r\n const oneMinusAlphaSq = (1 - alphaG) * (1 - alphaG);\r\n const a = mix(21.5473, 25.3245, oneMinusAlphaSq);\r\n const b = mix(3.82987, 3.32435, oneMinusAlphaSq);\r\n const c = mix(0.19823, 0.16801, oneMinusAlphaSq);\r\n const d = mix(-1.9776, -1.27393, oneMinusAlphaSq);\r\n const e = mix(-4.32054, -4.85967, oneMinusAlphaSq);\r\n return a / (1 + b * Math.pow(x, c)) + d * x + e;\r\n }\r\n function lambdaSheen(cosTheta: number, alphaG: number): number {\r\n return Math.abs(cosTheta) < 0.5\r\n ? Math.exp(l(Math.abs(cosTheta), alphaG))\r\n : Math.exp(2 * l(0.5, alphaG) - l(1 - Math.abs(cosTheta), alphaG));\r\n }\r\n function visibilityCharlie(NdotV: number, NdotL: number, a: number): number {\r\n const alphaG = a;\r\n return 1 / ((1 + lambdaSheen(NdotV, alphaG) + lambdaSheen(NdotL, alphaG)) * (4 * NdotV * NdotL));\r\n }\r\n */\r\n function distributionCharlie(NdotH: number, roughness: number) {\r\n // roughness = Math.max(roughness, 0.000001);\r\n const invAlpha = 1 / roughness;\r\n const cos2h = NdotH * NdotH;\r\n const sin2h = 1 - cos2h;\r\n return ((2 + invAlpha) * Math.pow(sin2h, invAlpha * 0.5)) / (2 * Math.PI);\r\n }\r\n /*\r\n function charlie(xi: Vector2, roughness: number, sample: MicrofacetDistributionSample) {\r\n const alpha = roughness * roughness;\r\n sample.sinTheta = Math.pow(xi.y, alpha / (2 * alpha + 1));\r\n sample.cosTheta = Math.sqrt(1 - sample.sinTheta * sample.sinTheta);\r\n sample.phi = 2 * Math.PI * xi.x;\r\n sample.pdf = distributionCharlie(sample.cosTheta, Math.max(alpha, 0.000001)) / 4;\r\n }\r\n function getImportanceSample(\r\n sampleIndex: number,\r\n sampleCount: number,\r\n N: Vector3,\r\n roughness: number,\r\n out: Vector4\r\n ) {\r\n // generate a quasi monte carlo point in the unit square [0.1)^2\r\n hammersley(sampleIndex, 1 / sampleCount, xi);\r\n // generate the points on the hemisphere with a fitting mapping for\r\n // the distribution (e.g. lambertian uses a cosine importance)\r\n charlie(xi, roughness, importanceSample);\r\n\r\n // transform the hemisphere sample to the normal coordinate frame\r\n // i.e. rotate the hemisphere to the normal direction\r\n localSpaceDirection\r\n .setXYZ(\r\n importanceSample.sinTheta * Math.cos(importanceSample.phi),\r\n importanceSample.sinTheta * Math.sin(importanceSample.phi),\r\n importanceSample.cosTheta\r\n )\r\n .inplaceNormalize();\r\n generateTBN(N, TBN);\r\n TBN.transform(localSpaceDirection, direction);\r\n out.setXYZW(direction.x, direction.y, direction.z, importanceSample.pdf);\r\n }\r\n function lut(NdotV: number, roughness: number, numSamples: number, out: Vector4) {\r\n V.setXYZ(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);\r\n N.setXYZ(0, 0, 1);\r\n const A = 0;\r\n const B = 0;\r\n let C = 0;\r\n const importanceSample = new Vector4();\r\n for (let i = 0; i < numSamples; i++) {\r\n getImportanceSample(i, numSamples, N, roughness, importanceSample);\r\n H.setXYZ(importanceSample.x, importanceSample.y, importanceSample.z);\r\n // do reflect L = normalize(reflect(-V, H)) = normalize(-V - 2.0 * dot(H, -V) * H) = normalize(2 * dot(H, V) * H - V)\r\n Vector3.scale(H, Vector3.dot(V, H) * 2, L)\r\n .subBy(V)\r\n .inplaceNormalize();\r\n const NdotL = Math.min(Math.max(L.z, 0), 1);\r\n const NdotH = Math.min(Math.max(H.z, 0), 1);\r\n const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);\r\n if (NdotL > 0) {\r\n const sheenDistribution = distributionCharlie(NdotH, roughness);\r\n // const sheenVisibility = visibilityAshikhmin(NdotV, NdotL);\r\n const sheenVisibility = visibilityCharlie(NdotV, NdotL, roughness);\r\n C += sheenVisibility * sheenDistribution * NdotL * VdotH;\r\n }\r\n }\r\n out.setXYZW(4 * A, 4 * B, 4 * 2 * Math.PI * C, 0).scaleBy(1 / numSamples);\r\n }\r\n\r\n async function createSheenLUT(): Promise<Texture2D> {\r\n const tex = Application.instance.device.createTexture2D('rgba8unorm', textureSize, textureSize);\r\n const image = new Uint8Array(textureSize * textureSize * 4);\r\n let p = 0;\r\n const c = new Vector4();\r\n for (let y = 0; y < textureSize; y++) {\r\n const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);\r\n const roughness = coord;\r\n for (let x = 0; x < textureSize; x++) {\r\n const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);\r\n // const c = dfvCharlieUniform(NdotV, roughness, 1024);\r\n // const c = Math.min(Math.max(Math.round(t * 255), 0), 255);\r\n lut(NdotV, roughness, 1024, c);\r\n image[p++] = Math.min(Math.max(Math.round(c.x * 255), 0), 255);\r\n image[p++] = Math.min(Math.max(Math.round(c.y * 255), 0), 255);\r\n image[p++] = Math.min(Math.max(Math.round(c.z * 255), 0), 255);\r\n image[p++] = 255;\r\n }\r\n }\r\n tex.update(image, 0, 0, textureSize, textureSize);\r\n tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;\r\n return tex;\r\n }\r\n */\r\n\r\n //////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\r\n function visibilityAshikhmin(NdotV: number, NdotL: number): number {\r\n return Math.min(Math.max(1 / (4 * (NdotL + NdotV - NdotL * NdotV)), 0), 1);\r\n }\r\n\r\n function hemisphereUniformSample(u: Vector2, out: Vector3) {\r\n const phi = 2 * Math.PI * u.x;\r\n const cosTheta = 1 - u.y;\r\n const sinTheta = Math.sqrt(1 - cosTheta * cosTheta);\r\n out.setXYZ(sinTheta * Math.cos(phi), sinTheta * Math.sin(phi), cosTheta);\r\n }\r\n\r\n function dfvCharlieUniform(NdotV: number, roughness: number, numSamples: number): number {\r\n let r = 0;\r\n const V = new Vector3(Math.sqrt(1 - NdotV * NdotV), 0, NdotV);\r\n const u = new Vector2();\r\n const H = new Vector3();\r\n const L = new Vector3();\r\n for (let i = 0; i < numSamples; i++) {\r\n hammersley(i, 1 / numSamples, u);\r\n hemisphereUniformSample(u, H);\r\n Vector3.scale(H, Vector3.dot(V, H) * 2, L).subBy(V);\r\n const VdotH = Math.min(Math.max(Vector3.dot(V, H), 0), 1);\r\n const NdotL = Math.min(Math.max(L.z, 0), 1);\r\n const NdotH = Math.min(Math.max(H.z, 0), 1);\r\n if (NdotL > 0) {\r\n const v = visibilityAshikhmin(NdotV, NdotL);\r\n // const v = visibilityCharlie(NdotV, NdotL, roughness);\r\n const d = distributionCharlie(NdotH, roughness);\r\n r += v * d * NdotL * VdotH;\r\n }\r\n }\r\n return r * ((4 * 2 * Math.PI) / numSamples);\r\n }\r\n\r\n const _tables = (function _generateTables() {\r\n // float32 to float16 helpers\r\n\r\n const buffer = new ArrayBuffer(4);\r\n const floatView = new Float32Array(buffer);\r\n const uint32View = new Uint32Array(buffer);\r\n\r\n const baseTable = new Uint32Array(512);\r\n const shiftTable = new Uint32Array(512);\r\n\r\n for (let i = 0; i < 256; ++i) {\r\n const e = i - 127;\r\n\r\n // very small number (0, -0)\r\n\r\n if (e < -27) {\r\n baseTable[i] = 0x0000;\r\n baseTable[i | 0x100] = 0x8000;\r\n shiftTable[i] = 24;\r\n shiftTable[i | 0x100] = 24;\r\n\r\n // small number (denorm)\r\n } else if (e < -14) {\r\n baseTable[i] = 0x0400 >> (-e - 14);\r\n baseTable[i | 0x100] = (0x0400 >> (-e - 14)) | 0x8000;\r\n shiftTable[i] = -e - 1;\r\n shiftTable[i | 0x100] = -e - 1;\r\n\r\n // normal number\r\n } else if (e <= 15) {\r\n baseTable[i] = (e + 15) << 10;\r\n baseTable[i | 0x100] = ((e + 15) << 10) | 0x8000;\r\n shiftTable[i] = 13;\r\n shiftTable[i | 0x100] = 13;\r\n\r\n // large number (Infinity, -Infinity)\r\n } else if (e < 128) {\r\n baseTable[i] = 0x7c00;\r\n baseTable[i | 0x100] = 0xfc00;\r\n shiftTable[i] = 24;\r\n shiftTable[i | 0x100] = 24;\r\n\r\n // stay (NaN, Infinity, -Infinity)\r\n } else {\r\n baseTable[i] = 0x7c00;\r\n baseTable[i | 0x100] = 0xfc00;\r\n shiftTable[i] = 13;\r\n shiftTable[i | 0x100] = 13;\r\n }\r\n }\r\n\r\n // float16 to float32 helpers\r\n\r\n const mantissaTable = new Uint32Array(2048);\r\n const exponentTable = new Uint32Array(64);\r\n const offsetTable = new Uint32Array(64);\r\n\r\n for (let i = 1; i < 1024; ++i) {\r\n let m = i << 13; // zero pad mantissa bits\r\n let e = 0; // zero exponent\r\n\r\n // normalized\r\n while ((m & 0x00800000) === 0) {\r\n m <<= 1;\r\n e -= 0x00800000; // decrement exponent\r\n }\r\n\r\n m &= ~0x00800000; // clear leading 1 bit\r\n e += 0x38800000; // adjust bias\r\n\r\n mantissaTable[i] = m | e;\r\n }\r\n\r\n for (let i = 1024; i < 2048; ++i) {\r\n mantissaTable[i] = 0x38000000 + ((i - 1024) << 13);\r\n }\r\n\r\n for (let i = 1; i < 31; ++i) {\r\n exponentTable[i] = i << 23;\r\n }\r\n\r\n exponentTable[31] = 0x47800000;\r\n exponentTable[32] = 0x80000000;\r\n\r\n for (let i = 33; i < 63; ++i) {\r\n exponentTable[i] = 0x80000000 + ((i - 32) << 23);\r\n }\r\n\r\n exponentTable[63] = 0xc7800000;\r\n\r\n for (let i = 1; i < 64; ++i) {\r\n if (i !== 32) {\r\n offsetTable[i] = 1024;\r\n }\r\n }\r\n\r\n return {\r\n floatView: floatView,\r\n uint32View: uint32View,\r\n baseTable: baseTable,\r\n shiftTable: shiftTable,\r\n mantissaTable: mantissaTable,\r\n exponentTable: exponentTable,\r\n offsetTable: offsetTable\r\n };\r\n })();\r\n\r\n function encodeF16(val: number): number {\r\n val = Math.min(Math.max(val, -65504), 65504);\r\n _tables.floatView[0] = val;\r\n const f = _tables.uint32View[0];\r\n const e = (f >> 23) & 0x1ff;\r\n return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);\r\n }\r\n\r\n /*\r\n function decodeF16(val: number) {\r\n const exponent = (val & 0x7c00) >> 10;\r\n const fraction = val & 0x03ff;\r\n return (\r\n (val >> 15 ? -1 : 1) *\r\n (exponent\r\n ? exponent === 0x1f\r\n ? fraction\r\n ? NaN\r\n : Infinity\r\n : Math.pow(2, exponent - 15) * (1 + fraction / 0x400)\r\n : 6.103515625e-5 * (fraction / 0x400))\r\n );\r\n }\r\n */\r\n\r\n function createSheenLUTFilament(assetManager: AssetManager, texture?: BaseTexture): Texture2D {\r\n if (texture) {\r\n if (!texture.isTexture2D()) {\r\n throw new Error('can not reload sheen lut texture: invalid texture type');\r\n }\r\n if (texture.format !== 'rgba16f') {\r\n throw new Error('can not reload sheen lut texture: invalid texture format');\r\n }\r\n if (texture.width !== textureSize || texture.height !== textureSize) {\r\n throw new Error('can not reload sheen lut texture: invalid texture size');\r\n }\r\n }\r\n const tex =\r\n (texture as Texture2D) ||\r\n Application.instance.device.createTexture2D('rgba16f', textureSize, textureSize);\r\n const image = new Uint16Array(textureSize * textureSize * 4);\r\n let p = 0;\r\n const one = encodeF16(1);\r\n for (let y = textureSize - 1; y >= 0; y--) {\r\n const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);\r\n const roughness = coord * coord;\r\n for (let x = 0; x < textureSize; x++) {\r\n const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);\r\n const c = dfvCharlieUniform(NdotV, roughness, 512);\r\n const f16 = encodeF16(c);\r\n image[p++] = 0;\r\n image[p++] = 0;\r\n image[p++] = f16;\r\n image[p++] = one;\r\n }\r\n }\r\n tex.update(image, 0, 0, textureSize, textureSize);\r\n tex.name = `builtin:${BUILTIN_ASSET_TEXTURE_SHEEN_LUT}`;\r\n return tex;\r\n }\r\n\r\n return createSheenLUTFilament;\r\n}\r\n"],"names":["getSheenLutLoader","textureSize","bits","Uint32Array","radicalInverse_VdC","i","hammersley","iN","out","setXY","distributionCharlie","NdotH","roughness","invAlpha","cos2h","sin2h","Math","pow","PI","visibilityAshikhmin","NdotV","NdotL","min","max","hemisphereUniformSample","u","phi","x","cosTheta","y","sinTheta","sqrt","setXYZ","cos","sin","dfvCharlieUniform","numSamples","r","V","Vector3","Vector2","H","L","scale","dot","subBy","VdotH","z","v","d","_tables","_generateTables","buffer","ArrayBuffer","floatView","Float32Array","uint32View","baseTable","shiftTable","e","mantissaTable","exponentTable","offsetTable","m","encodeF16","val","f","createSheenLUTFilament","assetManager","texture","isTexture2D","Error","format","width","height","tex","Application","instance","device","createTexture2D","image","Uint16Array","p","one","coord","c","f16","update","name","BUILTIN_ASSET_TEXTURE_SHEEN_LUT"],"mappings":";;;;AAwCA,iBACO,SAASA,iBAAAA,CAAkBC,WAAmB,EAAA;IACnD,MAAMC,IAAAA,GAAO,IAAIC,WAAY,CAAA,CAAA,CAAA;;AAG7B,IAAA,SAASC,mBAAmBC,CAAS,EAAA;QACnCH,IAAI,CAAC,EAAE,GAAGG,CAAAA;AACVH,QAAAA,IAAI,CAAC,CAAE,CAAA,GAAG,CAAC,IAAK,CAAC,CAAE,CAAA,IAAI,KAAOA,IAAI,CAAC,CAAE,CAAA,IAAI,EAAE,MAAO,CAAA;QAClDA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;QAC9EA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;QAC9EA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;QAC9EA,IAAI,CAAC,EAAE,GAAKA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,KAAM,CAAM,GAAEA,CAAAA,IAAI,CAAC,EAAE,GAAG,UAAS,MAAO,CAAO,KAAA,CAAA;AAC9E,QAAA,OAAOA,IAAI,CAAC,CAAE,CAAA,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