@luma.gl/engine 10.0.0-beta.4 → 10.0.0-rc.2
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/THIRD-PARTY-NOTICES.md +82 -0
- package/dist/animation/animation-track.d.ts +7 -0
- package/dist/animation/animation-track.d.ts.map +1 -1
- package/dist/animation/animation-track.js.map +1 -1
- package/dist/animation/node-animation-binding.cjs +1 -0
- package/dist/animation/node-animation-binding.d.ts +2 -1
- package/dist/animation/node-animation-binding.d.ts.map +1 -1
- package/dist/animation/node-animation-binding.js +6 -0
- package/dist/animation/node-animation-binding.js.map +1 -1
- package/dist/animation/scenegraph-gpu-animation-layout.cjs +99 -0
- package/dist/animation/scenegraph-gpu-animation-layout.d.ts +69 -0
- package/dist/animation/scenegraph-gpu-animation-layout.d.ts.map +1 -0
- package/dist/animation/scenegraph-gpu-animation-layout.js +90 -0
- package/dist/animation/scenegraph-gpu-animation-layout.js.map +1 -0
- package/dist/animation/scenegraph-gpu-animation.cjs +281 -0
- package/dist/animation/scenegraph-gpu-animation.d.ts +54 -0
- package/dist/animation/scenegraph-gpu-animation.d.ts.map +1 -0
- package/dist/animation/scenegraph-gpu-animation.js +274 -0
- package/dist/animation/scenegraph-gpu-animation.js.map +1 -0
- package/dist/arrow/arrow-picking.cjs +4 -3
- package/dist/arrow/arrow-picking.d.ts +15 -5
- package/dist/arrow/arrow-picking.d.ts.map +1 -1
- package/dist/arrow/arrow-picking.js +16 -5
- package/dist/arrow/arrow-picking.js.map +1 -1
- package/dist/arrow/index.cjs.map +1 -1
- package/dist/audio/audio-controller.cjs +6 -2
- package/dist/audio/audio-controller.d.ts.map +1 -1
- package/dist/audio/audio-controller.js +6 -2
- package/dist/audio/audio-controller.js.map +1 -1
- package/dist/audio/audio-graph.cjs +26 -2
- package/dist/audio/audio-graph.d.ts +9 -0
- package/dist/audio/audio-graph.d.ts.map +1 -1
- package/dist/audio/audio-graph.js +35 -10
- package/dist/audio/audio-graph.js.map +1 -1
- package/dist/dist.dev.js +1689 -1094
- package/dist/dist.min.js +69 -70
- package/dist/effects/glfx-effects.cjs +261 -0
- package/dist/effects/glfx-effects.d.ts +959 -0
- package/dist/effects/glfx-effects.d.ts.map +1 -0
- package/dist/effects/glfx-effects.js +200 -0
- package/dist/effects/glfx-effects.js.map +1 -0
- package/dist/effects/graph/gpu-effect-operation.cjs +402 -0
- package/dist/effects/graph/gpu-effect-operation.d.ts +101 -0
- package/dist/effects/graph/gpu-effect-operation.d.ts.map +1 -0
- package/dist/effects/graph/gpu-effect-operation.js +410 -0
- package/dist/effects/graph/gpu-effect-operation.js.map +1 -0
- package/dist/effects/graph/temporal-graph-history.cjs +48 -0
- package/dist/effects/graph/temporal-graph-history.d.ts +17 -0
- package/dist/effects/graph/temporal-graph-history.d.ts.map +1 -0
- package/dist/effects/graph/temporal-graph-history.js +30 -0
- package/dist/effects/graph/temporal-graph-history.js.map +1 -0
- package/dist/effects/index.cjs +117 -30
- package/dist/effects/index.cjs.map +3 -3
- package/dist/effects/index.d.ts +34 -18
- package/dist/effects/index.d.ts.map +1 -1
- package/dist/effects/index.js +31 -18
- package/dist/effects/index.js.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.cjs +9 -2
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts +19 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js +6 -0
- package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.cjs +9 -2
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts +41 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js +6 -0
- package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.cjs +200 -13
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +992 -6
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js +199 -10
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +3 -3
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -1
- package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.cjs +41 -40
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +116 -8
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js +38 -37
- package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +83 -66
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +470 -2
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +80 -62
- package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.cjs +7 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts +1 -0
- package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/copy-pass.js +4 -0
- package/dist/effects/passes/screen-space/copy-pass.js.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.cjs +14 -5
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +125 -17
- package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/depth-aware-blur.js +11 -3
- package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/dof.cjs +19 -3
- package/dist/effects/passes/screen-space/dof.d.ts +181 -0
- package/dist/effects/passes/screen-space/dof.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/dof.js +17 -3
- package/dist/effects/passes/screen-space/dof.js.map +1 -1
- package/dist/effects/passes/screen-space/gtao.cjs +82 -62
- package/dist/effects/passes/screen-space/gtao.d.ts +608 -3
- package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/gtao.js +83 -60
- package/dist/effects/passes/screen-space/gtao.js.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.cjs +103 -79
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +225 -3
- package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js +102 -77
- package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.cjs +14 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts +71 -0
- package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/height-fog.js +16 -3
- package/dist/effects/passes/screen-space/height-fog.js.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.cjs +7 -8
- package/dist/effects/passes/screen-space/motion-blur.d.ts +41 -2
- package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/motion-blur.js +6 -6
- package/dist/effects/passes/screen-space/motion-blur.js.map +1 -1
- package/dist/effects/passes/screen-space/outlines.cjs +143 -18
- package/dist/effects/passes/screen-space/outlines.d.ts +162 -3
- package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/outlines.js +137 -15
- package/dist/effects/passes/screen-space/outlines.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +70 -61
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +309 -2
- package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js +69 -59
- package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.cjs +151 -83
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +778 -7
- package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/screen-space-reflections.js +148 -79
- package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.cjs +12 -2
- package/dist/effects/passes/screen-space/selection-outline.d.ts +44 -0
- package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/selection-outline.js +9 -0
- package/dist/effects/passes/screen-space/selection-outline.js.map +1 -1
- package/dist/effects/passes/screen-space/ssao.cjs +69 -44
- package/dist/effects/passes/screen-space/ssao.d.ts +648 -3
- package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssao.js +67 -42
- package/dist/effects/passes/screen-space/ssao.js.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.cjs +42 -30
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts +107 -6
- package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/temporal-antialiasing.js +40 -27
- package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -1
- package/dist/effects/passes/screen-space/temporal-frame.cjs +34 -0
- package/dist/effects/passes/screen-space/temporal-frame.d.ts +23 -0
- package/dist/effects/passes/screen-space/temporal-frame.d.ts.map +1 -0
- package/dist/effects/passes/screen-space/temporal-frame.js +16 -0
- package/dist/effects/passes/screen-space/temporal-frame.js.map +1 -0
- package/dist/effects/passes/screen-space/volumetric-fog.cjs +25 -22
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts +161 -2
- package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/volumetric-fog.js +27 -21
- package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -1
- package/dist/effects/temporal-upscale/index.cjs +40 -0
- package/dist/effects/temporal-upscale/index.d.ts +5 -0
- package/dist/effects/temporal-upscale/index.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/index.js +6 -0
- package/dist/effects/temporal-upscale/index.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-math.cjs +202 -0
- package/dist/effects/temporal-upscale/temporal-math.d.ts +101 -0
- package/dist/effects/temporal-upscale/temporal-math.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-math.js +202 -0
- package/dist/effects/temporal-upscale/temporal-math.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.cjs +353 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts +7 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.js +321 -0
- package/dist/effects/temporal-upscale/temporal-upscale-shaders.js.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.cjs +392 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.d.ts +143 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.d.ts.map +1 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.js +385 -0
- package/dist/effects/temporal-upscale/temporal-upscaler.js.map +1 -0
- package/dist/experimental-controls.cjs +13 -3
- package/dist/experimental-controls.d.ts +2 -1
- package/dist/experimental-controls.d.ts.map +1 -1
- package/dist/experimental-controls.js +1 -1
- package/dist/experimental-controls.js.map +1 -1
- package/dist/experimental-materials.cjs +37 -3
- package/dist/experimental-materials.d.ts +2 -1
- package/dist/experimental-materials.d.ts.map +1 -1
- package/dist/experimental-materials.js +1 -1
- package/dist/experimental-materials.js.map +1 -1
- package/dist/experimental-textures.cjs +13 -3
- package/dist/experimental-textures.d.ts +2 -1
- package/dist/experimental-textures.d.ts.map +1 -1
- package/dist/experimental-textures.js +1 -1
- package/dist/experimental-textures.js.map +1 -1
- package/dist/experimental-webxr.cjs +17 -3
- package/dist/experimental-webxr.d.ts +2 -1
- package/dist/experimental-webxr.d.ts.map +1 -1
- package/dist/experimental-webxr.js +1 -1
- package/dist/experimental-webxr.js.map +1 -1
- package/dist/gltf/gltf/create-gltf-model.cjs +34 -71
- package/dist/gltf/gltf/create-gltf-model.d.ts +3 -0
- package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
- package/dist/gltf/gltf/create-gltf-model.js +40 -74
- package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +46 -4
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +9 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js +54 -4
- package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.cjs +25 -136
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts +4 -8
- package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-animated-crowd.js +27 -139
- package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
- package/dist/gltf/gltf/gltf-animation-nodes.cjs +84 -0
- package/dist/gltf/gltf/gltf-animation-nodes.d.ts +11 -0
- package/dist/gltf/gltf/gltf-animation-nodes.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-animation-nodes.js +62 -0
- package/dist/gltf/gltf/gltf-animation-nodes.js.map +1 -0
- package/dist/gltf/gltf/gltf-animator.cjs +8 -2
- package/dist/gltf/gltf/gltf-animator.d.ts +6 -1
- package/dist/gltf/gltf/gltf-animator.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-animator.js +10 -2
- package/dist/gltf/gltf/gltf-animator.js.map +1 -1
- package/dist/gltf/gltf/gltf-gpu-animation-controller.cjs +81 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts +9 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.js +67 -0
- package/dist/gltf/gltf/gltf-gpu-animation-controller.js.map +1 -0
- package/dist/gltf/gltf/gltf-gpu-animation.cjs +33 -28
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts +7 -26
- package/dist/gltf/gltf/gltf-gpu-animation.d.ts.map +1 -1
- package/dist/gltf/gltf/gltf-gpu-animation.js +29 -28
- package/dist/gltf/gltf/gltf-gpu-animation.js.map +1 -1
- package/dist/gltf/index.cjs.map +3 -3
- package/dist/gltf/index.d.ts +2 -2
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/parsers/parse-gltf.cjs +4 -2
- package/dist/gltf/parsers/parse-gltf.d.ts +3 -0
- package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/parsers/parse-gltf.js +7 -2
- package/dist/gltf/parsers/parse-gltf.js.map +1 -1
- package/dist/graph/models/index.cjs.map +2 -2
- package/dist/graph/physics/index.cjs +5 -0
- package/dist/graph/physics/index.cjs.map +3 -3
- package/dist/graph/physics/index.d.ts +1 -0
- package/dist/graph/physics/index.d.ts.map +1 -1
- package/dist/graph/physics/index.js +1 -0
- package/dist/graph/physics/index.js.map +1 -1
- package/dist/graph/physics/physics-controller-geometry.cjs +21 -0
- package/dist/graph/physics/physics-controller-geometry.d.ts +8 -1
- package/dist/graph/physics/physics-controller-geometry.d.ts.map +1 -1
- package/dist/graph/physics/physics-controller-geometry.js +22 -0
- package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
- package/dist/graph/physics/scenegraph-session.d.ts +1 -1
- package/dist/graph/physics/scenegraph-session.d.ts.map +1 -1
- package/dist/graph/tables/index.cjs.map +2 -2
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.cjs +47 -28
- package/dist/lighting/ambient-occlusion-pass.d.ts +12 -0
- package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -1
- package/dist/lighting/ambient-occlusion-pass.js +45 -26
- package/dist/lighting/ambient-occlusion-pass.js.map +1 -1
- package/dist/lighting/clustered-light-grid.cjs +71 -20
- package/dist/lighting/clustered-light-grid.d.ts +37 -0
- package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
- package/dist/lighting/clustered-light-grid.js +68 -18
- package/dist/lighting/clustered-light-grid.js.map +1 -1
- package/dist/lighting/contact-shadow-composite.cjs +72 -51
- package/dist/lighting/contact-shadow-composite.d.ts +274 -3
- package/dist/lighting/contact-shadow-composite.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-composite.js +72 -50
- package/dist/lighting/contact-shadow-composite.js.map +1 -1
- package/dist/lighting/contact-shadow-pass.cjs +50 -39
- package/dist/lighting/contact-shadow-pass.d.ts +8 -0
- package/dist/lighting/contact-shadow-pass.d.ts.map +1 -1
- package/dist/lighting/contact-shadow-pass.js +47 -37
- package/dist/lighting/contact-shadow-pass.js.map +1 -1
- package/dist/lighting/cortao/cortao-occluder-lookup-table.cjs +96 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts +41 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.js +94 -0
- package/dist/lighting/cortao/cortao-occluder-lookup-table.js.map +1 -0
- package/dist/lighting/cortao/cortao-parameters.cjs +127 -0
- package/dist/lighting/cortao/cortao-parameters.d.ts +95 -0
- package/dist/lighting/cortao/cortao-parameters.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-parameters.js +122 -0
- package/dist/lighting/cortao/cortao-parameters.js.map +1 -0
- package/dist/lighting/cortao/cortao-pass.cjs +100 -0
- package/dist/lighting/cortao/cortao-pass.d.ts +33 -0
- package/dist/lighting/cortao/cortao-pass.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-pass.js +84 -0
- package/dist/lighting/cortao/cortao-pass.js.map +1 -0
- package/dist/lighting/cortao/cortao-passes.cjs +42 -0
- package/dist/lighting/cortao/cortao-passes.d.ts +38 -0
- package/dist/lighting/cortao/cortao-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-passes.js +19 -0
- package/dist/lighting/cortao/cortao-passes.js.map +1 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.cjs +606 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts +49 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.js +610 -0
- package/dist/lighting/cortao/cortao-shaders-wgsl.js.map +1 -0
- package/dist/lighting/cortao/cortao-shaders.cjs +667 -0
- package/dist/lighting/cortao/cortao-shaders.d.ts +118 -0
- package/dist/lighting/cortao/cortao-shaders.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-shaders.js +657 -0
- package/dist/lighting/cortao/cortao-shaders.js.map +1 -0
- package/dist/lighting/cortao/cortao-upsample.cjs +191 -0
- package/dist/lighting/cortao/cortao-upsample.d.ts +16 -0
- package/dist/lighting/cortao/cortao-upsample.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-upsample.js +159 -0
- package/dist/lighting/cortao/cortao-upsample.js.map +1 -0
- package/dist/lighting/cortao/cortao-webgl-passes.cjs +229 -0
- package/dist/lighting/cortao/cortao-webgl-passes.d.ts +28 -0
- package/dist/lighting/cortao/cortao-webgl-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-webgl-passes.js +212 -0
- package/dist/lighting/cortao/cortao-webgl-passes.js.map +1 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.cjs +348 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.d.ts +31 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.d.ts.map +1 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.js +335 -0
- package/dist/lighting/cortao/cortao-webgpu-passes.js.map +1 -0
- package/dist/lighting/index.cjs +13 -2
- package/dist/lighting/index.cjs.map +3 -3
- package/dist/lighting/index.d.ts +11 -6
- package/dist/lighting/index.d.ts.map +1 -1
- package/dist/lighting/index.js +6 -5
- package/dist/lighting/index.js.map +1 -1
- package/dist/lighting/shadow-map-renderer.cjs +40 -37
- package/dist/lighting/shadow-map-renderer.d.ts +15 -0
- package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
- package/dist/lighting/shadow-map-renderer.js +37 -35
- package/dist/lighting/shadow-map-renderer.js.map +1 -1
- package/dist/model/gpu-vector-model.cjs +39 -16
- package/dist/model/gpu-vector-model.d.ts +8 -0
- package/dist/model/gpu-vector-model.d.ts.map +1 -1
- package/dist/model/gpu-vector-model.js +46 -18
- package/dist/model/gpu-vector-model.js.map +1 -1
- package/dist/passes/effect-renderer.cjs +155 -0
- package/dist/passes/effect-renderer.d.ts +158 -0
- package/dist/passes/effect-renderer.d.ts.map +1 -0
- package/dist/passes/effect-renderer.js +143 -0
- package/dist/passes/effect-renderer.js.map +1 -0
- package/dist/passes/scene-capture-pass.cjs +42 -0
- package/dist/passes/scene-capture-pass.d.ts +29 -0
- package/dist/passes/scene-capture-pass.d.ts.map +1 -0
- package/dist/passes/scene-capture-pass.js +21 -0
- package/dist/passes/scene-capture-pass.js.map +1 -0
- package/dist/passes/shader-pass-renderer.cjs +94 -68
- package/dist/passes/shader-pass-renderer.d.ts +32 -15
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +104 -76
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/scenegraph/model-node.cjs +2 -0
- package/dist/scenegraph/model-node.d.ts +4 -0
- package/dist/scenegraph/model-node.d.ts.map +1 -1
- package/dist/scenegraph/model-node.js +2 -0
- package/dist/scenegraph/model-node.js.map +1 -1
- package/dist/splats/gpu-paged-splat-renderer.cjs +52 -8
- package/dist/splats/gpu-paged-splat-renderer.d.ts +16 -3
- package/dist/splats/gpu-paged-splat-renderer.d.ts.map +1 -1
- package/dist/splats/gpu-paged-splat-renderer.js +55 -9
- package/dist/splats/gpu-paged-splat-renderer.js.map +1 -1
- package/dist/splats/gpu-paged-splat-shaders.cjs +3 -1
- package/dist/splats/gpu-paged-splat-shaders.d.ts.map +1 -1
- package/dist/splats/gpu-paged-splat-shaders.js +3 -1
- package/dist/splats/gpu-paged-splat-shaders.js.map +1 -1
- package/dist/splats/index.cjs.map +2 -2
- package/dist/text/fonts/atlas/browser-font-atlas.cjs +10 -1
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts +3 -1
- package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -1
- package/dist/text/fonts/atlas/browser-font-atlas.js +10 -2
- package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -1
- package/dist/text/fonts/atlas/lru-cache.cjs +4 -0
- package/dist/text/fonts/atlas/lru-cache.d.ts +3 -1
- package/dist/text/fonts/atlas/lru-cache.d.ts.map +1 -1
- package/dist/text/fonts/atlas/lru-cache.js +4 -0
- package/dist/text/fonts/atlas/lru-cache.js.map +1 -1
- package/dist/text/fonts/index.cjs +2 -0
- package/dist/text/fonts/index.cjs.map +1 -1
- package/dist/text/fonts/index.d.ts +1 -1
- package/dist/text/fonts/index.d.ts.map +1 -1
- package/dist/text/fonts/index.js +1 -1
- package/dist/text/fonts/index.js.map +1 -1
- package/dist/text/index.cjs.map +1 -1
- package/package.json +8 -8
- package/src/animation/animation-track.ts +5 -0
- package/src/animation/node-animation-binding.ts +9 -8
- package/src/animation/scenegraph-gpu-animation-layout.ts +195 -0
- package/src/animation/scenegraph-gpu-animation.ts +340 -0
- package/src/arrow/arrow-picking.ts +23 -11
- package/src/audio/audio-controller.ts +4 -1
- package/src/audio/audio-graph.ts +46 -25
- package/src/effects/README.md +38 -14
- package/src/effects/glfx-effects.ts +227 -0
- package/src/effects/graph/gpu-effect-operation.ts +601 -0
- package/src/effects/graph/temporal-graph-history.ts +46 -0
- package/src/effects/index.ts +81 -19
- package/src/effects/passes/postprocessing/fxaa/fxaa.ts +8 -0
- package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +8 -0
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +219 -19
- package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +6 -6
- package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +45 -45
- package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +88 -68
- package/src/effects/passes/screen-space/copy-pass.ts +4 -0
- package/src/effects/passes/screen-space/depth-aware-blur.ts +13 -3
- package/src/effects/passes/screen-space/dof.ts +20 -3
- package/src/effects/passes/screen-space/gtao.ts +91 -65
- package/src/effects/passes/screen-space/hdr-auto-exposure.ts +109 -84
- package/src/effects/passes/screen-space/height-fog.ts +18 -3
- package/src/effects/passes/screen-space/motion-blur.ts +8 -7
- package/src/effects/passes/screen-space/outlines.ts +143 -17
- package/src/effects/passes/screen-space/screen-space-global-illumination.ts +75 -64
- package/src/effects/passes/screen-space/screen-space-reflections.ts +158 -95
- package/src/effects/passes/screen-space/selection-outline.ts +11 -0
- package/src/effects/passes/screen-space/ssao.ts +79 -46
- package/src/effects/passes/screen-space/temporal-antialiasing.ts +43 -33
- package/src/effects/passes/screen-space/temporal-frame.ts +33 -0
- package/src/effects/passes/screen-space/volumetric-fog.ts +30 -24
- package/src/effects/temporal-upscale/index.ts +20 -0
- package/src/effects/temporal-upscale/temporal-math.ts +308 -0
- package/src/effects/temporal-upscale/temporal-upscale-shaders.ts +326 -0
- package/src/effects/temporal-upscale/temporal-upscaler.ts +538 -0
- package/src/experimental-controls.ts +13 -1
- package/src/experimental-materials.ts +37 -1
- package/src/experimental-textures.ts +9 -1
- package/src/experimental-webxr.ts +18 -1
- package/src/gltf/gltf/create-gltf-model.ts +59 -90
- package/src/gltf/gltf/create-scenegraph-from-gltf.ts +71 -5
- package/src/gltf/gltf/gltf-animated-crowd.ts +30 -177
- package/src/gltf/gltf/gltf-animation-nodes.ts +82 -0
- package/src/gltf/gltf/gltf-animator.ts +15 -4
- package/src/gltf/gltf/gltf-gpu-animation-controller.ts +88 -0
- package/src/gltf/gltf/gltf-gpu-animation.ts +53 -60
- package/src/gltf/index.ts +5 -0
- package/src/gltf/parsers/parse-gltf.ts +12 -2
- package/src/graph/physics/index.ts +4 -0
- package/src/graph/physics/physics-controller-geometry.ts +33 -1
- package/src/index.ts +25 -0
- package/src/lighting/ambient-occlusion-pass.ts +62 -28
- package/src/lighting/clustered-light-grid.ts +87 -30
- package/src/lighting/contact-shadow-composite.ts +80 -52
- package/src/lighting/contact-shadow-pass.ts +59 -39
- package/src/lighting/cortao/cortao-occluder-lookup-table.ts +138 -0
- package/src/lighting/cortao/cortao-parameters.ts +218 -0
- package/src/lighting/cortao/cortao-pass.ts +136 -0
- package/src/lighting/cortao/cortao-passes.ts +50 -0
- package/src/lighting/cortao/cortao-shaders-wgsl.ts +633 -0
- package/src/lighting/cortao/cortao-shaders.ts +674 -0
- package/src/lighting/cortao/cortao-upsample.ts +177 -0
- package/src/lighting/cortao/cortao-webgl-passes.ts +284 -0
- package/src/lighting/cortao/cortao-webgpu-passes.ts +430 -0
- package/src/lighting/index.ts +12 -3
- package/src/lighting/shadow-map-renderer.ts +57 -43
- package/src/model/gpu-vector-model.ts +47 -18
- package/src/passes/effect-renderer.ts +332 -0
- package/src/passes/scene-capture-pass.ts +51 -0
- package/src/passes/shader-pass-renderer.ts +164 -115
- package/src/scenegraph/model-node.ts +5 -0
- package/src/splats/README.md +1 -1
- package/src/splats/gpu-paged-splat-renderer.ts +77 -9
- package/src/splats/gpu-paged-splat-shaders.ts +7 -1
- package/src/text/fonts/atlas/browser-font-atlas.ts +12 -2
- package/src/text/fonts/atlas/lru-cache.ts +6 -1
- package/src/text/fonts/index.ts +1 -0
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var volumetric_fog_exports = {};
|
|
19
19
|
__export(volumetric_fog_exports, {
|
|
20
|
-
|
|
20
|
+
volumetricFog: () => volumetricFog,
|
|
21
21
|
volumetricFogPass: () => volumetricFogPass
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(volumetric_fog_exports);
|
|
@@ -82,28 +82,31 @@ fn volumetricFog_sampleColor(
|
|
|
82
82
|
},
|
|
83
83
|
passes: [{ sampler: true }]
|
|
84
84
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
const volumetricFogOptionDefaults = {
|
|
86
|
+
mode: "screen-space"
|
|
87
|
+
};
|
|
88
|
+
const volumetricFog = {
|
|
89
|
+
optionDefaults: volumetricFogOptionDefaults,
|
|
90
|
+
variants: { option: "mode", values: { height: import_height_fog.heightFog } },
|
|
91
|
+
name: "volumetricFogCompositeShaderPass",
|
|
92
|
+
resources: { fogHistory: { lifetime: "history", initialize: "original" } },
|
|
93
|
+
passes: [
|
|
94
|
+
{
|
|
95
|
+
kind: "fullscreen",
|
|
96
|
+
shaderPass: volumetricFogPass,
|
|
97
|
+
inputs: { sourceTexture: "previous", historyTexture: "fogHistory" },
|
|
98
|
+
output: "fogHistory"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
kind: "fullscreen",
|
|
102
|
+
shaderPass: import_copy_pass.copyPass,
|
|
103
|
+
inputs: { sourceTexture: "fogHistory" },
|
|
104
|
+
output: "previous"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
105
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
106
109
|
0 && (module.exports = {
|
|
107
|
-
|
|
110
|
+
volumetricFog,
|
|
108
111
|
volumetricFogPass
|
|
109
112
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CompositeShaderPass } from '@luma.gl/shaders';
|
|
2
1
|
export type VolumetricFogCompositeShaderPassOptions = {
|
|
3
2
|
/** Existing stylized screen-space fog, or analytic metre-space height fog without history. */
|
|
4
3
|
mode?: 'screen-space' | 'height';
|
|
@@ -11,6 +10,7 @@ type FogUniforms = {
|
|
|
11
10
|
historyWeight: number;
|
|
12
11
|
time: number;
|
|
13
12
|
};
|
|
13
|
+
/** Selects temporally accumulated screen-space fog or analytic height fog. */
|
|
14
14
|
export declare const volumetricFogPass: {
|
|
15
15
|
readonly name: "volumetricFog";
|
|
16
16
|
readonly source: "struct volumetricFogUniforms {\n fogColor: vec4f,\n density: f32,\n heightFalloff: f32,\n scattering: f32,\n historyWeight: f32,\n time: f32,\n};\n@group(0) @binding(auto) var<uniform> volumetricFog: volumetricFogUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n@group(0) @binding(auto) var historyTexture: texture_2d<f32>;\n@group(0) @binding(auto) var historyTextureSampler: sampler;\nfn volumetricFog_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let sourceColor = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n let depth = textureSample(depthTexture, depthTextureSampler, texCoord);\n let noise = fract(sin(dot(texCoord * vec2f(textureDimensions(depthTexture)) + volumetricFog.time, vec2f(12.9898, 78.233))) * 43758.5453);\n var opticalDepth = 0.0;\n for (var index: i32 = 0; index < 20; index++) {\n let distance = (f32(index) + noise) / 20.0 * depth;\n let heightDensity = exp(-max((texCoord.y - 0.42) + distance * 0.18, 0.0) * volumetricFog.heightFalloff);\n opticalDepth += heightDensity * volumetricFog.density * depth / 20.0;\n }\n let fogAmount = clamp(1.0 - exp(-opticalDepth * 8.0), 0.0, 0.96);\n let sun = pow(max(1.0 - distance(texCoord, vec2f(0.72, 0.24)) * 1.7, 0.0), 8.0) * volumetricFog.scattering;\n let fogged = vec4f(mix(sourceColor.rgb, volumetricFog.fogColor.rgb + sun * volumetricFog.fogColor.a, fogAmount), sourceColor.a);\n let history = textureSample(historyTexture, historyTextureSampler, texCoord);\n return mix(fogged, history, volumetricFog.historyWeight);\n}";
|
|
@@ -63,6 +63,165 @@ export declare const volumetricFogPass: {
|
|
|
63
63
|
readonly sampler: true;
|
|
64
64
|
}];
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
/** Selects temporally accumulated screen-space fog or analytic height fog. */
|
|
67
|
+
export declare const volumetricFog: {
|
|
68
|
+
readonly optionDefaults: Required<VolumetricFogCompositeShaderPassOptions>;
|
|
69
|
+
readonly variants: {
|
|
70
|
+
readonly option: "mode";
|
|
71
|
+
readonly values: {
|
|
72
|
+
readonly height: {
|
|
73
|
+
readonly name: "heightFogCompositeShaderPass";
|
|
74
|
+
readonly resources: {};
|
|
75
|
+
readonly passes: [{
|
|
76
|
+
readonly kind: "fullscreen";
|
|
77
|
+
readonly shaderPass: {
|
|
78
|
+
readonly name: "heightFogPass";
|
|
79
|
+
readonly dependencies: [{
|
|
80
|
+
readonly name: "heightFogFunctions";
|
|
81
|
+
readonly dependencies: [{
|
|
82
|
+
readonly name: "valueNoise";
|
|
83
|
+
readonly fs: "\nfloat valueNoise_hash(vec2 cell) {\n vec3 value = fract(vec3(cell.x, cell.y, cell.x) * 0.1031);\n value += dot(value, value.yzx + 33.33);\n return fract((value.x + value.y) * value.z);\n}\nfloat valueNoise_noise(vec2 position) {\n vec2 cell = floor(position);\n vec2 fraction = fract(position);\n vec2 blend = fraction * fraction * (3.0 - 2.0 * fraction);\n return mix(mix(valueNoise_hash(cell), valueNoise_hash(cell + vec2(1.0, 0.0)), blend.x),\n mix(valueNoise_hash(cell + vec2(0.0, 1.0)), valueNoise_hash(cell + vec2(1.0)), blend.x), blend.y);\n}\n\nfloat valueNoise_hash3(vec3 cell) {\n vec3 value = fract(cell * 0.1031);\n value += dot(value, value.yzx + 33.33);\n return fract((value.x + value.y) * value.z);\n}\nfloat valueNoise_noise3(vec3 position) {\n vec3 cell = floor(position);\n vec3 fraction = fract(position);\n vec3 blend = fraction * fraction * (3.0 - 2.0 * fraction);\n float bottom = mix(mix(valueNoise_hash3(cell), valueNoise_hash3(cell + vec3(1.0, 0.0, 0.0)), blend.x),\n mix(valueNoise_hash3(cell + vec3(0.0, 1.0, 0.0)), valueNoise_hash3(cell + vec3(1.0, 1.0, 0.0)), blend.x), blend.y);\n float top = mix(mix(valueNoise_hash3(cell + vec3(0.0, 0.0, 1.0)), valueNoise_hash3(cell + vec3(1.0, 0.0, 1.0)), blend.x),\n mix(valueNoise_hash3(cell + vec3(0.0, 1.0, 1.0)), valueNoise_hash3(cell + vec3(1.0)), blend.x), blend.y);\n return mix(bottom, top, blend.z);\n}\n";
|
|
84
|
+
readonly source: "\nfn valueNoise_hash(cell: vec2f) -> f32 {\n var value = fract(vec3f(cell.x, cell.y, cell.x) * 0.1031);\n value += vec3f(dot(value, value.yzx + vec3f(33.33)));\n return fract((value.x + value.y) * value.z);\n}\nfn valueNoise_noise(position: vec2f) -> f32 {\n let cell = floor(position);\n let fraction = fract(position);\n let blend = fraction * fraction * (vec2f(3.0) - 2.0 * fraction);\n return mix(mix(valueNoise_hash(cell), valueNoise_hash(cell + vec2f(1.0, 0.0)), blend.x),\n mix(valueNoise_hash(cell + vec2f(0.0, 1.0)), valueNoise_hash(cell + vec2f(1.0)), blend.x), blend.y);\n}\n\nfn valueNoise_hash3(cell: vec3f) -> f32 {\n var value = fract(cell * 0.1031);\n value += vec3f(dot(value, value.yzx + vec3f(33.33)));\n return fract((value.x + value.y) * value.z);\n}\nfn valueNoise_noise3(position: vec3f) -> f32 {\n let cell = floor(position);\n let fraction = fract(position);\n let blend = fraction * fraction * (vec3f(3.0) - 2.0 * fraction);\n let bottom = mix(mix(valueNoise_hash3(cell), valueNoise_hash3(cell + vec3f(1.0, 0.0, 0.0)), blend.x),\n mix(valueNoise_hash3(cell + vec3f(0.0, 1.0, 0.0)), valueNoise_hash3(cell + vec3f(1.0, 1.0, 0.0)), blend.x), blend.y);\n let top = mix(mix(valueNoise_hash3(cell + vec3f(0.0, 0.0, 1.0)), valueNoise_hash3(cell + vec3f(1.0, 0.0, 1.0)), blend.x),\n mix(valueNoise_hash3(cell + vec3f(0.0, 1.0, 1.0)), valueNoise_hash3(cell + vec3f(1.0)), blend.x), blend.y);\n return mix(bottom, top, blend.z);\n}\n";
|
|
85
|
+
}];
|
|
86
|
+
readonly fs: "\nfloat heightFog_getRayTransmittance(float rayLength, float cameraHeight, float fragmentHeight, float density, float baseHeight, float heightFalloff) {\n float startHeight = (cameraHeight - baseHeight) * max(heightFalloff, 0.0);\n float endHeight = (fragmentHeight - baseHeight) * max(heightFalloff, 0.0);\n float lowerHeight = min(startHeight, endHeight);\n float upperHeight = max(startHeight, endHeight);\n float averageDensity = 1.0;\n if (upperHeight > 0.0) {\n float heightSpan = upperHeight - lowerHeight;\n if (heightSpan < 0.001) {\n averageDensity = exp(-max((startHeight + endHeight) * 0.5, 0.0));\n } else if (lowerHeight >= 0.0) {\n averageDensity = (exp(-lowerHeight) - exp(-upperHeight)) / heightSpan;\n } else {\n averageDensity = (-lowerHeight + 1.0 - exp(-upperHeight)) / heightSpan;\n }\n }\n return exp(-max(density, 0.0) * rayLength * averageDensity);\n}\nfloat heightFog_hash(vec2 cell) { return valueNoise_hash(cell); }\nfloat heightFog_noise(vec2 position) { return valueNoise_noise(position); }\n// Integrate drifting density along the ray so wisps occupy space rather than coat surfaces.\nfloat heightFog_getSpatialTransmittance(vec3 camera, vec3 position, vec3 upDirection,\n float density, float baseHeight, float heightFalloff, float variation, float wispScale,\n float time, vec3 velocity, float evolutionSpeed) {\n if (density <= 0.0) return 1.0;\n float rayLength = distance(camera, position);\n if (variation <= 0.0) return heightFog_getRayTransmittance(rayLength, dot(camera, upDirection),\n dot(position, upDirection), density, baseHeight, heightFalloff);\n vec3 reference = abs(upDirection.z) < 0.9 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);\n vec3 horizontal = normalize(cross(reference, upDirection));\n vec3 forward = cross(upDirection, horizontal);\n float transmittance = 1.0;\n for (int sampleIndex = 0; sampleIndex < 12; sampleIndex++) {\n float fraction = float(sampleIndex) / 12.0;\n vec3 start = mix(camera, position, fraction);\n vec3 end = mix(camera, position, fraction + 1.0 / 12.0);\n vec3 samplePosition = (start + end) * 0.5 - velocity * time;\n vec2 coordinate = vec2(dot(samplePosition, horizontal), dot(samplePosition, forward)) / max(wispScale, 1.0);\n coordinate.y = coordinate.y * 1.8 + dot(samplePosition, upDirection) / max(wispScale, 1.0);\n float warp = heightFog_noise(coordinate * 0.45 + vec2(8.3, 2.7) + time * evolutionSpeed * vec2(1.0, 0.37));\n float broad = heightFog_noise(coordinate + vec2(warp * 2.0, warp * 0.8));\n float detail = heightFog_noise(mat2(0.8, 0.6, -0.6, 0.8) * coordinate * 2.17 + vec2(17.1, 9.2) + broad * 0.7);\n float modulation = mix(1.0, 1.8 * smoothstep(0.15, 0.85, broad * 0.7 + detail * 0.3), clamp(variation, 0.0, 1.0));\n transmittance *= heightFog_getRayTransmittance(rayLength / 12.0, dot(start, upDirection),\n dot(end, upDirection), density * modulation, baseHeight, heightFalloff);\n }\n return transmittance;\n}\n\n";
|
|
87
|
+
readonly source: "\nfn heightFog_getRayTransmittance(rayLength: f32, cameraHeight: f32, fragmentHeight: f32, density: f32, baseHeight: f32, heightFalloff: f32) -> f32 {\n let startHeight = (cameraHeight - baseHeight) * max(heightFalloff, 0.0);\n let endHeight = (fragmentHeight - baseHeight) * max(heightFalloff, 0.0);\n let lowerHeight = min(startHeight, endHeight);\n let upperHeight = max(startHeight, endHeight);\n var averageDensity = 1.0;\n if (upperHeight > 0.0) {\n let heightSpan = upperHeight - lowerHeight;\n if (heightSpan < 0.001) {\n averageDensity = exp(-max((startHeight + endHeight) * 0.5, 0.0));\n } else if (lowerHeight >= 0.0) {\n averageDensity = (exp(-lowerHeight) - exp(-upperHeight)) / heightSpan;\n } else {\n averageDensity = (-lowerHeight + 1.0 - exp(-upperHeight)) / heightSpan;\n }\n }\n return exp(-max(density, 0.0) * rayLength * averageDensity);\n}\nfn heightFog_hash(cell: vec2f) -> f32 { return valueNoise_hash(cell); }\nfn heightFog_noise(position: vec2f) -> f32 { return valueNoise_noise(position); }\n// Integrate drifting density along the ray so wisps occupy space rather than coat surfaces.\nfn heightFog_getSpatialTransmittance(camera: vec3f, position: vec3f, upDirection: vec3f,\n density: f32, baseHeight: f32, heightFalloff: f32, variation: f32, wispScale: f32,\n time: f32, velocity: vec3f, evolutionSpeed: f32) -> f32 {\n if (density <= 0.0) { return 1.0; }\n let rayLength = distance(camera, position);\n if (variation <= 0.0) { return heightFog_getRayTransmittance(rayLength, dot(camera, upDirection),\n dot(position, upDirection), density, baseHeight, heightFalloff); }\n let reference = select(vec3f(0.0, 1.0, 0.0), vec3f(0.0, 0.0, 1.0), abs(upDirection.z) < 0.9);\n let horizontal = normalize(cross(reference, upDirection));\n let forward = cross(upDirection, horizontal);\n var transmittance = 1.0;\n for (var sampleIndex = 0; sampleIndex < 12; sampleIndex++) {\n let fraction = f32(sampleIndex) / 12.0;\n let start = mix(camera, position, fraction);\n let end = mix(camera, position, fraction + 1.0 / 12.0);\n let samplePosition = (start + end) * 0.5 - velocity * time;\n var coordinate = vec2f(dot(samplePosition, horizontal), dot(samplePosition, forward)) / max(wispScale, 1.0);\n coordinate.y = coordinate.y * 1.8 + dot(samplePosition, upDirection) / max(wispScale, 1.0);\n let warp = heightFog_noise(coordinate * 0.45 + vec2f(8.3, 2.7) + time * evolutionSpeed * vec2f(1.0, 0.37));\n let broad = heightFog_noise(coordinate + vec2f(warp * 2.0, warp * 0.8));\n let detail = heightFog_noise(mat2x2f(vec2f(0.8, 0.6), vec2f(-0.6, 0.8)) * coordinate * 2.17 + vec2f(17.1, 9.2) + vec2f(broad * 0.7));\n let modulation = mix(1.0, 1.8 * smoothstep(0.15, 0.85, broad * 0.7 + detail * 0.3), clamp(variation, 0.0, 1.0));\n transmittance *= heightFog_getRayTransmittance(rayLength / 12.0, dot(start, upDirection),\n dot(end, upDirection), density * modulation, baseHeight, heightFalloff);\n }\n return transmittance;\n}\n\n";
|
|
88
|
+
}];
|
|
89
|
+
readonly bindingLayout: readonly [{
|
|
90
|
+
readonly name: "heightFogPass";
|
|
91
|
+
readonly group: 0;
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "depthTexture";
|
|
94
|
+
readonly group: 0;
|
|
95
|
+
}];
|
|
96
|
+
readonly uniformTypes: {
|
|
97
|
+
readonly inverseViewProjectionMatrix: "mat4x4<f32>";
|
|
98
|
+
readonly cameraPosition: "vec3<f32>";
|
|
99
|
+
readonly backgroundDistance: "f32";
|
|
100
|
+
readonly upDirection: "vec3<f32>";
|
|
101
|
+
readonly backgroundDepth: "f32";
|
|
102
|
+
readonly clipDepthRange: "vec2<f32>";
|
|
103
|
+
readonly color: "vec3<f32>";
|
|
104
|
+
readonly density: "f32";
|
|
105
|
+
readonly baseHeight: "f32";
|
|
106
|
+
readonly heightFalloff: "f32";
|
|
107
|
+
readonly variation: "f32";
|
|
108
|
+
readonly wispScale: "f32";
|
|
109
|
+
readonly velocity: "vec3<f32>";
|
|
110
|
+
readonly time: "f32";
|
|
111
|
+
readonly evolutionSpeed: "f32";
|
|
112
|
+
};
|
|
113
|
+
readonly defaultUniforms: {
|
|
114
|
+
readonly inverseViewProjectionMatrix: readonly [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
115
|
+
readonly cameraPosition: [0, 0, 0];
|
|
116
|
+
readonly backgroundDistance: 0;
|
|
117
|
+
readonly upDirection: [0, 0, 1];
|
|
118
|
+
readonly backgroundDepth: 1;
|
|
119
|
+
readonly clipDepthRange: [0, 1];
|
|
120
|
+
readonly color: [0.65, 0.72, 0.78];
|
|
121
|
+
readonly density: 0;
|
|
122
|
+
readonly baseHeight: 0;
|
|
123
|
+
readonly heightFalloff: 0.01;
|
|
124
|
+
readonly variation: 0;
|
|
125
|
+
readonly wispScale: 160;
|
|
126
|
+
readonly velocity: [0, 0, 0];
|
|
127
|
+
readonly time: 0;
|
|
128
|
+
readonly evolutionSpeed: 0;
|
|
129
|
+
};
|
|
130
|
+
readonly source: "\nstruct heightFogPassUniforms {\n color: vec3f,\n density: f32,\n baseHeight: f32,\n heightFalloff: f32,\n variation: f32,\n wispScale: f32,\n velocity: vec3f,\n time: f32,\n evolutionSpeed: f32,\n inverseViewProjectionMatrix: mat4x4f,\n cameraPosition: vec3f,\n backgroundDistance: f32,\n upDirection: vec3f,\n backgroundDepth: f32,\n clipDepthRange: vec2f,\n};\n@group(0) @binding(auto) var<uniform> heightFogPass: heightFogPassUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\nfn heightFogPass_sampleColor(sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let color = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0);\n if (heightFogPass.density <= 0.0) { return color; }\n let dimensions = textureDimensions(depthTexture);\n let coordinate = clamp(vec2i(texCoord * vec2f(dimensions)), vec2i(0), vec2i(dimensions) - 1);\n let depth = textureLoad(depthTexture, coordinate, 0);\n let background = abs(depth - heightFogPass.backgroundDepth) < 0.0000001;\n if (background && heightFogPass.backgroundDistance <= 0.0) { return color; }\n // A finite interior point defines the ray even for an infinite far plane.\n let clipDepth = mix(heightFogPass.clipDepthRange.x, heightFogPass.clipDepthRange.y, select(depth, 0.5, background));\n let homogeneous = heightFogPass.inverseViewProjectionMatrix * vec4f(texCoord * vec2f(2.0, -2.0) + vec2f(-1.0, 1.0), clipDepth, 1.0);\n if (abs(homogeneous.w) < 0.000001) { return color; }\n var position = homogeneous.xyz / homogeneous.w;\n if (background) {\n let direction = position - heightFogPass.cameraPosition;\n position = heightFogPass.cameraPosition + direction / max(length(direction), 0.000001) * heightFogPass.backgroundDistance;\n }\n let transmittance = heightFog_getSpatialTransmittance(heightFogPass.cameraPosition, position, heightFogPass.upDirection,\n heightFogPass.density, heightFogPass.baseHeight, heightFogPass.heightFalloff,\n heightFogPass.variation, heightFogPass.wispScale, heightFogPass.time, heightFogPass.velocity, heightFogPass.evolutionSpeed);\n return vec4f(mix(heightFogPass.color, color.rgb, transmittance), color.a);\n}\n";
|
|
131
|
+
readonly fs: "\nlayout(std140) uniform heightFogPassUniforms {\n vec3 color;\n float density;\n float baseHeight;\n float heightFalloff;\n float variation;\n float wispScale;\n vec3 velocity;\n float time;\n float evolutionSpeed;\n mat4 inverseViewProjectionMatrix;\n vec3 cameraPosition;\n float backgroundDistance;\n vec3 upDirection;\n float backgroundDepth;\n vec2 clipDepthRange;\n} heightFogPass;\nuniform highp sampler2D depthTexture;\nvec4 heightFogPass_sampleColor(sampler2D sourceTexture, vec2 texSize, vec2 texCoord) {\n vec4 color = texture(sourceTexture, texCoord);\n if (heightFogPass.density <= 0.0) return color;\n ivec2 dimensions = textureSize(depthTexture, 0);\n ivec2 coordinate = clamp(ivec2(texCoord * vec2(dimensions)), ivec2(0), dimensions - 1);\n float depth = texelFetch(depthTexture, coordinate, 0).r;\n bool background = abs(depth - heightFogPass.backgroundDepth) < 0.0000001;\n if (background && heightFogPass.backgroundDistance <= 0.0) return color;\n float clipDepth = mix(heightFogPass.clipDepthRange.x, heightFogPass.clipDepthRange.y, background ? 0.5 : depth);\n vec4 homogeneous = heightFogPass.inverseViewProjectionMatrix * vec4(texCoord * 2.0 - 1.0, clipDepth, 1.0);\n if (abs(homogeneous.w) < 0.000001) return color;\n vec3 position = homogeneous.xyz / homogeneous.w;\n if (background) {\n vec3 direction = position - heightFogPass.cameraPosition;\n position = heightFogPass.cameraPosition + direction / max(length(direction), 0.000001) * heightFogPass.backgroundDistance;\n }\n float transmittance = heightFog_getSpatialTransmittance(heightFogPass.cameraPosition, position, heightFogPass.upDirection,\n heightFogPass.density, heightFogPass.baseHeight, heightFogPass.heightFalloff,\n heightFogPass.variation, heightFogPass.wispScale, heightFogPass.time, heightFogPass.velocity, heightFogPass.evolutionSpeed);\n return vec4(mix(heightFogPass.color, color.rgb, transmittance), color.a);\n}\n";
|
|
132
|
+
readonly passes: [{
|
|
133
|
+
readonly sampler: true;
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
136
|
+
readonly inputs: {
|
|
137
|
+
readonly sourceTexture: "previous";
|
|
138
|
+
};
|
|
139
|
+
readonly output: "previous";
|
|
140
|
+
}];
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
readonly name: "volumetricFogCompositeShaderPass";
|
|
145
|
+
readonly resources: {
|
|
146
|
+
readonly fogHistory: {
|
|
147
|
+
readonly lifetime: "history";
|
|
148
|
+
readonly initialize: "original";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
readonly passes: [{
|
|
152
|
+
readonly kind: "fullscreen";
|
|
153
|
+
readonly shaderPass: {
|
|
154
|
+
readonly name: "volumetricFog";
|
|
155
|
+
readonly source: "struct volumetricFogUniforms {\n fogColor: vec4f,\n density: f32,\n heightFalloff: f32,\n scattering: f32,\n historyWeight: f32,\n time: f32,\n};\n@group(0) @binding(auto) var<uniform> volumetricFog: volumetricFogUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n@group(0) @binding(auto) var historyTexture: texture_2d<f32>;\n@group(0) @binding(auto) var historyTextureSampler: sampler;\nfn volumetricFog_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let sourceColor = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n let depth = textureSample(depthTexture, depthTextureSampler, texCoord);\n let noise = fract(sin(dot(texCoord * vec2f(textureDimensions(depthTexture)) + volumetricFog.time, vec2f(12.9898, 78.233))) * 43758.5453);\n var opticalDepth = 0.0;\n for (var index: i32 = 0; index < 20; index++) {\n let distance = (f32(index) + noise) / 20.0 * depth;\n let heightDensity = exp(-max((texCoord.y - 0.42) + distance * 0.18, 0.0) * volumetricFog.heightFalloff);\n opticalDepth += heightDensity * volumetricFog.density * depth / 20.0;\n }\n let fogAmount = clamp(1.0 - exp(-opticalDepth * 8.0), 0.0, 0.96);\n let sun = pow(max(1.0 - distance(texCoord, vec2f(0.72, 0.24)) * 1.7, 0.0), 8.0) * volumetricFog.scattering;\n let fogged = vec4f(mix(sourceColor.rgb, volumetricFog.fogColor.rgb + sun * volumetricFog.fogColor.a, fogAmount), sourceColor.a);\n let history = textureSample(historyTexture, historyTextureSampler, texCoord);\n return mix(fogged, history, volumetricFog.historyWeight);\n}";
|
|
156
|
+
readonly bindingLayout: readonly [{
|
|
157
|
+
readonly name: "depthTexture";
|
|
158
|
+
readonly group: 0;
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "historyTexture";
|
|
161
|
+
readonly group: 0;
|
|
162
|
+
}];
|
|
163
|
+
readonly uniforms: FogUniforms;
|
|
164
|
+
readonly uniformTypes: {
|
|
165
|
+
readonly fogColor: "vec4<f32>";
|
|
166
|
+
readonly density: "f32";
|
|
167
|
+
readonly heightFalloff: "f32";
|
|
168
|
+
readonly scattering: "f32";
|
|
169
|
+
readonly historyWeight: "f32";
|
|
170
|
+
readonly time: "f32";
|
|
171
|
+
};
|
|
172
|
+
readonly propTypes: {
|
|
173
|
+
readonly fogColor: {
|
|
174
|
+
readonly value: readonly [0.18, 0.34, 0.48, 0.6];
|
|
175
|
+
};
|
|
176
|
+
readonly density: {
|
|
177
|
+
readonly value: 0.22;
|
|
178
|
+
readonly min: 0;
|
|
179
|
+
readonly softMax: 1;
|
|
180
|
+
};
|
|
181
|
+
readonly heightFalloff: {
|
|
182
|
+
readonly value: 3;
|
|
183
|
+
readonly min: 0;
|
|
184
|
+
readonly softMax: 10;
|
|
185
|
+
};
|
|
186
|
+
readonly scattering: {
|
|
187
|
+
readonly value: 0.35;
|
|
188
|
+
readonly min: 0;
|
|
189
|
+
readonly softMax: 2;
|
|
190
|
+
};
|
|
191
|
+
readonly historyWeight: {
|
|
192
|
+
readonly value: 0.82;
|
|
193
|
+
readonly min: 0;
|
|
194
|
+
readonly max: 0.98;
|
|
195
|
+
};
|
|
196
|
+
readonly time: {
|
|
197
|
+
readonly value: 0;
|
|
198
|
+
readonly private: true;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
readonly passes: [{
|
|
202
|
+
readonly sampler: true;
|
|
203
|
+
}];
|
|
204
|
+
};
|
|
205
|
+
readonly inputs: {
|
|
206
|
+
readonly sourceTexture: "previous";
|
|
207
|
+
readonly historyTexture: "fogHistory";
|
|
208
|
+
};
|
|
209
|
+
readonly output: "fogHistory";
|
|
210
|
+
}, {
|
|
211
|
+
readonly kind: "fullscreen";
|
|
212
|
+
readonly shaderPass: {
|
|
213
|
+
readonly name: "advancedCopy";
|
|
214
|
+
readonly source: "fn advancedCopy_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f { return textureSample(sourceTexture, sourceTextureSampler, texCoord); }";
|
|
215
|
+
readonly fs: "\nvec4 advancedCopy_sampleColor(sampler2D sourceTexture, vec2 texSize, vec2 texCoord) {\n return texture(sourceTexture, texCoord);\n}";
|
|
216
|
+
readonly passes: [{
|
|
217
|
+
readonly sampler: true;
|
|
218
|
+
}];
|
|
219
|
+
};
|
|
220
|
+
readonly inputs: {
|
|
221
|
+
readonly sourceTexture: "fogHistory";
|
|
222
|
+
};
|
|
223
|
+
readonly output: "previous";
|
|
224
|
+
}];
|
|
225
|
+
};
|
|
67
226
|
export {};
|
|
68
227
|
//# sourceMappingURL=volumetric-fog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetric-fog.d.ts","sourceRoot":"","sources":["../../../../src/effects/passes/screen-space/volumetric-fog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumetric-fog.d.ts","sourceRoot":"","sources":["../../../../src/effects/passes/screen-space/volumetric-fog.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,uCAAuC,GAAG;IACpD,8FAA8F;IAC9F,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC;CAClC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB;;;;;;;;;;uBAsCZ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBE,CAAC;AAOhC,8EAA8E;AAC9E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA1BR,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C6D,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
import { copyPass } from "./copy-pass.js";
|
|
5
|
-
import {
|
|
5
|
+
import { heightFog } from "./height-fog.js";
|
|
6
|
+
/** Selects temporally accumulated screen-space fog or analytic height fog. */
|
|
6
7
|
export const volumetricFogPass = {
|
|
7
8
|
name: 'volumetricFog',
|
|
8
9
|
source: /* wgsl */ `\
|
|
@@ -60,24 +61,29 @@ fn volumetricFog_sampleColor(
|
|
|
60
61
|
},
|
|
61
62
|
passes: [{ sampler: true }]
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
/** Default to the screen-space fog pass with temporal history. */
|
|
65
|
+
const volumetricFogOptionDefaults = {
|
|
66
|
+
mode: 'screen-space'
|
|
67
|
+
};
|
|
68
|
+
/** Selects temporally accumulated screen-space fog or analytic height fog. */
|
|
69
|
+
export const volumetricFog = {
|
|
70
|
+
optionDefaults: volumetricFogOptionDefaults,
|
|
71
|
+
variants: { option: 'mode', values: { height: heightFog } },
|
|
72
|
+
name: 'volumetricFogCompositeShaderPass',
|
|
73
|
+
resources: { fogHistory: { lifetime: 'history', initialize: 'original' } },
|
|
74
|
+
passes: [
|
|
75
|
+
{
|
|
76
|
+
kind: 'fullscreen',
|
|
77
|
+
shaderPass: volumetricFogPass,
|
|
78
|
+
inputs: { sourceTexture: 'previous', historyTexture: 'fogHistory' },
|
|
79
|
+
output: 'fogHistory'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
kind: 'fullscreen',
|
|
83
|
+
shaderPass: copyPass,
|
|
84
|
+
inputs: { sourceTexture: 'fogHistory' },
|
|
85
|
+
output: 'previous'
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
};
|
|
83
89
|
//# sourceMappingURL=volumetric-fog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetric-fog.js","sourceRoot":"","sources":["../../../../src/effects/passes/screen-space/volumetric-fog.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;
|
|
1
|
+
{"version":3,"file":"volumetric-fog.js","sourceRoot":"","sources":["../../../../src/effects/passes/screen-space/volumetric-fog.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAI5D,OAAO,EAAC,QAAQ,EAAC,uBAAoB;AACrC,OAAO,EAAC,SAAS,EAAC,wBAAqB;AAgBvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BnB;IACA,aAAa,EAAE;QACb,EAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAC;QAChC,EAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAC;KACnC;IACD,QAAQ,EAAE,EAAiB;IAC3B,YAAY,EAAE;QACZ,QAAQ,EAAE,WAAW;QACrB,OAAO,EAAE,KAAK;QACd,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,KAAK;QACpB,IAAI,EAAE,KAAK;KACZ;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAC;QAC1C,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;QAC1C,aAAa,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC;QAC9C,UAAU,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;QAC7C,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAC;QAC/C,IAAI,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;KAChC;IACD,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACI,CAAC;AAEhC,kEAAkE;AAClE,MAAM,2BAA2B,GAAsD;IACrF,IAAI,EAAE,cAAc;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc,EAAE,2BAA2B;IAC3C,QAAQ,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,SAAS,EAAC,EAAC;IACvD,IAAI,EAAE,kCAAkC;IACxC,SAAS,EAAE,EAAC,UAAU,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAC,EAAC;IACtE,MAAM,EAAE;QACN;YACE,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE,iBAAiB;YAC7B,MAAM,EAAE,EAAC,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAC;YACjE,MAAM,EAAE,YAAY;SACrB;QACD;YACE,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,EAAC,aAAa,EAAE,YAAY,EAAC;YACrC,MAAM,EAAE,UAAU;SACnB;KACF;CACuF,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var temporal_upscale_exports = {};
|
|
19
|
+
__export(temporal_upscale_exports, {
|
|
20
|
+
TemporalUpscaler: () => import_temporal_upscaler.TemporalUpscaler,
|
|
21
|
+
applyJitterToProjectionMatrix: () => import_temporal_math.applyJitterToProjectionMatrix,
|
|
22
|
+
getJitterOffset: () => import_temporal_math.getJitterOffset,
|
|
23
|
+
getJitterPhaseCount: () => import_temporal_math.getJitterPhaseCount,
|
|
24
|
+
getVelocityFromDepth: () => import_temporal_math.getVelocityFromDepth,
|
|
25
|
+
halton: () => import_temporal_math.halton,
|
|
26
|
+
jitterToClipOffset: () => import_temporal_math.jitterToClipOffset
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(temporal_upscale_exports);
|
|
29
|
+
var import_temporal_math = require("./temporal-math.cjs");
|
|
30
|
+
var import_temporal_upscaler = require("./temporal-upscaler.cjs");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
TemporalUpscaler,
|
|
34
|
+
applyJitterToProjectionMatrix,
|
|
35
|
+
getJitterOffset,
|
|
36
|
+
getJitterPhaseCount,
|
|
37
|
+
getVelocityFromDepth,
|
|
38
|
+
halton,
|
|
39
|
+
jitterToClipOffset
|
|
40
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { halton, getJitterPhaseCount, getJitterOffset, jitterToClipOffset, applyJitterToProjectionMatrix, getVelocityFromDepth } from "./temporal-math.js";
|
|
2
|
+
export type { TemporalVector2, TemporalVector3, VelocityFromDepthOptions } from "./temporal-math.js";
|
|
3
|
+
export { TemporalUpscaler } from "./temporal-upscaler.js";
|
|
4
|
+
export type { TemporalUpscalerProps, TemporalUpscalerRenderOptions, TemporalUpscalerGraphFrame, TemporalUpscalerGraphViews } from "./temporal-upscaler.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/effects/temporal-upscale/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,oBAAoB,EACrB,2BAAwB;AACzB,YAAY,EAAC,eAAe,EAAE,eAAe,EAAE,wBAAwB,EAAC,2BAAwB;AAChG,OAAO,EAAC,gBAAgB,EAAC,+BAA4B;AACrD,YAAY,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC3B,+BAA4B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
export { halton, getJitterPhaseCount, getJitterOffset, jitterToClipOffset, applyJitterToProjectionMatrix, getVelocityFromDepth } from "./temporal-math.js";
|
|
5
|
+
export { TemporalUpscaler } from "./temporal-upscaler.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/effects/temporal-upscale/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,oBAAoB,EACrB,2BAAwB;AAEzB,OAAO,EAAC,gBAAgB,EAAC,+BAA4B"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var temporal_math_exports = {};
|
|
19
|
+
__export(temporal_math_exports, {
|
|
20
|
+
DEFAULT_KERNEL_SHARPNESS: () => DEFAULT_KERNEL_SHARPNESS,
|
|
21
|
+
DEFAULT_RESPONSIVENESS: () => DEFAULT_RESPONSIVENESS,
|
|
22
|
+
applyJitterToProjectionMatrix: () => applyJitterToProjectionMatrix,
|
|
23
|
+
clipToBox: () => clipToBox,
|
|
24
|
+
getCatmullRomWeights: () => getCatmullRomWeights,
|
|
25
|
+
getCurrentBlend: () => getCurrentBlend,
|
|
26
|
+
getForgetting: () => getForgetting,
|
|
27
|
+
getHistoryTrust: () => getHistoryTrust,
|
|
28
|
+
getJitterOffset: () => getJitterOffset,
|
|
29
|
+
getJitterPhaseCount: () => getJitterPhaseCount,
|
|
30
|
+
getKernelScale: () => getKernelScale,
|
|
31
|
+
getLuminanceChange: () => getLuminanceChange,
|
|
32
|
+
getMaximumWeight: () => getMaximumWeight,
|
|
33
|
+
getNextWeight: () => getNextWeight,
|
|
34
|
+
getSampleWeight: () => getSampleWeight,
|
|
35
|
+
getVelocityFromDepth: () => getVelocityFromDepth,
|
|
36
|
+
halton: () => halton,
|
|
37
|
+
isDisoccluded: () => isDisoccluded,
|
|
38
|
+
jitterToClipOffset: () => jitterToClipOffset,
|
|
39
|
+
lanczos2: () => lanczos2,
|
|
40
|
+
reprojectUV: () => reprojectUV,
|
|
41
|
+
rgbToYCoCg: () => rgbToYCoCg,
|
|
42
|
+
yCoCgToRgb: () => yCoCgToRgb
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(temporal_math_exports);
|
|
45
|
+
const DEFAULT_KERNEL_SHARPNESS = 0.85;
|
|
46
|
+
const DEFAULT_RESPONSIVENESS = 0.5;
|
|
47
|
+
function halton(index, base) {
|
|
48
|
+
let fraction = 1;
|
|
49
|
+
let result = 0;
|
|
50
|
+
while (index > 0) {
|
|
51
|
+
fraction /= base;
|
|
52
|
+
result += fraction * (index % base);
|
|
53
|
+
index = Math.floor(index / base);
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
function getJitterPhaseCount(renderWidth, outputWidth) {
|
|
58
|
+
return Math.max(1, Math.ceil(8 * (outputWidth / renderWidth) ** 2));
|
|
59
|
+
}
|
|
60
|
+
function getJitterOffset(frameIndex, phaseCount) {
|
|
61
|
+
const index = frameIndex % phaseCount + 1;
|
|
62
|
+
return [halton(index, 2) - 0.5, halton(index, 3) - 0.5];
|
|
63
|
+
}
|
|
64
|
+
function jitterToClipOffset(jitter, renderSize) {
|
|
65
|
+
return [2 * jitter[0] / renderSize[0], -2 * jitter[1] / renderSize[1]];
|
|
66
|
+
}
|
|
67
|
+
function applyJitterToProjectionMatrix(matrix16ColumnMajor, jitter, renderSize) {
|
|
68
|
+
const result = Array.from(matrix16ColumnMajor);
|
|
69
|
+
const offset = jitterToClipOffset(jitter, renderSize);
|
|
70
|
+
for (let column = 0; column < 4; column++) {
|
|
71
|
+
result[column * 4] += offset[0] * matrix16ColumnMajor[column * 4 + 3];
|
|
72
|
+
result[column * 4 + 1] += offset[1] * matrix16ColumnMajor[column * 4 + 3];
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
function reprojectUV(uv, velocity) {
|
|
77
|
+
return [uv[0] - velocity[0], uv[1] - velocity[1]];
|
|
78
|
+
}
|
|
79
|
+
function transformVector(matrix, vector) {
|
|
80
|
+
return [0, 1, 2, 3].map((row) => vector.reduce((sum, value, column) => sum + matrix[column * 4 + row] * value, 0));
|
|
81
|
+
}
|
|
82
|
+
function getVelocityFromDepth(options) {
|
|
83
|
+
const { uv, depth, jitter, renderSize, currentViewProjectionInverse, previousViewProjection } = options;
|
|
84
|
+
const currentUV = [uv[0] - jitter[0] / renderSize[0], uv[1] - jitter[1] / renderSize[1]];
|
|
85
|
+
const world = transformVector(currentViewProjectionInverse, [
|
|
86
|
+
2 * currentUV[0] - 1,
|
|
87
|
+
1 - 2 * currentUV[1],
|
|
88
|
+
2 * depth - 1,
|
|
89
|
+
1
|
|
90
|
+
]);
|
|
91
|
+
const previous = transformVector(previousViewProjection, world);
|
|
92
|
+
return [
|
|
93
|
+
currentUV[0] - (previous[0] / previous[3] * 0.5 + 0.5),
|
|
94
|
+
currentUV[1] - (0.5 - previous[1] / previous[3] * 0.5),
|
|
95
|
+
(previous[3] - previous[2]) / (2 * previous[3])
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
function rgbToYCoCg([red, green, blue]) {
|
|
99
|
+
return [(red + 2 * green + blue) / 4, (red - blue) / 2, (-red + 2 * green - blue) / 4];
|
|
100
|
+
}
|
|
101
|
+
function yCoCgToRgb([luminance, orange, green]) {
|
|
102
|
+
return [luminance + orange - green, luminance + green, luminance - orange - green];
|
|
103
|
+
}
|
|
104
|
+
function clipToBox(color, boxMin, boxMax) {
|
|
105
|
+
const center = boxMin.map((value, index) => (value + boxMax[index]) / 2);
|
|
106
|
+
let scale = 1;
|
|
107
|
+
for (let component = 0; component < 3; component++) {
|
|
108
|
+
const distance = Math.abs(color[component] - center[component]);
|
|
109
|
+
if (distance > 0) {
|
|
110
|
+
scale = Math.min(scale, (boxMax[component] - boxMin[component]) / (2 * distance));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return color.map((value, index) => center[index] + (value - center[index]) * scale);
|
|
114
|
+
}
|
|
115
|
+
function lanczos2(value) {
|
|
116
|
+
if (value === 0)
|
|
117
|
+
return 1;
|
|
118
|
+
if (Math.abs(value) >= 2)
|
|
119
|
+
return 0;
|
|
120
|
+
const angle = Math.PI * value;
|
|
121
|
+
return Math.sin(angle) * Math.sin(angle / 2) / (angle * angle / 2);
|
|
122
|
+
}
|
|
123
|
+
function getCatmullRomWeights(fraction) {
|
|
124
|
+
const squared = fraction * fraction;
|
|
125
|
+
const cubed = squared * fraction;
|
|
126
|
+
return [
|
|
127
|
+
-0.5 * fraction + squared - 0.5 * cubed,
|
|
128
|
+
1 - 2.5 * squared + 1.5 * cubed,
|
|
129
|
+
0.5 * fraction + 2 * squared - 1.5 * cubed,
|
|
130
|
+
-0.5 * squared + 0.5 * cubed
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
function isDisoccluded(previousOneMinusDepth, expectedPreviousOneMinusDepth, tolerance = 0.05) {
|
|
134
|
+
const expected = Math.max(0, expectedPreviousOneMinusDepth);
|
|
135
|
+
return Math.min(...previousOneMinusDepth) > expected + Math.max(expected * tolerance, 1e-5);
|
|
136
|
+
}
|
|
137
|
+
function getKernelScale(renderSize, outputSize, kernelSharpness = DEFAULT_KERNEL_SHARPNESS) {
|
|
138
|
+
const ratio = Math.min(outputSize[0] / renderSize[0], outputSize[1] / renderSize[1]);
|
|
139
|
+
return Math.min(2, Math.max(1, ratio * Math.min(1, Math.max(0.5, kernelSharpness))));
|
|
140
|
+
}
|
|
141
|
+
function getSampleWeight(distance, kernelScale) {
|
|
142
|
+
return Math.max(0, lanczos2(distance[0] * kernelScale)) * Math.max(0, lanczos2(distance[1] * kernelScale));
|
|
143
|
+
}
|
|
144
|
+
function getMaximumWeight(historyWeightMax = 0.95) {
|
|
145
|
+
const maximum = Math.min(0.999, Math.max(0, historyWeightMax));
|
|
146
|
+
return maximum / (1 - maximum);
|
|
147
|
+
}
|
|
148
|
+
function getCurrentBlend(sampleWeight, accumulatedWeight, historyWeightMax = 0.95, isHistoryValid = true) {
|
|
149
|
+
if (!isHistoryValid)
|
|
150
|
+
return 1;
|
|
151
|
+
const accumulated = Math.min(accumulatedWeight, getMaximumWeight(historyWeightMax));
|
|
152
|
+
return sampleWeight / Math.max(accumulated + sampleWeight, 1e-5);
|
|
153
|
+
}
|
|
154
|
+
function getNextWeight(sampleWeight, accumulatedWeight, kernelScale, historyWeightMax = 0.95, isHistoryValid = true) {
|
|
155
|
+
if (!isHistoryValid)
|
|
156
|
+
return Math.max(sampleWeight, 1 / (kernelScale * kernelScale));
|
|
157
|
+
const maximum = getMaximumWeight(historyWeightMax);
|
|
158
|
+
return Math.min(Math.min(accumulatedWeight, maximum) + sampleWeight, maximum);
|
|
159
|
+
}
|
|
160
|
+
function getHistoryTrust(sample, historyMinimum, historyMaximum, alpha = [1, 1, 1]) {
|
|
161
|
+
const excess = Math.max(0, ...sample.map((value, index) => Math.max(historyMinimum[index] - value, value - historyMaximum[index])));
|
|
162
|
+
const alphaExcess = Math.max(0, alpha[1] - alpha[0], alpha[0] - alpha[2]);
|
|
163
|
+
const relative = Math.max(excess / Math.max(sample[0], historyMaximum[0], 0.02), alphaExcess);
|
|
164
|
+
const t = Math.min(1, Math.max(0, (relative - 0.03) / (0.12 - 0.03)));
|
|
165
|
+
return 1 - t * t * (3 - 2 * t);
|
|
166
|
+
}
|
|
167
|
+
function getLuminanceChange(historyLuminance, minimumLuminance, maximumLuminance) {
|
|
168
|
+
const excess = Math.max(0, minimumLuminance - historyLuminance, historyLuminance - maximumLuminance);
|
|
169
|
+
const relative = excess / Math.max(Math.abs(historyLuminance), Math.abs(minimumLuminance), Math.abs(maximumLuminance), 0.02);
|
|
170
|
+
const transition = Math.min(1, Math.max(0, (relative - 0.1) / 0.2));
|
|
171
|
+
return transition * transition * (3 - 2 * transition);
|
|
172
|
+
}
|
|
173
|
+
function getForgetting(responsiveness, luminanceChange, sampleWeight) {
|
|
174
|
+
const evidence = Math.min(1, Math.max(0, (sampleWeight - 0.5) / 0.3));
|
|
175
|
+
return Math.min(1, Math.max(0, responsiveness)) * luminanceChange * evidence * evidence * (3 - 2 * evidence);
|
|
176
|
+
}
|
|
177
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
178
|
+
0 && (module.exports = {
|
|
179
|
+
DEFAULT_KERNEL_SHARPNESS,
|
|
180
|
+
DEFAULT_RESPONSIVENESS,
|
|
181
|
+
applyJitterToProjectionMatrix,
|
|
182
|
+
clipToBox,
|
|
183
|
+
getCatmullRomWeights,
|
|
184
|
+
getCurrentBlend,
|
|
185
|
+
getForgetting,
|
|
186
|
+
getHistoryTrust,
|
|
187
|
+
getJitterOffset,
|
|
188
|
+
getJitterPhaseCount,
|
|
189
|
+
getKernelScale,
|
|
190
|
+
getLuminanceChange,
|
|
191
|
+
getMaximumWeight,
|
|
192
|
+
getNextWeight,
|
|
193
|
+
getSampleWeight,
|
|
194
|
+
getVelocityFromDepth,
|
|
195
|
+
halton,
|
|
196
|
+
isDisoccluded,
|
|
197
|
+
jitterToClipOffset,
|
|
198
|
+
lanczos2,
|
|
199
|
+
reprojectUV,
|
|
200
|
+
rgbToYCoCg,
|
|
201
|
+
yCoCgToRgb
|
|
202
|
+
});
|