@zephyr3d/scene 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/material/msdf_text.js +3 -3
- package/dist/material/msdf_text.js.map +1 -1
- package/dist/text/font/cff_font.js +890 -0
- package/dist/text/font/cff_font.js.map +1 -0
- package/dist/text/font/font_asset.js +17 -3
- package/dist/text/font/font_asset.js.map +1 -1
- package/package.json +1 -1
- package/dist/animation/ik/ik_chain_builder.js +0 -68
- package/dist/animation/ik/ik_chain_builder.js.map +0 -1
- package/dist/animation/ik/ik_pole_constraint.js +0 -123
- package/dist/animation/ik/ik_pole_constraint.js.map +0 -1
- package/dist/animation/ik/ik_track.js +0 -96
- package/dist/animation/ik/ik_track.js.map +0 -1
- package/dist/animation/ik_postprocessor.js +0 -71
- package/dist/animation/ik_postprocessor.js.map +0 -1
- package/dist/animation/joint_dynamics/math.js +0 -16
- package/dist/animation/joint_dynamics/math.js.map +0 -1
- package/dist/animation/manual_transform_processor.js +0 -156
- package/dist/animation/manual_transform_processor.js.map +0 -1
- package/dist/animation/skeleton_postprocessor.js +0 -50
- package/dist/animation/skeleton_postprocessor.js.map +0 -1
- package/dist/animation/spring2/collision.js +0 -469
- package/dist/animation/spring2/collision.js.map +0 -1
- package/dist/animation/spring2/constraints.js +0 -329
- package/dist/animation/spring2/constraints.js.map +0 -1
- package/dist/animation/spring2/controller.js +0 -434
- package/dist/animation/spring2/controller.js.map +0 -1
- package/dist/animation/spring2/math.js +0 -16
- package/dist/animation/spring2/math.js.map +0 -1
- package/dist/animation/spring2/solver.js +0 -624
- package/dist/animation/spring2/solver.js.map +0 -1
- package/dist/animation/spring2/spring_system.js +0 -118
- package/dist/animation/spring2/spring_system.js.map +0 -1
- package/dist/animation/spring2/types.js +0 -19
- package/dist/animation/spring2/types.js.map +0 -1
- package/dist/animation/spring_postprocessor.js +0 -54
- package/dist/animation/spring_postprocessor.js.map +0 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +0 -1276
- package/dist/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/asset/loaders/gltf/helpers.js +0 -331
- package/dist/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/material/sprite3d.js +0 -301
- package/dist/material/sprite3d.js.map +0 -1
- package/dist/material/sprite3d_std.js +0 -116
- package/dist/material/sprite3d_std.js.map +0 -1
- package/dist/material/sprite3dblueprint.js +0 -235
- package/dist/material/sprite3dblueprint.js.map +0 -1
- package/dist/material/sprite_sdf.js +0 -106
- package/dist/material/sprite_sdf.js.map +0 -1
- package/dist/material/terrainmaterial.js +0 -368
- package/dist/material/terrainmaterial.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
- package/dist/render/deferredlightpass.js +0 -510
- package/dist/render/deferredlightpass.js.map +0 -1
- package/dist/render/deferredshadowlightpass.js +0 -428
- package/dist/render/deferredshadowlightpass.js.map +0 -1
- package/dist/render/gbufferpass.js +0 -50
- package/dist/render/gbufferpass.js.map +0 -1
- package/dist/scene/sdftextsprite.js +0 -322
- package/dist/scene/sdftextsprite.js.map +0 -1
- package/dist/scene/sprite3d.js +0 -18
- package/dist/scene/sprite3d.js.map +0 -1
- package/dist/scene/terrain/grass.js +0 -280
- package/dist/scene/terrain/grass.js.map +0 -1
- package/dist/scene/terrain/heightfield.js +0 -475
- package/dist/scene/terrain/heightfield.js.map +0 -1
- package/dist/scene/terrain/patch.js +0 -532
- package/dist/scene/terrain/patch.js.map +0 -1
- package/dist/scene/terrain/quadtree.js +0 -461
- package/dist/scene/terrain/quadtree.js.map +0 -1
- package/dist/scene/terrain/terrain.js +0 -231
- package/dist/scene/terrain/terrain.js.map +0 -1
- package/dist/src/animation/animation.js +0 -127
- package/dist/src/animation/animation.js.map +0 -1
- package/dist/src/animation/animationset.js +0 -255
- package/dist/src/animation/animationset.js.map +0 -1
- package/dist/src/animation/animationtrack.js +0 -34
- package/dist/src/animation/animationtrack.js.map +0 -1
- package/dist/src/animation/eulerrotationtrack.js +0 -52
- package/dist/src/animation/eulerrotationtrack.js.map +0 -1
- package/dist/src/animation/morphtarget.js +0 -93
- package/dist/src/animation/morphtarget.js.map +0 -1
- package/dist/src/animation/morphtrack.js +0 -70
- package/dist/src/animation/morphtrack.js.map +0 -1
- package/dist/src/animation/proptrack.js +0 -161
- package/dist/src/animation/proptrack.js.map +0 -1
- package/dist/src/animation/rotationtrack.js +0 -51
- package/dist/src/animation/rotationtrack.js.map +0 -1
- package/dist/src/animation/scaletrack.js +0 -50
- package/dist/src/animation/scaletrack.js.map +0 -1
- package/dist/src/animation/skeleton.js +0 -204
- package/dist/src/animation/skeleton.js.map +0 -1
- package/dist/src/animation/translationtrack.js +0 -50
- package/dist/src/animation/translationtrack.js.map +0 -1
- package/dist/src/app/app.js +0 -129
- package/dist/src/app/app.js.map +0 -1
- package/dist/src/app/inputmgr.js +0 -267
- package/dist/src/app/inputmgr.js.map +0 -1
- package/dist/src/asset/assetmanager.js +0 -404
- package/dist/src/asset/assetmanager.js.map +0 -1
- package/dist/src/asset/builtin.js +0 -337
- package/dist/src/asset/builtin.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds.js +0 -470
- package/dist/src/asset/loaders/dds/dds.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
- package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/helpers.js +0 -327
- package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/src/asset/loaders/hdr/hdr.js +0 -180
- package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
- package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
- package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
- package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
- package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
- package/dist/src/asset/loaders/loader.js +0 -45
- package/dist/src/asset/loaders/loader.js.map +0 -1
- package/dist/src/asset/model.js +0 -414
- package/dist/src/asset/model.js.map +0 -1
- package/dist/src/blitter/bilateralblur.js +0 -221
- package/dist/src/blitter/bilateralblur.js.map +0 -1
- package/dist/src/blitter/blitter.js +0 -390
- package/dist/src/blitter/blitter.js.map +0 -1
- package/dist/src/blitter/box.js +0 -118
- package/dist/src/blitter/box.js.map +0 -1
- package/dist/src/blitter/copy.js +0 -22
- package/dist/src/blitter/copy.js.map +0 -1
- package/dist/src/blitter/gaussianblur.js +0 -228
- package/dist/src/blitter/gaussianblur.js.map +0 -1
- package/dist/src/camera/base.js +0 -92
- package/dist/src/camera/base.js.map +0 -1
- package/dist/src/camera/camera.js +0 -1005
- package/dist/src/camera/camera.js.map +0 -1
- package/dist/src/camera/fps.js +0 -238
- package/dist/src/camera/fps.js.map +0 -1
- package/dist/src/camera/orbit.js +0 -245
- package/dist/src/camera/orbit.js.map +0 -1
- package/dist/src/camera/orthocamera.js +0 -167
- package/dist/src/camera/orthocamera.js.map +0 -1
- package/dist/src/camera/perspectivecamera.js +0 -141
- package/dist/src/camera/perspectivecamera.js.map +0 -1
- package/dist/src/index.js +0 -120
- package/dist/src/index.js.map +0 -1
- package/dist/src/material/blinn.js +0 -81
- package/dist/src/material/blinn.js.map +0 -1
- package/dist/src/material/grassmaterial.js +0 -113
- package/dist/src/material/grassmaterial.js.map +0 -1
- package/dist/src/material/lambert.js +0 -92
- package/dist/src/material/lambert.js.map +0 -1
- package/dist/src/material/material.js +0 -301
- package/dist/src/material/material.js.map +0 -1
- package/dist/src/material/meshmaterial.js +0 -704
- package/dist/src/material/meshmaterial.js.map +0 -1
- package/dist/src/material/mixins/albedocolor.js +0 -76
- package/dist/src/material/mixins/albedocolor.js.map +0 -1
- package/dist/src/material/mixins/foliage.js +0 -47
- package/dist/src/material/mixins/foliage.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
- package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
- package/dist/src/material/mixins/lit.js +0 -476
- package/dist/src/material/mixins/lit.js.map +0 -1
- package/dist/src/material/mixins/pbr/common.js +0 -918
- package/dist/src/material/mixins/pbr/common.js.map +0 -1
- package/dist/src/material/mixins/texture.js +0 -172
- package/dist/src/material/mixins/texture.js.map +0 -1
- package/dist/src/material/mixins/vertexcolor.js +0 -56
- package/dist/src/material/mixins/vertexcolor.js.map +0 -1
- package/dist/src/material/particle.js +0 -178
- package/dist/src/material/particle.js.map +0 -1
- package/dist/src/material/pbrmr.js +0 -97
- package/dist/src/material/pbrmr.js.map +0 -1
- package/dist/src/material/pbrsg.js +0 -97
- package/dist/src/material/pbrsg.js.map +0 -1
- package/dist/src/material/shader/helper.js +0 -1209
- package/dist/src/material/shader/helper.js.map +0 -1
- package/dist/src/material/terrain-cm.js +0 -606
- package/dist/src/material/terrain-cm.js.map +0 -1
- package/dist/src/material/terrainmaterial.js +0 -375
- package/dist/src/material/terrainmaterial.js.map +0 -1
- package/dist/src/material/unlit.js +0 -41
- package/dist/src/material/unlit.js.map +0 -1
- package/dist/src/material/water.js +0 -417
- package/dist/src/material/water.js.map +0 -1
- package/dist/src/posteffect/bloom.js +0 -361
- package/dist/src/posteffect/bloom.js.map +0 -1
- package/dist/src/posteffect/compositor.js +0 -226
- package/dist/src/posteffect/compositor.js.map +0 -1
- package/dist/src/posteffect/fxaa.js +0 -273
- package/dist/src/posteffect/fxaa.js.map +0 -1
- package/dist/src/posteffect/grayscale.js +0 -69
- package/dist/src/posteffect/grayscale.js.map +0 -1
- package/dist/src/posteffect/motionblur.js +0 -96
- package/dist/src/posteffect/motionblur.js.map +0 -1
- package/dist/src/posteffect/posteffect.js +0 -126
- package/dist/src/posteffect/posteffect.js.map +0 -1
- package/dist/src/posteffect/sao.js +0 -324
- package/dist/src/posteffect/sao.js.map +0 -1
- package/dist/src/posteffect/ssr.js +0 -489
- package/dist/src/posteffect/ssr.js.map +0 -1
- package/dist/src/posteffect/taa.js +0 -172
- package/dist/src/posteffect/taa.js.map +0 -1
- package/dist/src/posteffect/tonemap.js +0 -94
- package/dist/src/posteffect/tonemap.js.map +0 -1
- package/dist/src/render/abuffer_oit.js +0 -361
- package/dist/src/render/abuffer_oit.js.map +0 -1
- package/dist/src/render/clipmap.js +0 -851
- package/dist/src/render/clipmap.js.map +0 -1
- package/dist/src/render/cluster_light.js +0 -333
- package/dist/src/render/cluster_light.js.map +0 -1
- package/dist/src/render/cull_visitor.js +0 -187
- package/dist/src/render/cull_visitor.js.map +0 -1
- package/dist/src/render/depthpass.js +0 -68
- package/dist/src/render/depthpass.js.map +0 -1
- package/dist/src/render/drawable_mixin.js +0 -227
- package/dist/src/render/drawable_mixin.js.map +0 -1
- package/dist/src/render/envlight.js +0 -463
- package/dist/src/render/envlight.js.map +0 -1
- package/dist/src/render/fbm_wavegenerator.js +0 -251
- package/dist/src/render/fbm_wavegenerator.js.map +0 -1
- package/dist/src/render/fft_wavegenerator.js +0 -1006
- package/dist/src/render/fft_wavegenerator.js.map +0 -1
- package/dist/src/render/fullscreenquad.js +0 -38
- package/dist/src/render/fullscreenquad.js.map +0 -1
- package/dist/src/render/gerstner_wavegenerator.js +0 -314
- package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
- package/dist/src/render/globalbindgroup_allocator.js +0 -60
- package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
- package/dist/src/render/hzb.js +0 -273
- package/dist/src/render/hzb.js.map +0 -1
- package/dist/src/render/lightpass.js +0 -172
- package/dist/src/render/lightpass.js.map +0 -1
- package/dist/src/render/objectcolorpass.js +0 -51
- package/dist/src/render/objectcolorpass.js.map +0 -1
- package/dist/src/render/primitive.js +0 -364
- package/dist/src/render/primitive.js.map +0 -1
- package/dist/src/render/render_queue.js +0 -467
- package/dist/src/render/render_queue.js.map +0 -1
- package/dist/src/render/renderbundle_wrapper.js +0 -152
- package/dist/src/render/renderbundle_wrapper.js.map +0 -1
- package/dist/src/render/renderer.js +0 -455
- package/dist/src/render/renderer.js.map +0 -1
- package/dist/src/render/renderpass.js +0 -200
- package/dist/src/render/renderpass.js.map +0 -1
- package/dist/src/render/shadowmap_pass.js +0 -56
- package/dist/src/render/shadowmap_pass.js.map +0 -1
- package/dist/src/render/sky.js +0 -1103
- package/dist/src/render/sky.js.map +0 -1
- package/dist/src/render/weightedblended_oit.js +0 -168
- package/dist/src/render/weightedblended_oit.js.map +0 -1
- package/dist/src/scene/batchgroup.js +0 -162
- package/dist/src/scene/batchgroup.js.map +0 -1
- package/dist/src/scene/environment.js +0 -209
- package/dist/src/scene/environment.js.map +0 -1
- package/dist/src/scene/graph_node.js +0 -72
- package/dist/src/scene/graph_node.js.map +0 -1
- package/dist/src/scene/light.js +0 -416
- package/dist/src/scene/light.js.map +0 -1
- package/dist/src/scene/mesh.js +0 -341
- package/dist/src/scene/mesh.js.map +0 -1
- package/dist/src/scene/octree.js +0 -649
- package/dist/src/scene/octree.js.map +0 -1
- package/dist/src/scene/particlesys.js +0 -738
- package/dist/src/scene/particlesys.js.map +0 -1
- package/dist/src/scene/raycast_visitor.js +0 -103
- package/dist/src/scene/raycast_visitor.js.map +0 -1
- package/dist/src/scene/scene.js +0 -284
- package/dist/src/scene/scene.js.map +0 -1
- package/dist/src/scene/scene_node.js +0 -732
- package/dist/src/scene/scene_node.js.map +0 -1
- package/dist/src/scene/terrain/grass.js +0 -278
- package/dist/src/scene/terrain/grass.js.map +0 -1
- package/dist/src/scene/terrain/heightfield.js +0 -475
- package/dist/src/scene/terrain/heightfield.js.map +0 -1
- package/dist/src/scene/terrain/patch.js +0 -530
- package/dist/src/scene/terrain/patch.js.map +0 -1
- package/dist/src/scene/terrain/quadtree.js +0 -461
- package/dist/src/scene/terrain/quadtree.js.map +0 -1
- package/dist/src/scene/terrain/terrain.js +0 -246
- package/dist/src/scene/terrain/terrain.js.map +0 -1
- package/dist/src/scene/terrain-cm/grass.js +0 -594
- package/dist/src/scene/terrain-cm/grass.js.map +0 -1
- package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
- package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
- package/dist/src/scene/water.js +0 -374
- package/dist/src/scene/water.js.map +0 -1
- package/dist/src/shaders/atmosphere.js +0 -957
- package/dist/src/shaders/atmosphere.js.map +0 -1
- package/dist/src/shaders/fog.js +0 -112
- package/dist/src/shaders/fog.js.map +0 -1
- package/dist/src/shaders/misc.js +0 -266
- package/dist/src/shaders/misc.js.map +0 -1
- package/dist/src/shaders/noise.js +0 -222
- package/dist/src/shaders/noise.js.map +0 -1
- package/dist/src/shaders/pbr.js +0 -51
- package/dist/src/shaders/pbr.js.map +0 -1
- package/dist/src/shaders/shadow.js +0 -636
- package/dist/src/shaders/shadow.js.map +0 -1
- package/dist/src/shaders/ssr.js +0 -490
- package/dist/src/shaders/ssr.js.map +0 -1
- package/dist/src/shaders/temporal.js +0 -215
- package/dist/src/shaders/temporal.js.map +0 -1
- package/dist/src/shaders/water.js +0 -756
- package/dist/src/shaders/water.js.map +0 -1
- package/dist/src/shadow/esm.js +0 -237
- package/dist/src/shadow/esm.js.map +0 -1
- package/dist/src/shadow/pcf_opt.js +0 -181
- package/dist/src/shadow/pcf_opt.js.map +0 -1
- package/dist/src/shadow/pcf_pd.js +0 -189
- package/dist/src/shadow/pcf_pd.js.map +0 -1
- package/dist/src/shadow/shader.js +0 -37
- package/dist/src/shadow/shader.js.map +0 -1
- package/dist/src/shadow/shadow_impl.js +0 -15
- package/dist/src/shadow/shadow_impl.js.map +0 -1
- package/dist/src/shadow/shadowmapper.js +0 -790
- package/dist/src/shadow/shadowmapper.js.map +0 -1
- package/dist/src/shadow/ssm.js +0 -159
- package/dist/src/shadow/ssm.js.map +0 -1
- package/dist/src/shadow/vsm.js +0 -297
- package/dist/src/shadow/vsm.js.map +0 -1
- package/dist/src/shapes/box.js +0 -386
- package/dist/src/shapes/box.js.map +0 -1
- package/dist/src/shapes/cylinder.js +0 -125
- package/dist/src/shapes/cylinder.js.map +0 -1
- package/dist/src/shapes/plane.js +0 -88
- package/dist/src/shapes/plane.js.map +0 -1
- package/dist/src/shapes/shape.js +0 -87
- package/dist/src/shapes/shape.js.map +0 -1
- package/dist/src/shapes/sphere.js +0 -114
- package/dist/src/shapes/sphere.js.map +0 -1
- package/dist/src/shapes/tetrahedron.js +0 -188
- package/dist/src/shapes/tetrahedron.js.map +0 -1
- package/dist/src/shapes/torus.js +0 -111
- package/dist/src/shapes/torus.js.map +0 -1
- package/dist/src/utility/aabbtree.js +0 -400
- package/dist/src/utility/aabbtree.js.map +0 -1
- package/dist/src/utility/bounding_volume.js +0 -29
- package/dist/src/utility/bounding_volume.js.map +0 -1
- package/dist/src/utility/debug.js +0 -28
- package/dist/src/utility/debug.js.map +0 -1
- package/dist/src/utility/draco/decoder.js +0 -116
- package/dist/src/utility/draco/decoder.js.map +0 -1
- package/dist/src/utility/misc.js +0 -105
- package/dist/src/utility/misc.js.map +0 -1
- package/dist/src/utility/panorama.js +0 -163
- package/dist/src/utility/panorama.js.map +0 -1
- package/dist/src/utility/pmrem.js +0 -354
- package/dist/src/utility/pmrem.js.map +0 -1
- package/dist/src/utility/rendermipmap.js +0 -115
- package/dist/src/utility/rendermipmap.js.map +0 -1
- package/dist/src/utility/serialization/json.js +0 -402
- package/dist/src/utility/serialization/json.js.map +0 -1
- package/dist/src/utility/serialization/manager.js +0 -623
- package/dist/src/utility/serialization/manager.js.map +0 -1
- package/dist/src/utility/serialization/scene/animation.js +0 -248
- package/dist/src/utility/serialization/scene/animation.js.map +0 -1
- package/dist/src/utility/serialization/scene/batch.js +0 -59
- package/dist/src/utility/serialization/scene/batch.js.map +0 -1
- package/dist/src/utility/serialization/scene/camera.js +0 -790
- package/dist/src/utility/serialization/scene/camera.js.map +0 -1
- package/dist/src/utility/serialization/scene/common.js +0 -222
- package/dist/src/utility/serialization/scene/common.js.map +0 -1
- package/dist/src/utility/serialization/scene/light.js +0 -575
- package/dist/src/utility/serialization/scene/light.js.map +0 -1
- package/dist/src/utility/serialization/scene/material.js +0 -1111
- package/dist/src/utility/serialization/scene/material.js.map +0 -1
- package/dist/src/utility/serialization/scene/mesh.js +0 -148
- package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
- package/dist/src/utility/serialization/scene/misc.js +0 -39
- package/dist/src/utility/serialization/scene/misc.js.map +0 -1
- package/dist/src/utility/serialization/scene/node.js +0 -451
- package/dist/src/utility/serialization/scene/node.js.map +0 -1
- package/dist/src/utility/serialization/scene/particle.js +0 -425
- package/dist/src/utility/serialization/scene/particle.js.map +0 -1
- package/dist/src/utility/serialization/scene/primitive.js +0 -692
- package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
- package/dist/src/utility/serialization/scene/scene.js +0 -704
- package/dist/src/utility/serialization/scene/scene.js.map +0 -1
- package/dist/src/utility/serialization/scene/terrain.js +0 -488
- package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
- package/dist/src/utility/serialization/scene/water.js +0 -465
- package/dist/src/utility/serialization/scene/water.js.map +0 -1
- package/dist/src/utility/shprojector.js +0 -297
- package/dist/src/utility/shprojector.js.map +0 -1
- package/dist/src/utility/textures/ggxlut.js +0 -213
- package/dist/src/utility/textures/ggxlut.js.map +0 -1
- package/dist/src/utility/textures/gradientnoise.js +0 -62
- package/dist/src/utility/textures/gradientnoise.js.map +0 -1
- package/dist/src/utility/textures/randomnoise.js +0 -41
- package/dist/src/utility/textures/randomnoise.js.map +0 -1
- package/dist/src/values.js +0 -162
- package/dist/src/values.js.map +0 -1
- package/dist/utility/blueprint/material/common.js +0 -7
- package/dist/utility/blueprint/material/common.js.map +0 -1
- package/dist/utility/serialization/blueprint/constants.js +0 -255
- package/dist/utility/serialization/blueprint/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/constants.js +0 -203
- package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/texture.js +0 -165
- package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
- package/dist/utility/serialization/scene/cloth_script.js +0 -834
- package/dist/utility/serialization/scene/cloth_script.js.map +0 -1
- package/dist/utility/serialization/scene/spring_script.js +0 -596
- package/dist/utility/serialization/scene/spring_script.js.map +0 -1
package/dist/src/shaders/ssr.js
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
import { ShaderHelper } from '../material/shader/helper.js';
|
|
2
|
-
|
|
3
|
-
const MAX_FLOAT_VALUE = 3.402823466e38;
|
|
4
|
-
/** @internal */ function SSR_calcJitter(scope, viewPos, roughness) {
|
|
5
|
-
const pb = scope.$builder;
|
|
6
|
-
pb.func('SSR_calcJitter', [
|
|
7
|
-
pb.vec3('viewPos'),
|
|
8
|
-
pb.float('roughness')
|
|
9
|
-
], function() {
|
|
10
|
-
this.$l.h = pb.fract(pb.mul(this.viewPos, 0.8));
|
|
11
|
-
this.h = pb.add(this.h, pb.dot(this.h, pb.add(this.h.yxz, pb.vec3(19.19))));
|
|
12
|
-
this.h = pb.fract(pb.mul(pb.add(this.h.xxy, this.h.yxx), this.h.zyx));
|
|
13
|
-
this.h = pb.sub(this.h, pb.vec3(0.5));
|
|
14
|
-
this.$return(pb.mix(pb.vec3(0), this.h, this.roughness));
|
|
15
|
-
});
|
|
16
|
-
return scope.SSR_calcJitter(viewPos, roughness);
|
|
17
|
-
}
|
|
18
|
-
/** @internal */ function invProjectPosition(scope, pos, mat) {
|
|
19
|
-
const pb = scope.$builder;
|
|
20
|
-
pb.func('invProjectPosition', [
|
|
21
|
-
pb.vec3('p'),
|
|
22
|
-
pb.mat4('mat')
|
|
23
|
-
], function() {
|
|
24
|
-
this.$l.c = pb.sub(pb.mul(this.p, 2), pb.vec3(1));
|
|
25
|
-
this.$l.u = pb.mul(this.mat, pb.vec4(this.c, 1));
|
|
26
|
-
this.u = pb.div(this.u, this.u.w);
|
|
27
|
-
this.$return(this.u.xyz);
|
|
28
|
-
});
|
|
29
|
-
return scope.invProjectPosition(pos, mat);
|
|
30
|
-
}
|
|
31
|
-
/** @internal */ function validateHit(scope, hit2D, hit3D, surfaceZ, thickness, uv, traceRay, viewMatrix, invProjMatrix, textureSize, normalTexture) {
|
|
32
|
-
const pb = scope.$builder;
|
|
33
|
-
const funcName = hit3D ? 'SSR_validateHit_HiZ' : 'SSR_validateHit';
|
|
34
|
-
pb.func(funcName, [
|
|
35
|
-
pb.vec2('hit2d'),
|
|
36
|
-
...hit3D ? [
|
|
37
|
-
pb.vec3('hit3d')
|
|
38
|
-
] : [],
|
|
39
|
-
...hit3D ? [
|
|
40
|
-
pb.float('thickness')
|
|
41
|
-
] : [],
|
|
42
|
-
pb.float('surfaceZ'),
|
|
43
|
-
pb.vec2('uv'),
|
|
44
|
-
pb.vec3('viewSpaceRayDirection'),
|
|
45
|
-
pb.mat4('viewMatrix'),
|
|
46
|
-
pb.mat4('invProjMatrix'),
|
|
47
|
-
pb.vec4('textureSize')
|
|
48
|
-
], function() {
|
|
49
|
-
this.$if(pb.or(pb.any(pb.lessThan(this.hit2d, pb.vec2(0))), pb.any(pb.greaterThan(this.hit2d, pb.vec2(1)))), function() {
|
|
50
|
-
this.$return(pb.float(0));
|
|
51
|
-
});
|
|
52
|
-
this.$l.manhattanDist = pb.abs(pb.sub(this.hit2d, this.uv));
|
|
53
|
-
this.$if(pb.all(pb.lessThan(this.manhattanDist, pb.vec2(pb.div(pb.vec2(2), this.textureSize.xy)))), function() {
|
|
54
|
-
this.$return(pb.float(0));
|
|
55
|
-
});
|
|
56
|
-
if (normalTexture) {
|
|
57
|
-
this.$l.hitNormalWS = pb.sub(pb.mul(pb.textureSampleLevel(normalTexture, this.hit2d, 0).rgb, 2), pb.vec3(1));
|
|
58
|
-
this.$l.hitNormalVS = pb.mul(this.viewMatrix, pb.vec4(this.hitNormalWS, 0)).xyz;
|
|
59
|
-
this.$if(pb.greaterThan(pb.dot(this.hitNormalVS, this.viewSpaceRayDirection), 0), function() {
|
|
60
|
-
this.$return(pb.float(0));
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
this.$l.viewSpaceSurface = invProjectPosition(this, pb.vec3(this.hit2d, this.surfaceZ), this.invProjMatrix);
|
|
64
|
-
this.$l.fov = pb.mul(pb.vec2(pb.div(this.textureSize.y, this.textureSize.x), 1), 0.05);
|
|
65
|
-
this.$l.border = pb.mul(pb.smoothStep(pb.vec2(0), this.fov, this.hit2d), pb.sub(pb.vec2(1), pb.smoothStep(pb.sub(pb.vec2(1), this.fov), pb.vec2(1), this.hit2d)));
|
|
66
|
-
this.$l.vignette = pb.mul(this.border.x, this.border.y);
|
|
67
|
-
if (this.hit3d) {
|
|
68
|
-
this.$l.distance = pb.distance(this.viewSpaceSurface, this.hit3d);
|
|
69
|
-
this.$l.confidence = pb.sub(1, pb.smoothStep(0, this.thickness, this.distance));
|
|
70
|
-
this.$return(pb.mul(this.vignette, this.confidence, this.confidence));
|
|
71
|
-
} else {
|
|
72
|
-
this.$return(this.vignette);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return hit3D ? scope[funcName](hit2D, hit3D, thickness, surfaceZ, uv, traceRay, viewMatrix, invProjMatrix, textureSize) : scope[funcName](hit2D, surfaceZ, uv, traceRay, viewMatrix, invProjMatrix, textureSize);
|
|
76
|
-
}
|
|
77
|
-
function screenSpaceRayTracing_Linear2D(scope, viewPos, traceRay, viewMatrix, projMatrix, invProjMatrix, cameraNearFar, maxDistance, maxIterations, thickness, stride, textureSize, linearDepthTex, normalTexture, useBackfaceDepth) {
|
|
78
|
-
const pb = scope.$builder;
|
|
79
|
-
pb.func('distanceSquared', [
|
|
80
|
-
pb.vec2('a'),
|
|
81
|
-
pb.vec2('b')
|
|
82
|
-
], function() {
|
|
83
|
-
this.$l.x = pb.sub(this.a, this.b);
|
|
84
|
-
this.$return(pb.dot(this.x, this.x));
|
|
85
|
-
});
|
|
86
|
-
pb.func('rayIntersectDepth', [
|
|
87
|
-
pb.float('zA'),
|
|
88
|
-
pb.float('zB'),
|
|
89
|
-
pb.float('thickness'),
|
|
90
|
-
pb.vec2('uv'),
|
|
91
|
-
pb.float('cameraFar')
|
|
92
|
-
], function() {
|
|
93
|
-
let thickness = this.thickness;
|
|
94
|
-
if (useBackfaceDepth) {
|
|
95
|
-
this.$l.sceneZ = ShaderHelper.sampleLinearDepthWithBackface(this, linearDepthTex, this.uv, 0);
|
|
96
|
-
this.$l.sceneZMax01 = this.sceneZ.x;
|
|
97
|
-
thickness = pb.max(this.thickness, pb.mul(pb.sub(this.sceneZ.y, this.sceneZ.x), this.cameraFar));
|
|
98
|
-
} else {
|
|
99
|
-
this.$l.sceneZMax01 = ShaderHelper.sampleLinearDepth(this, linearDepthTex, this.uv, 0);
|
|
100
|
-
}
|
|
101
|
-
this.sceneZMax = pb.neg(pb.mul(this.sceneZMax01, this.cameraFar));
|
|
102
|
-
this.$return(pb.and(pb.lessThan(this.sceneZMax01, 1), pb.greaterThanEqual(this.zA, pb.sub(this.sceneZMax, thickness)), pb.lessThanEqual(this.zB, this.sceneZMax)));
|
|
103
|
-
});
|
|
104
|
-
pb.func('traceRayLinear2D', [
|
|
105
|
-
pb.vec3('rayOrigin'),
|
|
106
|
-
pb.vec3('rayDirection'),
|
|
107
|
-
pb.float('stride'),
|
|
108
|
-
pb.float('maxDistance'),
|
|
109
|
-
pb.float('maxIterations'),
|
|
110
|
-
pb.float('thickness'),
|
|
111
|
-
pb.vec2('cameraNearFar'),
|
|
112
|
-
pb.mat4('projMatrix'),
|
|
113
|
-
pb.vec4('textureSize'),
|
|
114
|
-
pb.vec3('hit2D').out(),
|
|
115
|
-
pb.vec3('hit3D').out(),
|
|
116
|
-
pb.vec2('origin').out(),
|
|
117
|
-
pb.float('numIterations').out()
|
|
118
|
-
], function() {
|
|
119
|
-
this.$l.rayLen = this.$choice(pb.greaterThan(pb.add(this.rayOrigin.z, pb.mul(this.rayDirection.z, this.maxDistance)), pb.neg(this.cameraNearFar.x)), pb.div(pb.sub(pb.neg(this.cameraNearFar.x), this.rayOrigin.z), this.rayDirection.z), this.maxDistance);
|
|
120
|
-
this.$l.rayEnd = pb.add(this.rayOrigin, pb.mul(this.rayDirection, this.rayLen));
|
|
121
|
-
this.$l.zMin = pb.min(this.rayOrigin.z, this.rayEnd.z);
|
|
122
|
-
this.$l.zMax = pb.max(this.rayOrigin.z, this.rayEnd.z);
|
|
123
|
-
this.$l.rayOriginH = pb.mul(this.projMatrix, pb.vec4(this.rayOrigin, 1));
|
|
124
|
-
this.$l.rayEndH = pb.mul(this.projMatrix, pb.vec4(this.rayEnd, 1));
|
|
125
|
-
this.$l.k0 = pb.div(1, this.rayOriginH.w);
|
|
126
|
-
this.$l.k1 = pb.div(1, this.rayEndH.w);
|
|
127
|
-
this.$l.Q0 = pb.mul(this.rayOrigin, this.k0);
|
|
128
|
-
this.$l.Q1 = pb.mul(this.rayEnd, this.k1);
|
|
129
|
-
this.$l.rayOriginNDC = pb.mul(this.rayOriginH, this.k0);
|
|
130
|
-
this.$l.rayEndNDC = pb.mul(this.rayEndH, this.k1);
|
|
131
|
-
this.origin = pb.add(pb.mul(this.rayOriginNDC.xy, 0.5), pb.vec2(0.5));
|
|
132
|
-
this.$l.P0 = pb.mul(this.origin, this.textureSize.zw);
|
|
133
|
-
this.$l.P1 = pb.mul(pb.add(pb.mul(this.rayEndNDC.xy, 0.5), pb.vec2(0.5)), this.textureSize.zw);
|
|
134
|
-
this.$l.xMin = 0.5;
|
|
135
|
-
this.$l.xMax = pb.sub(this.textureSize.z, 0.5);
|
|
136
|
-
this.$l.yMin = 0.5;
|
|
137
|
-
this.$l.yMax = pb.sub(this.textureSize.w, 0.5);
|
|
138
|
-
this.$l.t = pb.float();
|
|
139
|
-
this.$if(pb.or(pb.greaterThan(this.P1.y, this.yMax), pb.lessThan(this.P1.y, this.yMin)), function() {
|
|
140
|
-
this.t = pb.div(pb.sub(this.P1.y, this.$choice(pb.greaterThan(this.P1.y, this.yMax), this.yMax, this.yMin)), pb.sub(this.P1.y, this.P0.y));
|
|
141
|
-
});
|
|
142
|
-
this.$if(pb.or(pb.greaterThan(this.P1.x, this.xMax), pb.lessThan(this.P1.x, this.xMin)), function() {
|
|
143
|
-
this.t2 = pb.div(pb.sub(this.P1.x, this.$choice(pb.greaterThan(this.P1.x, this.xMax), this.xMax, this.xMin)), pb.sub(this.P1.x, this.P0.x));
|
|
144
|
-
this.t = pb.max(this.t, this.t2);
|
|
145
|
-
});
|
|
146
|
-
this.P1 = pb.mix(this.P1, this.P0, this.t);
|
|
147
|
-
this.k1 = pb.mix(this.k1, this.k0, this.t);
|
|
148
|
-
this.Q1 = pb.mix(this.Q1, this.Q0, this.t);
|
|
149
|
-
this.P1 = this.$choice(pb.lessThan(this.distanceSquared(this.P0, this.P1), 0.0001), pb.add(this.P1, pb.vec2(0.01)), this.P1);
|
|
150
|
-
this.$l.delta = pb.sub(this.P1, this.P0);
|
|
151
|
-
this.$l.permute = false;
|
|
152
|
-
this.$if(pb.lessThan(pb.abs(this.delta.x), pb.abs(this.delta.y)), function() {
|
|
153
|
-
this.permute = true;
|
|
154
|
-
this.delta = this.delta.yx;
|
|
155
|
-
this.P0 = this.P0.yx;
|
|
156
|
-
this.P1 = this.P1.yx;
|
|
157
|
-
});
|
|
158
|
-
this.$l.stepDir = pb.sign(this.delta.x);
|
|
159
|
-
this.$l.invdx = pb.div(this.stepDir, this.delta.x);
|
|
160
|
-
this.$l.dQ = pb.mul(pb.sub(this.Q1, this.Q0), this.invdx);
|
|
161
|
-
this.$l.dK = pb.mul(pb.sub(this.k1, this.k0), this.invdx);
|
|
162
|
-
this.$l.dP = pb.vec2(this.stepDir, pb.mul(this.delta.y, this.invdx));
|
|
163
|
-
//this.$l.strideScalar = pb.sub(1, pb.min(1, pb.div(pb.neg(this.rayOrigin.z), this.strideZCutoff)));
|
|
164
|
-
//this.$l.pixelStride = pb.add(1, pb.mul(this.strideScalar, this.stride));
|
|
165
|
-
this.$l.pixelStride = this.stride;
|
|
166
|
-
this.dP = pb.mul(this.dP, this.pixelStride);
|
|
167
|
-
this.dQ = pb.mul(this.dQ, this.pixelStride);
|
|
168
|
-
this.dK = pb.mul(this.dK, this.pixelStride);
|
|
169
|
-
this.$l.jitter = pb.float(1); //dither(this, this.P0);
|
|
170
|
-
this.P0 = pb.add(this.P0, pb.mul(this.dP, this.jitter));
|
|
171
|
-
this.Q0 = pb.add(this.Q0, pb.mul(this.dQ, this.jitter));
|
|
172
|
-
this.k0 = pb.add(this.k0, pb.mul(this.dK, this.jitter));
|
|
173
|
-
this.$l.prevZMaxEstimate = this.rayOrigin.z;
|
|
174
|
-
this.$l.zA = this.prevZMaxEstimate;
|
|
175
|
-
this.$l.zB = this.prevZMaxEstimate;
|
|
176
|
-
this.$l.pqk = pb.vec4(this.P0, this.Q0.z, this.k0);
|
|
177
|
-
this.$l.dpqk = pb.vec4(this.dP, this.dQ.z, this.dK);
|
|
178
|
-
this.$l.invRenderTargetSize = pb.div(pb.vec2(1), this.textureSize.zw);
|
|
179
|
-
this.$l.intersected = false;
|
|
180
|
-
this.$l.hitUV = pb.vec2();
|
|
181
|
-
this.$l.hitZ = pb.float();
|
|
182
|
-
this.numIterations = 0;
|
|
183
|
-
this.skippedIterations = pb.min(this.maxIterations, 1);
|
|
184
|
-
this.$for(pb.float('i'), 0, pb.getDevice().type === 'webgl' ? 1000 : this.maxIterations, function() {
|
|
185
|
-
if (pb.getDevice().type === 'webgl') {
|
|
186
|
-
this.$if(pb.greaterThanEqual(this.i, this.maxIterations), function() {
|
|
187
|
-
this.$break();
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
this.$if(pb.and(this.intersected, pb.greaterThanEqual(this.i, this.skippedIterations)), function() {
|
|
191
|
-
this.$break();
|
|
192
|
-
});
|
|
193
|
-
this.numIterations = pb.add(this.numIterations, 1);
|
|
194
|
-
this.pqk = pb.add(this.pqk, this.dpqk);
|
|
195
|
-
this.zA = this.prevZMaxEstimate;
|
|
196
|
-
this.zB = pb.div(pb.add(pb.mul(this.dpqk.z, 0.5), this.pqk.z), pb.add(pb.mul(this.dpqk.w, 0.5), this.pqk.w));
|
|
197
|
-
this.zB = pb.clamp(this.zB, this.zMin, this.zMax);
|
|
198
|
-
this.prevZMaxEstimate = this.zB;
|
|
199
|
-
this.hitZ = this.zB;
|
|
200
|
-
this.$if(pb.greaterThan(this.zB, this.zA), function() {
|
|
201
|
-
this.$l.t = this.zB;
|
|
202
|
-
this.zB = this.zA;
|
|
203
|
-
this.zA = this.t;
|
|
204
|
-
});
|
|
205
|
-
this.hitUV = this.$choice(this.permute, this.pqk.yx, this.pqk.xy);
|
|
206
|
-
this.hitUV = pb.mul(this.hitUV, this.invRenderTargetSize);
|
|
207
|
-
this.intersected = this.rayIntersectDepth(this.zA, this.zB, this.thickness, this.hitUV, this.cameraNearFar.y);
|
|
208
|
-
});
|
|
209
|
-
this.hit2D = pb.vec3(this.hitUV, this.hitZ);
|
|
210
|
-
this.Q0 = pb.vec3(pb.add(this.Q0.xy, pb.mul(this.dQ.xy, this.numIterations)), this.pqk.z);
|
|
211
|
-
this.hit3D = pb.div(this.Q0, this.pqk.w);
|
|
212
|
-
this.$return(this.intersected);
|
|
213
|
-
});
|
|
214
|
-
pb.func('SSR_Linear2D', [
|
|
215
|
-
pb.vec3('rayOrigin'),
|
|
216
|
-
pb.vec3('rayDirection'),
|
|
217
|
-
pb.mat4('viewMatrix'),
|
|
218
|
-
pb.mat4('projMatrix'),
|
|
219
|
-
pb.mat4('invProjMatrix'),
|
|
220
|
-
pb.float('stride'),
|
|
221
|
-
pb.float('maxDistance'),
|
|
222
|
-
pb.float('maxIterations'),
|
|
223
|
-
pb.float('thickness'),
|
|
224
|
-
pb.vec2('cameraNearFar'),
|
|
225
|
-
pb.vec4('textureSize')
|
|
226
|
-
], function() {
|
|
227
|
-
this.$l.hit2D = pb.vec3();
|
|
228
|
-
this.$l.hit3D = pb.vec3();
|
|
229
|
-
this.$l.origin = pb.vec2();
|
|
230
|
-
this.$l.numIterations = pb.float();
|
|
231
|
-
this.$l.intersected = this.traceRayLinear2D(this.rayOrigin, this.rayDirection, this.stride, this.maxDistance, this.maxIterations, this.thickness, this.cameraNearFar, this.projMatrix, this.textureSize, this.hit2D, this.hit3D, this.origin, this.numIterations);
|
|
232
|
-
this.$if(pb.not(this.intersected), function() {
|
|
233
|
-
this.$return(pb.vec4(0));
|
|
234
|
-
});
|
|
235
|
-
this.$l.surfaceZ01 = ShaderHelper.sampleLinearDepth(this, linearDepthTex, this.hit2D.xy, 0);
|
|
236
|
-
this.$if(pb.equal(this.surfaceZ01, 1), function() {
|
|
237
|
-
this.$return(pb.vec4(0));
|
|
238
|
-
});
|
|
239
|
-
this.$l.surfaceZ = ShaderHelper.linearDepthToNonLinear(this, pb.mul(this.surfaceZ01, this.cameraNearFar.y), this.cameraNearFar);
|
|
240
|
-
this.$l.confidence = validateHit(this, this.hit2D.xy, null, this.surfaceZ, null, this.origin, this.rayDirection, this.viewMatrix, this.invProjMatrix, this.textureSize, normalTexture);
|
|
241
|
-
this.$l.iterationAttenuation = pb.sub(1, pb.smoothStep(0, this.maxIterations, this.numIterations));
|
|
242
|
-
//this.$l.iterationAttenuation = pb.smoothStep(this.maxIterations, 1, this.numIterations);
|
|
243
|
-
this.confidence = pb.mul(this.confidence, this.iterationAttenuation);
|
|
244
|
-
this.$l.hitPixel = pb.mul(this.hit2D.xy, this.textureSize.zw);
|
|
245
|
-
this.$l.startPixel = pb.mul(this.origin.xy, this.textureSize.zw);
|
|
246
|
-
this.$l.hitDistance = pb.length(pb.sub(this.hitPixel, this.startPixel));
|
|
247
|
-
this.$return(pb.vec4(this.hit2D.xy, this.hitDistance, this.confidence));
|
|
248
|
-
});
|
|
249
|
-
return scope.SSR_Linear2D(viewPos, traceRay, viewMatrix, projMatrix, invProjMatrix, stride, maxDistance, maxIterations, thickness, cameraNearFar, textureSize);
|
|
250
|
-
}
|
|
251
|
-
function screenSpaceRayTracing_HiZ(scope, viewPos, traceRay, viewMatrix, projMatrix, invProjMatrix, cameraNearFar, maxMipLevel, maxIterations, thickness, textureSize, HiZTexture, normalTexture) {
|
|
252
|
-
const pb = scope.$builder;
|
|
253
|
-
pb.func('getMipResolution', [
|
|
254
|
-
pb.int('mipLevel')
|
|
255
|
-
], function() {
|
|
256
|
-
this.$return(pb.vec2(pb.textureDimensions(HiZTexture, this.mipLevel)));
|
|
257
|
-
});
|
|
258
|
-
pb.func('SSR_loadDepth', [
|
|
259
|
-
pb.vec2('uv'),
|
|
260
|
-
pb.float('level')
|
|
261
|
-
], function() {
|
|
262
|
-
this.$return(pb.textureSampleLevel(HiZTexture, this.uv, this.level).r);
|
|
263
|
-
});
|
|
264
|
-
pb.func('invProjectPosition', [
|
|
265
|
-
pb.vec3('p'),
|
|
266
|
-
pb.mat4('mat')
|
|
267
|
-
], function() {
|
|
268
|
-
this.$l.c = pb.sub(pb.mul(this.p, 2), pb.vec3(1));
|
|
269
|
-
this.$l.u = pb.mul(this.mat, pb.vec4(this.c, 1));
|
|
270
|
-
this.u = pb.div(this.u, this.u.w);
|
|
271
|
-
this.$return(this.u.xyz);
|
|
272
|
-
});
|
|
273
|
-
pb.func('projectPosition', [
|
|
274
|
-
pb.vec3('p'),
|
|
275
|
-
pb.mat4('mat')
|
|
276
|
-
], function() {
|
|
277
|
-
this.$l.projected = pb.mul(this.mat, pb.vec4(this.p, 1));
|
|
278
|
-
this.projected = pb.div(this.projected, this.projected.w);
|
|
279
|
-
this.projected = pb.add(pb.mul(this.projected, 0.5), pb.vec4(0.5));
|
|
280
|
-
this.$return(this.projected.xyz);
|
|
281
|
-
});
|
|
282
|
-
pb.func('projectDirection', [
|
|
283
|
-
pb.vec3('p'),
|
|
284
|
-
pb.vec3('d'),
|
|
285
|
-
pb.vec3('screenSpacePos'),
|
|
286
|
-
pb.mat4('mat')
|
|
287
|
-
], function() {
|
|
288
|
-
this.$return(pb.sub(this.projectPosition(pb.add(this.p, this.d), this.mat), this.screenSpacePos));
|
|
289
|
-
});
|
|
290
|
-
pb.func('SSR_initialAdvanceRay', [
|
|
291
|
-
pb.vec3('origin'),
|
|
292
|
-
pb.vec3('direction'),
|
|
293
|
-
pb.vec3('invDirection'),
|
|
294
|
-
pb.vec2('currentMipResolution'),
|
|
295
|
-
pb.vec2('invCurrentMipResolution'),
|
|
296
|
-
pb.vec2('floorOffset'),
|
|
297
|
-
pb.vec2('uvOffset'),
|
|
298
|
-
pb.vec3('position').out(),
|
|
299
|
-
pb.float('currentT').out()
|
|
300
|
-
], function() {
|
|
301
|
-
this.$l.currentMipPosition = pb.mul(this.currentMipResolution, this.origin.xy);
|
|
302
|
-
this.$l.xyPlane = pb.add(pb.floor(this.currentMipPosition), this.floorOffset);
|
|
303
|
-
this.xyPlane = pb.add(pb.mul(this.xyPlane, this.invCurrentMipResolution), this.uvOffset);
|
|
304
|
-
this.$l.t = pb.mul(pb.sub(this.xyPlane, this.origin.xy), this.invDirection.xy);
|
|
305
|
-
this.currentT = pb.min(this.t.x, this.t.y);
|
|
306
|
-
this.position = pb.add(this.origin, pb.mul(this.direction, this.currentT));
|
|
307
|
-
});
|
|
308
|
-
pb.func('SSR_advanceRay', [
|
|
309
|
-
pb.vec3('origin'),
|
|
310
|
-
pb.vec3('direction'),
|
|
311
|
-
pb.vec3('invDirection'),
|
|
312
|
-
pb.vec2('currentMipPosition'),
|
|
313
|
-
pb.vec2('invCurrentMipResolution'),
|
|
314
|
-
pb.vec2('floorOffset'),
|
|
315
|
-
pb.vec2('uvOffset'),
|
|
316
|
-
pb.float('surfaceZ'),
|
|
317
|
-
pb.vec3('position').inout(),
|
|
318
|
-
pb.float('currentT').inout()
|
|
319
|
-
], function() {
|
|
320
|
-
this.$l.xyPlane = pb.add(pb.floor(this.currentMipPosition), this.floorOffset);
|
|
321
|
-
this.xyPlane = pb.add(pb.mul(this.xyPlane, this.invCurrentMipResolution), this.uvOffset);
|
|
322
|
-
this.$l.boundaryPlanes = pb.vec3(this.xyPlane, this.surfaceZ);
|
|
323
|
-
this.$l.t = pb.mul(pb.sub(this.boundaryPlanes, this.origin), this.invDirection);
|
|
324
|
-
this.t.z = this.$choice(pb.greaterThan(this.direction.z, 0), this.t.z, MAX_FLOAT_VALUE);
|
|
325
|
-
this.$l.tMin = pb.min(pb.min(this.t.x, this.t.y), this.t.z);
|
|
326
|
-
this.$l.aboveSurface = pb.greaterThan(this.surfaceZ, this.position.z);
|
|
327
|
-
this.$l.skippedTile = pb.and(pb.notEqual(pb.floatBitsToUint(this.tMin), pb.floatBitsToUint(this.t.z)), this.aboveSurface);
|
|
328
|
-
this.currentT = this.$choice(this.aboveSurface, this.tMin, this.currentT);
|
|
329
|
-
this.position = pb.add(this.origin, pb.mul(this.direction, this.currentT));
|
|
330
|
-
this.$return(this.skippedTile);
|
|
331
|
-
});
|
|
332
|
-
pb.func('SSR_RaymarchHiZ', [
|
|
333
|
-
pb.vec3('screenSpacePos'),
|
|
334
|
-
pb.vec3('screenSpaceDirection'),
|
|
335
|
-
pb.vec2('cameraNearFar'),
|
|
336
|
-
pb.vec2('screenSize'),
|
|
337
|
-
pb.int('mostDetailMip'),
|
|
338
|
-
pb.int('maxMipLevel'),
|
|
339
|
-
pb.float('maxIterations'),
|
|
340
|
-
pb.float('numIterations').out()
|
|
341
|
-
], function() {
|
|
342
|
-
this.$l.invDirection = this.$choice(pb.all(pb.compNotEqual(this.screenSpaceDirection, pb.vec3(0))), pb.div(pb.vec3(1), this.screenSpaceDirection), pb.vec3(MAX_FLOAT_VALUE));
|
|
343
|
-
this.$l.currentMip = this.mostDetailMip;
|
|
344
|
-
this.$l.currentMipResolution = this.getMipResolution(this.currentMip);
|
|
345
|
-
this.$l.invCurrentMipResolution = pb.div(pb.vec2(1), this.currentMipResolution);
|
|
346
|
-
this.$l.uvOffset = pb.div(pb.mul(0.005, pb.exp2(pb.float(this.mostDetailMip))), this.screenSize);
|
|
347
|
-
this.uvOffset = pb.vec2(this.$choice(pb.lessThan(this.screenSpaceDirection.x, 0), pb.neg(this.uvOffset.x), this.uvOffset.x), this.$choice(pb.lessThan(this.screenSpaceDirection.y, 0), pb.neg(this.uvOffset.y), this.uvOffset.y));
|
|
348
|
-
this.$l.floorOffset = pb.vec2(this.$choice(pb.lessThan(this.screenSpaceDirection.x, 0), pb.float(0), pb.float(1)), this.$choice(pb.lessThan(this.screenSpaceDirection.y, 0), pb.float(0), pb.float(1)));
|
|
349
|
-
this.$l.currentT = pb.float();
|
|
350
|
-
this.$l.position = pb.vec3();
|
|
351
|
-
this.SSR_initialAdvanceRay(this.screenSpacePos, this.screenSpaceDirection, this.invDirection, this.currentMipResolution, this.invCurrentMipResolution, this.floorOffset, this.uvOffset, this.position, this.currentT);
|
|
352
|
-
this.numIterations = pb.float(0);
|
|
353
|
-
this.$while(pb.and(pb.lessThan(this.numIterations, this.maxIterations), pb.greaterThanEqual(this.currentMip, this.mostDetailMip)), function() {
|
|
354
|
-
this.$l.currentMipPosition = pb.mul(this.currentMipResolution, this.position.xy);
|
|
355
|
-
this.$l.surfaceZ = pb.textureLoad(HiZTexture, pb.ivec2(this.currentMipPosition), this.currentMip).r;
|
|
356
|
-
this.$l.skippedTile = this.SSR_advanceRay(this.screenSpacePos, this.screenSpaceDirection, this.invDirection, this.currentMipPosition, this.invCurrentMipResolution, this.floorOffset, this.uvOffset, this.surfaceZ, this.position, this.currentT);
|
|
357
|
-
this.$l.nextMipIsOutOfRange = pb.and(this.skippedTile, pb.greaterThanEqual(this.currentMip, this.maxMipLevel));
|
|
358
|
-
this.$if(pb.not(this.nextMipIsOutOfRange), function() {
|
|
359
|
-
this.currentMip = pb.add(this.currentMip, this.$choice(this.skippedTile, pb.int(1), pb.int(-1)));
|
|
360
|
-
this.currentMipResolution = pb.mul(this.currentMipResolution, this.$choice(this.skippedTile, 0.5, 2));
|
|
361
|
-
this.invCurrentMipResolution = pb.mul(this.invCurrentMipResolution, this.$choice(this.skippedTile, 2, 0.5));
|
|
362
|
-
});
|
|
363
|
-
this.numIterations = pb.add(this.numIterations, 1);
|
|
364
|
-
});
|
|
365
|
-
this.$l.validHit = this.$choice(pb.lessThanEqual(this.numIterations, this.maxIterations), pb.float(1), pb.float(0));
|
|
366
|
-
this.$return(pb.vec4(this.position, this.validHit));
|
|
367
|
-
});
|
|
368
|
-
pb.func('SSR_HiZ', [
|
|
369
|
-
pb.vec3('viewPos'),
|
|
370
|
-
pb.vec3('traceRay'),
|
|
371
|
-
pb.mat4('viewMatrix'),
|
|
372
|
-
pb.mat4('projMatrix'),
|
|
373
|
-
pb.mat4('invProjMatrix'),
|
|
374
|
-
pb.vec2('cameraNearFar'),
|
|
375
|
-
pb.float('thickness'),
|
|
376
|
-
pb.vec4('textureSize'),
|
|
377
|
-
pb.int('maxMipLevel'),
|
|
378
|
-
pb.float('maxIterations')
|
|
379
|
-
], function() {
|
|
380
|
-
this.$if(pb.greaterThan(this.traceRay.z, 0), function() {
|
|
381
|
-
this.$return(pb.vec4(0));
|
|
382
|
-
});
|
|
383
|
-
this.$l.originH = pb.mul(this.projMatrix, pb.vec4(this.viewPos, 1));
|
|
384
|
-
this.$l.originCS = pb.div(this.originH.xyz, this.originH.w);
|
|
385
|
-
this.$l.originTS = pb.add(pb.mul(this.originCS, 0.5), pb.vec3(0.5));
|
|
386
|
-
this.$l.directionTS = this.projectDirection(this.viewPos, this.traceRay, this.originTS, this.projMatrix);
|
|
387
|
-
this.$l.mostDetailMip = pb.int(0);
|
|
388
|
-
this.$l.numIterations = pb.float();
|
|
389
|
-
this.$l.hit = this.SSR_RaymarchHiZ(this.originTS, this.directionTS, this.cameraNearFar, this.textureSize.zw, this.mostDetailMip, this.maxMipLevel, this.maxIterations, this.numIterations);
|
|
390
|
-
this.$l.confidence = pb.float(0);
|
|
391
|
-
this.$if(pb.notEqual(this.hit.w, 0), function() {
|
|
392
|
-
this.$l.surfaceZ = pb.textureSampleLevel(HiZTexture, this.hit.xy, 0).r;
|
|
393
|
-
this.$if(pb.equal(this.surfaceZ, 1), function() {
|
|
394
|
-
this.$return(pb.vec4(0));
|
|
395
|
-
});
|
|
396
|
-
this.$l.hit3D = invProjectPosition(this, this.hit.xyz, this.invProjMatrix);
|
|
397
|
-
this.confidence = validateHit(this, this.hit.xy, this.hit3D, this.surfaceZ, this.thickness, this.originTS.xy, this.traceRay, this.viewMatrix, this.invProjMatrix, this.textureSize, normalTexture);
|
|
398
|
-
});
|
|
399
|
-
this.$l.iterationAttenuation = pb.sub(1, pb.smoothStep(0, this.maxIterations, this.numIterations));
|
|
400
|
-
this.$l.viewAttenuation = pb.sub(1, pb.smoothStep(-0.5, 0, this.traceRay.z));
|
|
401
|
-
//this.$l.iterationAttenuation = pb.smoothStep(this.maxIterations, 1, this.numIterations);
|
|
402
|
-
this.confidence = pb.mul(this.confidence, this.iterationAttenuation, this.viewAttenuation);
|
|
403
|
-
this.$l.hitPixel = pb.mul(this.hit.xy, this.textureSize.zw);
|
|
404
|
-
this.$l.startPixel = pb.mul(this.originTS.xy, this.textureSize.zw);
|
|
405
|
-
this.$l.hitDistance = pb.length(pb.sub(this.hitPixel, this.startPixel));
|
|
406
|
-
this.$return(pb.vec4(this.hit.xy, this.hitDistance, this.confidence));
|
|
407
|
-
});
|
|
408
|
-
return scope.SSR_HiZ(viewPos, traceRay, viewMatrix, projMatrix, invProjMatrix, cameraNearFar, thickness, textureSize, pb.sub(maxMipLevel, 1), maxIterations);
|
|
409
|
-
} /*
|
|
410
|
-
float2 cell(float2 ray, float2 cell_count, uint camera) {
|
|
411
|
-
return floor(ray.xy * cell_count);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
float2 cell_count(float level) {
|
|
415
|
-
return input_texture2_size / (level == 0.0 ? 1.0 : exp2(level));
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
float3 intersect_cell_boundary(float3 pos, float3 dir, float2 cell_id, float2 cell_count, float2 cross_step, float2 cross_offset, uint camera) {
|
|
419
|
-
float2 cell_size = 1.0 / cell_count;
|
|
420
|
-
float2 planes = cell_id/cell_count + cell_size * cross_step;
|
|
421
|
-
|
|
422
|
-
float2 solutions = (planes - pos)/dir.xy;
|
|
423
|
-
float3 intersection_pos = pos + dir * min(solutions.x, solutions.y);
|
|
424
|
-
|
|
425
|
-
intersection_pos.xy += (solutions.x < solutions.y) ? float2(cross_offset.x, 0.0) : float2(0.0, cross_offset.y);
|
|
426
|
-
|
|
427
|
-
return intersection_pos;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
bool crossed_cell_boundary(float2 cell_id_one, float2 cell_id_two) {
|
|
431
|
-
return (int)cell_id_one.x != (int)cell_id_two.x || (int)cell_id_one.y != (int)cell_id_two.y;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
float minimum_depth_plane(float2 ray, float level, float2 cell_count, uint camera) {
|
|
435
|
-
return input_texture2.Load(int3(vr_stereo_to_mono(ray.xy, camera) * cell_count, level)).r;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
float3 hi_z_trace(float3 p, float3 v, in uint camera, out uint iterations) {
|
|
439
|
-
float level = HIZ_START_LEVEL;
|
|
440
|
-
float3 v_z = v/v.z;
|
|
441
|
-
float2 hi_z_size = cell_count(level);
|
|
442
|
-
float3 ray = p;
|
|
443
|
-
|
|
444
|
-
float2 cross_step = float2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);
|
|
445
|
-
float2 cross_offset = cross_step * 0.00001;
|
|
446
|
-
cross_step = saturate(cross_step);
|
|
447
|
-
|
|
448
|
-
float2 ray_cell = cell(ray.xy, hi_z_size.xy, camera);
|
|
449
|
-
ray = intersect_cell_boundary(ray, v, ray_cell, hi_z_size, cross_step, cross_offset, camera);
|
|
450
|
-
|
|
451
|
-
iterations = 0;
|
|
452
|
-
while(level >= HIZ_STOP_LEVEL && iterations < MAX_ITERATIONS) {
|
|
453
|
-
// get the cell number of the current ray
|
|
454
|
-
float2 current_cell_count = cell_count(level);
|
|
455
|
-
float2 old_cell_id = cell(ray.xy, current_cell_count, camera);
|
|
456
|
-
|
|
457
|
-
// get the minimum depth plane in which the current ray resides
|
|
458
|
-
float min_z = minimum_depth_plane(ray.xy, level, current_cell_count, camera);
|
|
459
|
-
|
|
460
|
-
// intersect only if ray depth is below the minimum depth plane
|
|
461
|
-
float3 tmp_ray = ray;
|
|
462
|
-
if(v.z > 0) {
|
|
463
|
-
float min_minus_ray = min_z - ray.z;
|
|
464
|
-
tmp_ray = min_minus_ray > 0 ? ray + v_z*min_minus_ray : tmp_ray;
|
|
465
|
-
float2 new_cell_id = cell(tmp_ray.xy, current_cell_count, camera);
|
|
466
|
-
if(crossed_cell_boundary(old_cell_id, new_cell_id)) {
|
|
467
|
-
tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
|
|
468
|
-
level = min(HIZ_MAX_LEVEL, level + 2.0f);
|
|
469
|
-
}else{
|
|
470
|
-
if(level == 1 && abs(min_minus_ray) > 0.0001) {
|
|
471
|
-
tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
|
|
472
|
-
level = 2;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
} else if(ray.z < min_z) {
|
|
476
|
-
tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
|
|
477
|
-
level = min(HIZ_MAX_LEVEL, level + 2.0f);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
ray.xyz = tmp_ray.xyz;
|
|
481
|
-
--level;
|
|
482
|
-
|
|
483
|
-
++iterations;
|
|
484
|
-
}
|
|
485
|
-
return ray;
|
|
486
|
-
}
|
|
487
|
-
*/
|
|
488
|
-
|
|
489
|
-
export { SSR_calcJitter, screenSpaceRayTracing_HiZ, screenSpaceRayTracing_Linear2D };
|
|
490
|
-
//# sourceMappingURL=ssr.js.map
|