@luma.gl/engine 10.0.0-rc.1 → 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/dist.dev.js +1671 -1105
- 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 +66 -43
- package/dist/effects/passes/screen-space/ssao.d.ts +647 -2
- package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
- package/dist/effects/passes/screen-space/ssao.js +64 -41
- 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/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/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 +76 -45
- 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/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/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
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { ClipSpace } from "../../models/clip-space.js";
|
|
5
|
+
import { createOccluderLookupTable } from "./cortao-occluder-lookup-table.js";
|
|
6
|
+
import { getCORTAOFilterPassUniforms, getCORTAOMainPassUniforms, getCORTAOMipAtlasSize, getCORTAOMipmapUniforms, getCORTAOPrepassUniforms } from "./cortao-parameters.js";
|
|
7
|
+
import { LOOKUP_TABLE_SIZE, NEAREST_SAMPLER, PASS_PARAMETERS } from "./cortao-passes.js";
|
|
8
|
+
import { CORTAO_FILTER_PASS_FS, CORTAO_MAIN_PASS_FS, CORTAO_MIPMAP_FS, CORTAO_PREPASS_FS, cortaoFilter, cortaoMain, cortaoMipmap, cortaoPrepass } from "./cortao-shaders.js";
|
|
9
|
+
/**
|
|
10
|
+
* The CORTAO passes in GLSL ES 3.00, as full-screen draws. WebGL 2 cannot read one level of a
|
|
11
|
+
* texture and write another level of the same texture in one draw, so the mip levels go into one
|
|
12
|
+
* atlas texture.
|
|
13
|
+
*/
|
|
14
|
+
export class CORTAOWebGLPasses {
|
|
15
|
+
device;
|
|
16
|
+
id;
|
|
17
|
+
options;
|
|
18
|
+
models;
|
|
19
|
+
lookupTableTexture;
|
|
20
|
+
targets = null;
|
|
21
|
+
constructor(device, id, options, scaled) {
|
|
22
|
+
this.device = device;
|
|
23
|
+
this.id = id;
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.models = this.createModels(scaled);
|
|
26
|
+
this.lookupTableTexture = this.createLookupTable();
|
|
27
|
+
}
|
|
28
|
+
renderOcclusion({ camera, configuration, depthView, filter }) {
|
|
29
|
+
const { models } = this;
|
|
30
|
+
const { width, height } = configuration;
|
|
31
|
+
const targets = this.getTargets(width, height);
|
|
32
|
+
models.prepass.shaderInputs.setProps({
|
|
33
|
+
cortaoPrepass: getCORTAOPrepassUniforms(camera, configuration)
|
|
34
|
+
});
|
|
35
|
+
models.prepass.setBindings({ depthTexture: depthView.texture });
|
|
36
|
+
this.renderFullScreen(models.prepass, targets.prepassFramebuffer, width, height);
|
|
37
|
+
const [atlasWidth, atlasHeight] = getCORTAOMipAtlasSize(width, height);
|
|
38
|
+
models.mipmap.shaderInputs.setProps({
|
|
39
|
+
cortaoMipmap: getCORTAOMipmapUniforms(configuration)
|
|
40
|
+
});
|
|
41
|
+
models.mipmap.setBindings({
|
|
42
|
+
packedLevel0Texture: targets.packedLevel0Texture
|
|
43
|
+
});
|
|
44
|
+
this.renderFullScreen(models.mipmap, targets.mipmapFramebuffer, atlasWidth, atlasHeight);
|
|
45
|
+
models.main.shaderInputs.setProps({
|
|
46
|
+
cortaoMain: getCORTAOMainPassUniforms(camera, configuration)
|
|
47
|
+
});
|
|
48
|
+
models.main.setBindings({
|
|
49
|
+
packedDataTexture: targets.packedAtlasTexture,
|
|
50
|
+
normalTexture: targets.normalTexture,
|
|
51
|
+
occluderLookupTable: this.lookupTableTexture
|
|
52
|
+
});
|
|
53
|
+
this.renderFullScreen(models.main, targets.mainFramebuffer, width, height);
|
|
54
|
+
if (!filter) {
|
|
55
|
+
return targets.occlusionTexture;
|
|
56
|
+
}
|
|
57
|
+
models.filter.shaderInputs.setProps({
|
|
58
|
+
cortaoFilter: getCORTAOFilterPassUniforms(configuration)
|
|
59
|
+
});
|
|
60
|
+
models.filter.setBindings({
|
|
61
|
+
packedDataTexture: targets.packedAtlasTexture,
|
|
62
|
+
occlusionTexture: targets.occlusionTexture
|
|
63
|
+
});
|
|
64
|
+
this.renderFullScreen(models.filter, targets.filterFramebuffer, width, height);
|
|
65
|
+
return targets.filteredOcclusionTexture;
|
|
66
|
+
}
|
|
67
|
+
destroy() {
|
|
68
|
+
this.destroyModels();
|
|
69
|
+
this.destroyTargets();
|
|
70
|
+
this.lookupTableTexture.destroy();
|
|
71
|
+
}
|
|
72
|
+
/** Draws one full-screen pass. The pass writes every pixel, so there is no clear. */
|
|
73
|
+
renderFullScreen(model, framebuffer, width, height) {
|
|
74
|
+
const renderPass = this.device.beginRenderPass({
|
|
75
|
+
id: model.id,
|
|
76
|
+
framebuffer,
|
|
77
|
+
parameters: { viewport: [0, 0, width, height] },
|
|
78
|
+
clearColor: false,
|
|
79
|
+
clearDepth: false,
|
|
80
|
+
clearStencil: false
|
|
81
|
+
});
|
|
82
|
+
model.draw(renderPass);
|
|
83
|
+
renderPass.end();
|
|
84
|
+
}
|
|
85
|
+
createModels(scaled) {
|
|
86
|
+
const { device, id, options } = this;
|
|
87
|
+
return {
|
|
88
|
+
prepass: new ClipSpace(device, {
|
|
89
|
+
id: `${id}-prepass`,
|
|
90
|
+
fs: CORTAO_PREPASS_FS,
|
|
91
|
+
modules: [cortaoPrepass],
|
|
92
|
+
defines: { CORTAO_SCALED_DEPTH: scaled ? 1 : 0 },
|
|
93
|
+
parameters: PASS_PARAMETERS
|
|
94
|
+
}),
|
|
95
|
+
mipmap: new ClipSpace(device, {
|
|
96
|
+
id: `${id}-mipmap`,
|
|
97
|
+
fs: CORTAO_MIPMAP_FS,
|
|
98
|
+
modules: [cortaoMipmap],
|
|
99
|
+
parameters: PASS_PARAMETERS
|
|
100
|
+
}),
|
|
101
|
+
main: new ClipSpace(device, {
|
|
102
|
+
id: `${id}-main`,
|
|
103
|
+
fs: CORTAO_MAIN_PASS_FS,
|
|
104
|
+
modules: [cortaoMain],
|
|
105
|
+
defines: {
|
|
106
|
+
CORTAO_SAMPLE_COUNT: options.sampleCount,
|
|
107
|
+
CORTAO_RAY_COUNT: options.rayCount,
|
|
108
|
+
CORTAO_LOOKUP_DIRECTION_RESOLUTION: LOOKUP_TABLE_SIZE.directionResolution,
|
|
109
|
+
CORTAO_LOOKUP_RADIUS_RESOLUTION: LOOKUP_TABLE_SIZE.radiusResolution
|
|
110
|
+
},
|
|
111
|
+
parameters: PASS_PARAMETERS
|
|
112
|
+
}),
|
|
113
|
+
filter: new ClipSpace(device, {
|
|
114
|
+
id: `${id}-filter`,
|
|
115
|
+
fs: CORTAO_FILTER_PASS_FS,
|
|
116
|
+
modules: [cortaoFilter],
|
|
117
|
+
defines: {
|
|
118
|
+
CORTAO_LARGE_FILTER: options.largeFilter ? 1 : 0,
|
|
119
|
+
CORTAO_FILTER_SYMMETRY: options.filterSymmetry ? 1 : 0
|
|
120
|
+
},
|
|
121
|
+
parameters: PASS_PARAMETERS
|
|
122
|
+
})
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
destroyModels() {
|
|
126
|
+
for (const model of Object.values(this.models)) {
|
|
127
|
+
model.destroy();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Creates the occluder lookup table texture for the current ray count. */
|
|
131
|
+
createLookupTable() {
|
|
132
|
+
const table = createOccluderLookupTable({
|
|
133
|
+
rayCount: this.options.rayCount
|
|
134
|
+
});
|
|
135
|
+
const texture = this.device.createTexture({
|
|
136
|
+
id: `${this.id}-occluder-lookup-table`,
|
|
137
|
+
dimension: '3d',
|
|
138
|
+
format: table.format,
|
|
139
|
+
width: table.directionResolution,
|
|
140
|
+
height: table.directionResolution,
|
|
141
|
+
depth: table.radiusResolution,
|
|
142
|
+
sampler: NEAREST_SAMPLER
|
|
143
|
+
});
|
|
144
|
+
texture.writeData(table.data);
|
|
145
|
+
return texture;
|
|
146
|
+
}
|
|
147
|
+
/** Gets the render targets for a drawing buffer size. Creates them again when the size changes. */
|
|
148
|
+
getTargets(width, height) {
|
|
149
|
+
if (this.targets && this.targets.width === width && this.targets.height === height) {
|
|
150
|
+
return this.targets;
|
|
151
|
+
}
|
|
152
|
+
this.destroyTargets();
|
|
153
|
+
const { device, id } = this;
|
|
154
|
+
const textures = [];
|
|
155
|
+
const createTarget = (name, format, size = [width, height]) => {
|
|
156
|
+
const texture = device.createTexture({
|
|
157
|
+
id: `${id}-${name}`,
|
|
158
|
+
format,
|
|
159
|
+
width: size[0],
|
|
160
|
+
height: size[1],
|
|
161
|
+
sampler: NEAREST_SAMPLER
|
|
162
|
+
});
|
|
163
|
+
textures.push(texture);
|
|
164
|
+
return texture;
|
|
165
|
+
};
|
|
166
|
+
const packedLevel0Texture = createTarget('packed-level-0', 'r32uint');
|
|
167
|
+
const normalTexture = createTarget('normal', 'rgba8unorm');
|
|
168
|
+
const packedAtlasTexture = createTarget('packed-atlas', 'r32uint', getCORTAOMipAtlasSize(width, height));
|
|
169
|
+
const occlusionTexture = createTarget('occlusion', 'rgba8unorm');
|
|
170
|
+
const filteredOcclusionTexture = createTarget('filtered-occlusion', 'rgba8unorm');
|
|
171
|
+
const createFramebuffer = (name, colorAttachments) => device.createFramebuffer({
|
|
172
|
+
id: `${id}-${name}`,
|
|
173
|
+
width: colorAttachments[0].width,
|
|
174
|
+
height: colorAttachments[0].height,
|
|
175
|
+
colorAttachments
|
|
176
|
+
});
|
|
177
|
+
const prepassFramebuffer = createFramebuffer('prepass', [packedLevel0Texture, normalTexture]);
|
|
178
|
+
const mipmapFramebuffer = createFramebuffer('mipmap', [packedAtlasTexture]);
|
|
179
|
+
const mainFramebuffer = createFramebuffer('main', [occlusionTexture]);
|
|
180
|
+
const filterFramebuffer = createFramebuffer('filter', [filteredOcclusionTexture]);
|
|
181
|
+
this.targets = {
|
|
182
|
+
width,
|
|
183
|
+
height,
|
|
184
|
+
textures,
|
|
185
|
+
packedLevel0Texture,
|
|
186
|
+
normalTexture,
|
|
187
|
+
packedAtlasTexture,
|
|
188
|
+
occlusionTexture,
|
|
189
|
+
filteredOcclusionTexture,
|
|
190
|
+
framebuffers: [prepassFramebuffer, mipmapFramebuffer, mainFramebuffer, filterFramebuffer],
|
|
191
|
+
prepassFramebuffer,
|
|
192
|
+
mipmapFramebuffer,
|
|
193
|
+
mainFramebuffer,
|
|
194
|
+
filterFramebuffer
|
|
195
|
+
};
|
|
196
|
+
return this.targets;
|
|
197
|
+
}
|
|
198
|
+
destroyTargets() {
|
|
199
|
+
const { targets } = this;
|
|
200
|
+
if (!targets) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
for (const framebuffer of targets.framebuffers) {
|
|
204
|
+
framebuffer.destroy();
|
|
205
|
+
}
|
|
206
|
+
for (const texture of targets.textures) {
|
|
207
|
+
texture.destroy();
|
|
208
|
+
}
|
|
209
|
+
this.targets = null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=cortao-webgl-passes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortao-webgl-passes.js","sourceRoot":"","sources":["../../../src/lighting/cortao/cortao-webgl-passes.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAG5D,OAAO,EAAC,SAAS,EAAC,mCAAgC;AAClD,OAAO,EAAC,yBAAyB,EAAC,0CAAuC;AACzE,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,+BAA4B;AAC7B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,EAIhB,2BAAwB;AACzB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,E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Ac;QACpB,MAAM,EAAC,OAAO,EAAC,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,KAAK,MAAM,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YAC/C,WAAW,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACvC,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,348 @@
|
|
|
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 cortao_webgpu_passes_exports = {};
|
|
19
|
+
__export(cortao_webgpu_passes_exports, {
|
|
20
|
+
CORTAOWebGPUPasses: () => CORTAOWebGPUPasses
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(cortao_webgpu_passes_exports);
|
|
23
|
+
var import_core = require("@luma.gl/core");
|
|
24
|
+
var import_computation = require("../../compute/computation.cjs");
|
|
25
|
+
var import_cortao_occluder_lookup_table = require("./cortao-occluder-lookup-table.cjs");
|
|
26
|
+
var import_cortao_parameters = require("./cortao-parameters.cjs");
|
|
27
|
+
var import_cortao_passes = require("./cortao-passes.cjs");
|
|
28
|
+
var import_cortao_shaders_wgsl = require("./cortao-shaders-wgsl.cjs");
|
|
29
|
+
const COMPUTE_STAGE = 4;
|
|
30
|
+
class CORTAOWebGPUPasses {
|
|
31
|
+
device;
|
|
32
|
+
id;
|
|
33
|
+
options;
|
|
34
|
+
pipelines;
|
|
35
|
+
uniformBuffers;
|
|
36
|
+
pointSampler;
|
|
37
|
+
lookupTableTexture;
|
|
38
|
+
targets = null;
|
|
39
|
+
constructor(device, id, options, scaled) {
|
|
40
|
+
this.device = device;
|
|
41
|
+
this.id = id;
|
|
42
|
+
this.options = options;
|
|
43
|
+
const createUniformBuffer = (name, byteLength) => device.createBuffer({
|
|
44
|
+
id: `${id}-${name}-uniforms`,
|
|
45
|
+
byteLength,
|
|
46
|
+
usage: import_core.Buffer.UNIFORM | import_core.Buffer.COPY_DST
|
|
47
|
+
});
|
|
48
|
+
this.uniformBuffers = {
|
|
49
|
+
prepass: createUniformBuffer("prepass", 48),
|
|
50
|
+
mipmap: Array.from({ length: 8 }, (_, level) => createUniformBuffer(`mipmap-${level}`, 16)),
|
|
51
|
+
main: createUniformBuffer("main", 80),
|
|
52
|
+
filter: createUniformBuffer("filter", 16)
|
|
53
|
+
};
|
|
54
|
+
this.pointSampler = device.createSampler({
|
|
55
|
+
id: `${id}-point-sampler`,
|
|
56
|
+
minFilter: "nearest",
|
|
57
|
+
magFilter: "nearest",
|
|
58
|
+
addressModeU: "clamp-to-edge",
|
|
59
|
+
addressModeV: "clamp-to-edge"
|
|
60
|
+
});
|
|
61
|
+
this.pipelines = this.createPipelines(scaled);
|
|
62
|
+
this.lookupTableTexture = this.createLookupTable();
|
|
63
|
+
}
|
|
64
|
+
renderOcclusion({ camera, configuration, depthView, filter }) {
|
|
65
|
+
const { pipelines, uniformBuffers } = this;
|
|
66
|
+
const { width, height } = configuration;
|
|
67
|
+
const targets = this.getTargets(width, height);
|
|
68
|
+
const prepassUniforms = (0, import_cortao_parameters.getCORTAOPrepassUniforms)(camera, configuration);
|
|
69
|
+
writeUniforms(uniformBuffers.prepass, 48, [
|
|
70
|
+
[0, "f32", prepassUniforms.unprojectParams],
|
|
71
|
+
[16, "f32", prepassUniforms.resolution],
|
|
72
|
+
[24, "f32", [prepassUniforms.depthScale, prepassUniforms.depthOffset]],
|
|
73
|
+
[32, "u32", [prepassUniforms.randomSeed]]
|
|
74
|
+
]);
|
|
75
|
+
this.dispatch(pipelines.prepass, width, height, {
|
|
76
|
+
cortaoPrepass: uniformBuffers.prepass,
|
|
77
|
+
depthTexture: depthView,
|
|
78
|
+
packedOutput: targets.packedLevelViews[0],
|
|
79
|
+
normalOutput: targets.normalTexture.view
|
|
80
|
+
});
|
|
81
|
+
for (let level = 1; level < targets.mipCount; level++) {
|
|
82
|
+
const buffer = uniformBuffers.mipmap[level];
|
|
83
|
+
writeUniforms(buffer, 16, [
|
|
84
|
+
[0, "f32", [width, height]],
|
|
85
|
+
[8, "u32", [level, configuration.randomSeed >>> 0]]
|
|
86
|
+
]);
|
|
87
|
+
this.dispatch(pipelines.mipmap, Math.max(width >> level, 1), Math.max(height >> level, 1), {
|
|
88
|
+
cortaoMipmap: buffer,
|
|
89
|
+
sourceLevel: targets.packedLevelViews[level - 1],
|
|
90
|
+
targetLevel: targets.packedLevelViews[level]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const mainUniforms = (0, import_cortao_parameters.getCORTAOMainPassUniforms)(camera, configuration);
|
|
94
|
+
writeUniforms(uniformBuffers.main, 80, [
|
|
95
|
+
[0, "f32", mainUniforms.unprojectParams],
|
|
96
|
+
[16, "f32", mainUniforms.projectionParams],
|
|
97
|
+
[32, "f32", mainUniforms.resolution],
|
|
98
|
+
[
|
|
99
|
+
40,
|
|
100
|
+
"f32",
|
|
101
|
+
[
|
|
102
|
+
mainUniforms.normalBias,
|
|
103
|
+
mainUniforms.radius,
|
|
104
|
+
mainUniforms.maxApparentCircleRadiusCoefficient,
|
|
105
|
+
mainUniforms.mipBias,
|
|
106
|
+
mainUniforms.inverseMaxSlopeCompensation,
|
|
107
|
+
mainUniforms.backfaceThreshold,
|
|
108
|
+
mainUniforms.backfaceBoost,
|
|
109
|
+
mainUniforms.intensity
|
|
110
|
+
]
|
|
111
|
+
],
|
|
112
|
+
[72, "i32", [mainUniforms.mipCount]],
|
|
113
|
+
[76, "u32", [mainUniforms.randomSeed]]
|
|
114
|
+
]);
|
|
115
|
+
this.dispatch(pipelines.main, width, height, {
|
|
116
|
+
cortaoMain: uniformBuffers.main,
|
|
117
|
+
packedDataTexture: targets.packedTexture.view,
|
|
118
|
+
normalTexture: targets.normalTexture.view,
|
|
119
|
+
occluderLookupTable: this.lookupTableTexture.view,
|
|
120
|
+
occlusionOutput: targets.occlusionTexture.view
|
|
121
|
+
});
|
|
122
|
+
if (!filter) {
|
|
123
|
+
return targets.occlusionTexture;
|
|
124
|
+
}
|
|
125
|
+
const filterUniforms = (0, import_cortao_parameters.getCORTAOFilterPassUniforms)(configuration);
|
|
126
|
+
writeUniforms(uniformBuffers.filter, 16, [
|
|
127
|
+
[0, "f32", filterUniforms.resolution],
|
|
128
|
+
[8, "f32", [filterUniforms.depthSensitivity, filterUniforms.normalSensitivity]]
|
|
129
|
+
]);
|
|
130
|
+
this.dispatch(pipelines.filter, (width >> 1) + 1, (height >> 1) + 1, {
|
|
131
|
+
cortaoFilter: uniformBuffers.filter,
|
|
132
|
+
packedDataTexture: targets.packedLevelViews[0],
|
|
133
|
+
occlusionTexture: targets.occlusionTexture.view,
|
|
134
|
+
pointSampler: this.pointSampler,
|
|
135
|
+
occlusionOutput: targets.filteredOcclusionTexture.view
|
|
136
|
+
});
|
|
137
|
+
return targets.filteredOcclusionTexture;
|
|
138
|
+
}
|
|
139
|
+
destroy() {
|
|
140
|
+
this.destroyPipelines();
|
|
141
|
+
this.destroyTargets();
|
|
142
|
+
this.lookupTableTexture.destroy();
|
|
143
|
+
this.pointSampler.destroy();
|
|
144
|
+
const { prepass, mipmap, main, filter } = this.uniformBuffers;
|
|
145
|
+
for (const buffer of [prepass, ...mipmap, main, filter]) {
|
|
146
|
+
buffer.destroy();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Runs one compute pass over a width x height grid of invocations. */
|
|
150
|
+
dispatch(computation, width, height, bindings) {
|
|
151
|
+
computation.setBindings(bindings);
|
|
152
|
+
computation.predraw(this.device.commandEncoder);
|
|
153
|
+
const computePass = this.device.beginComputePass({ id: computation.id });
|
|
154
|
+
computation.dispatch(computePass, Math.ceil(width / import_cortao_shaders_wgsl.CORTAO_WORKGROUP_SIZE), Math.ceil(height / import_cortao_shaders_wgsl.CORTAO_WORKGROUP_SIZE));
|
|
155
|
+
computePass.end();
|
|
156
|
+
}
|
|
157
|
+
createPipelines(scaled) {
|
|
158
|
+
const { device, id, options } = this;
|
|
159
|
+
const uniform = (name, location) => ({
|
|
160
|
+
name,
|
|
161
|
+
type: "uniform",
|
|
162
|
+
group: 0,
|
|
163
|
+
location,
|
|
164
|
+
visibility: COMPUTE_STAGE
|
|
165
|
+
});
|
|
166
|
+
const texture = (name, location, sampleType, viewDimension = "2d") => ({
|
|
167
|
+
name,
|
|
168
|
+
type: "texture",
|
|
169
|
+
group: 0,
|
|
170
|
+
location,
|
|
171
|
+
visibility: COMPUTE_STAGE,
|
|
172
|
+
sampleType,
|
|
173
|
+
viewDimension
|
|
174
|
+
});
|
|
175
|
+
const storage = (name, location, format) => ({
|
|
176
|
+
name,
|
|
177
|
+
type: "storage",
|
|
178
|
+
group: 0,
|
|
179
|
+
location,
|
|
180
|
+
visibility: COMPUTE_STAGE,
|
|
181
|
+
access: "write-only",
|
|
182
|
+
format,
|
|
183
|
+
viewDimension: "2d"
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
prepass: new import_computation.Computation(device, {
|
|
187
|
+
id: `${id}-prepass`,
|
|
188
|
+
source: (0, import_cortao_shaders_wgsl.getCORTAOPrepassWGSL)(scaled),
|
|
189
|
+
shaderLayout: {
|
|
190
|
+
bindings: [
|
|
191
|
+
uniform("cortaoPrepass", 0),
|
|
192
|
+
texture("depthTexture", 1, "depth"),
|
|
193
|
+
storage("packedOutput", 2, "r32uint"),
|
|
194
|
+
storage("normalOutput", 3, "rgba8unorm")
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
mipmap: new import_computation.Computation(device, {
|
|
199
|
+
id: `${id}-mipmap`,
|
|
200
|
+
source: import_cortao_shaders_wgsl.CORTAO_MIPMAP_WGSL,
|
|
201
|
+
shaderLayout: {
|
|
202
|
+
bindings: [
|
|
203
|
+
uniform("cortaoMipmap", 0),
|
|
204
|
+
texture("sourceLevel", 1, "uint"),
|
|
205
|
+
storage("targetLevel", 2, "r32uint")
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
main: new import_computation.Computation(device, {
|
|
210
|
+
id: `${id}-main`,
|
|
211
|
+
source: (0, import_cortao_shaders_wgsl.getCORTAOMainPassWGSL)({
|
|
212
|
+
sampleCount: options.sampleCount,
|
|
213
|
+
rayCount: options.rayCount,
|
|
214
|
+
lookupDirectionResolution: import_cortao_passes.LOOKUP_TABLE_SIZE.directionResolution,
|
|
215
|
+
lookupRadiusResolution: import_cortao_passes.LOOKUP_TABLE_SIZE.radiusResolution
|
|
216
|
+
}),
|
|
217
|
+
shaderLayout: {
|
|
218
|
+
bindings: [
|
|
219
|
+
uniform("cortaoMain", 0),
|
|
220
|
+
texture("packedDataTexture", 1, "uint"),
|
|
221
|
+
texture("normalTexture", 2, "float"),
|
|
222
|
+
texture("occluderLookupTable", 3, "uint", "3d"),
|
|
223
|
+
storage("occlusionOutput", 4, "rgba8unorm")
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
}),
|
|
227
|
+
filter: new import_computation.Computation(device, {
|
|
228
|
+
id: `${id}-filter`,
|
|
229
|
+
source: (0, import_cortao_shaders_wgsl.getCORTAOFilterPassWGSL)(options),
|
|
230
|
+
shaderLayout: {
|
|
231
|
+
bindings: [
|
|
232
|
+
uniform("cortaoFilter", 0),
|
|
233
|
+
texture("packedDataTexture", 1, "uint"),
|
|
234
|
+
texture("occlusionTexture", 2, "float"),
|
|
235
|
+
{
|
|
236
|
+
name: "pointSampler",
|
|
237
|
+
type: "sampler",
|
|
238
|
+
group: 0,
|
|
239
|
+
location: 3,
|
|
240
|
+
visibility: COMPUTE_STAGE,
|
|
241
|
+
samplerType: "non-filtering"
|
|
242
|
+
},
|
|
243
|
+
storage("occlusionOutput", 4, "rgba8unorm")
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
destroyPipelines() {
|
|
250
|
+
for (const pipeline of Object.values(this.pipelines)) {
|
|
251
|
+
pipeline.destroy();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/** Creates the occluder lookup table texture for the current ray count. */
|
|
255
|
+
createLookupTable() {
|
|
256
|
+
const table = (0, import_cortao_occluder_lookup_table.createOccluderLookupTable)({
|
|
257
|
+
rayCount: this.options.rayCount
|
|
258
|
+
});
|
|
259
|
+
const texture = this.device.createTexture({
|
|
260
|
+
id: `${this.id}-occluder-lookup-table`,
|
|
261
|
+
dimension: "3d",
|
|
262
|
+
format: table.format,
|
|
263
|
+
width: table.directionResolution,
|
|
264
|
+
height: table.directionResolution,
|
|
265
|
+
depth: table.radiusResolution,
|
|
266
|
+
usage: import_core.Texture.SAMPLE | import_core.Texture.COPY_DST,
|
|
267
|
+
sampler: import_cortao_passes.NEAREST_SAMPLER
|
|
268
|
+
});
|
|
269
|
+
texture.writeData(table.data);
|
|
270
|
+
return texture;
|
|
271
|
+
}
|
|
272
|
+
/** Gets the textures for a drawing buffer size. Creates them again when the size changes. */
|
|
273
|
+
getTargets(width, height) {
|
|
274
|
+
if (this.targets && this.targets.width === width && this.targets.height === height) {
|
|
275
|
+
return this.targets;
|
|
276
|
+
}
|
|
277
|
+
this.destroyTargets();
|
|
278
|
+
const { device, id } = this;
|
|
279
|
+
const usage = import_core.Texture.SAMPLE | import_core.Texture.STORAGE;
|
|
280
|
+
const mipCount = (0, import_cortao_parameters.getCORTAOMipCount)(width, height);
|
|
281
|
+
const packedTexture = device.createTexture({
|
|
282
|
+
id: `${id}-packed`,
|
|
283
|
+
format: "r32uint",
|
|
284
|
+
width,
|
|
285
|
+
height,
|
|
286
|
+
mipLevels: mipCount,
|
|
287
|
+
usage,
|
|
288
|
+
sampler: import_cortao_passes.NEAREST_SAMPLER
|
|
289
|
+
});
|
|
290
|
+
const createTarget = (name, targetUsage = usage) => device.createTexture({
|
|
291
|
+
id: `${id}-${name}`,
|
|
292
|
+
format: "rgba8unorm",
|
|
293
|
+
width,
|
|
294
|
+
height,
|
|
295
|
+
usage: targetUsage,
|
|
296
|
+
sampler: import_cortao_passes.NEAREST_SAMPLER
|
|
297
|
+
});
|
|
298
|
+
this.targets = {
|
|
299
|
+
width,
|
|
300
|
+
height,
|
|
301
|
+
mipCount,
|
|
302
|
+
packedTexture,
|
|
303
|
+
packedLevelViews: Array.from({ length: mipCount }, (_, level) => packedTexture.createView({
|
|
304
|
+
baseMipLevel: level,
|
|
305
|
+
mipLevelCount: 1,
|
|
306
|
+
arrayLayerCount: 1
|
|
307
|
+
})),
|
|
308
|
+
normalTexture: createTarget("normal"),
|
|
309
|
+
occlusionTexture: createTarget("occlusion", usage | import_core.Texture.COPY_SRC),
|
|
310
|
+
filteredOcclusionTexture: createTarget("filtered-occlusion", usage | import_core.Texture.COPY_SRC)
|
|
311
|
+
};
|
|
312
|
+
return this.targets;
|
|
313
|
+
}
|
|
314
|
+
destroyTargets() {
|
|
315
|
+
const { targets } = this;
|
|
316
|
+
if (!targets) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
for (const view of targets.packedLevelViews) {
|
|
320
|
+
view.destroy();
|
|
321
|
+
}
|
|
322
|
+
for (const texture of [
|
|
323
|
+
targets.packedTexture,
|
|
324
|
+
targets.normalTexture,
|
|
325
|
+
targets.occlusionTexture,
|
|
326
|
+
targets.filteredOcclusionTexture
|
|
327
|
+
]) {
|
|
328
|
+
texture.destroy();
|
|
329
|
+
}
|
|
330
|
+
this.targets = null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function writeUniforms(buffer, byteLength, fields) {
|
|
334
|
+
const data = new ArrayBuffer(byteLength);
|
|
335
|
+
const views = {
|
|
336
|
+
f32: new Float32Array(data),
|
|
337
|
+
u32: new Uint32Array(data),
|
|
338
|
+
i32: new Int32Array(data)
|
|
339
|
+
};
|
|
340
|
+
for (const [offset, type, values] of fields) {
|
|
341
|
+
views[type].set(values, offset / 4);
|
|
342
|
+
}
|
|
343
|
+
buffer.write(new Uint8Array(data));
|
|
344
|
+
}
|
|
345
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
346
|
+
0 && (module.exports = {
|
|
347
|
+
CORTAOWebGPUPasses
|
|
348
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Texture, type Device } from '@luma.gl/core';
|
|
2
|
+
import { type CORTAOFrame, type CORTAOPasses, type CORTAOShaderOptions } from "./cortao-passes.js";
|
|
3
|
+
/**
|
|
4
|
+
* The CORTAO passes in WGSL, as compute passes, for WebGPU.
|
|
5
|
+
*
|
|
6
|
+
* Unlike the GLSL port, this port writes real mip levels, one compute dispatch per level, and the
|
|
7
|
+
* filter pass reads 2 x 2 blocks with `textureGather()`, as the reference does.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CORTAOWebGPUPasses implements CORTAOPasses {
|
|
10
|
+
private readonly device;
|
|
11
|
+
private readonly id;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly pipelines;
|
|
14
|
+
private readonly uniformBuffers;
|
|
15
|
+
private readonly pointSampler;
|
|
16
|
+
private readonly lookupTableTexture;
|
|
17
|
+
private targets;
|
|
18
|
+
constructor(device: Device, id: string, options: CORTAOShaderOptions, scaled: boolean);
|
|
19
|
+
renderOcclusion({ camera, configuration, depthView, filter }: CORTAOFrame): Texture;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
/** Runs one compute pass over a width x height grid of invocations. */
|
|
22
|
+
private dispatch;
|
|
23
|
+
private createPipelines;
|
|
24
|
+
private destroyPipelines;
|
|
25
|
+
/** Creates the occluder lookup table texture for the current ray count. */
|
|
26
|
+
private createLookupTable;
|
|
27
|
+
/** Gets the textures for a drawing buffer size. Creates them again when the size changes. */
|
|
28
|
+
private getTargets;
|
|
29
|
+
private destroyTargets;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=cortao-webgpu-passes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortao-webgpu-passes.d.ts","sourceRoot":"","sources":["../../../src/lighting/cortao/cortao-webgpu-passes.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,OAAO,EAEP,KAAK,MAAM,EAGZ,MAAM,eAAe,CAAC;AASvB,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,2BAAwB;AA6CzB;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuB;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAU;IAC7C,OAAO,CAAC,OAAO,CAA8B;gBAEjC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO;IA2BrF,eAAe,CAAC,EAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAC,EAAE,WAAW,GAAG,OAAO;IAiFjF,OAAO,IAAI,IAAI;IAWf,uEAAuE;IACvE,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,eAAe;IAsGvB,OAAO,CAAC,gBAAgB;IAMxB,2EAA2E;IAC3E,OAAO,CAAC,iBAAiB;IAkBzB,6FAA6F;IAC7F,OAAO,CAAC,UAAU;IA6ClB,OAAO,CAAC,cAAc;CAkBvB"}
|