@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
|
@@ -3,57 +3,79 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
import { contactShadowTrace, contactShadowBilateralBlur, contactShadowComposite } from '@luma.gl/shaders';
|
|
5
5
|
import { SHADOW_QUALITY_SETTINGS } from "./shadow-quality.js";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
/** Use the balanced contact shadow preset by default. */
|
|
7
|
+
const contactShadowOptionDefaults = {
|
|
8
|
+
quality: 'balanced'
|
|
9
|
+
};
|
|
10
|
+
/** Trace and filter contact visibility using the selected quality preset. */
|
|
11
|
+
export const contactShadows = {
|
|
12
|
+
optionDefaults: contactShadowOptionDefaults,
|
|
13
|
+
scaleResources: {
|
|
14
|
+
option: 'quality',
|
|
15
|
+
targets: ['contactShadowRaw', 'contactShadowScratch', 'contactShadowFiltered'],
|
|
16
|
+
values: {
|
|
17
|
+
low: SHADOW_QUALITY_SETTINGS.low.contactScale,
|
|
18
|
+
balanced: SHADOW_QUALITY_SETTINGS.balanced.contactScale,
|
|
19
|
+
cinematic: SHADOW_QUALITY_SETTINGS.cinematic.contactScale
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
optionUniforms: {
|
|
23
|
+
contactShadowTrace: {
|
|
24
|
+
stepCount: {
|
|
25
|
+
option: 'quality',
|
|
26
|
+
values: {
|
|
27
|
+
low: SHADOW_QUALITY_SETTINGS.low.contactStepCount,
|
|
28
|
+
balanced: SHADOW_QUALITY_SETTINGS.balanced.contactStepCount,
|
|
29
|
+
cinematic: SHADOW_QUALITY_SETTINGS.cinematic.contactStepCount
|
|
30
|
+
}
|
|
27
31
|
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
name: 'contactShadowCompositeShaderPass',
|
|
35
|
+
resources: {
|
|
36
|
+
contactShadowRaw: {
|
|
37
|
+
scale: [1, 1],
|
|
38
|
+
format: 'rgba8unorm'
|
|
28
39
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
contactShadowScratch: {
|
|
41
|
+
scale: [1, 1],
|
|
42
|
+
format: 'rgba8unorm'
|
|
43
|
+
},
|
|
44
|
+
contactShadowFiltered: {
|
|
45
|
+
scale: [1, 1],
|
|
46
|
+
format: 'rgba8unorm'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
passes: [
|
|
50
|
+
{
|
|
51
|
+
kind: 'fullscreen',
|
|
52
|
+
shaderPass: contactShadowTrace,
|
|
53
|
+
inputs: { sourceTexture: 'previous' },
|
|
54
|
+
output: 'contactShadowRaw'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
kind: 'fullscreen',
|
|
58
|
+
shaderPass: contactShadowBilateralBlur,
|
|
59
|
+
inputs: { sourceTexture: 'contactShadowRaw' },
|
|
60
|
+
output: 'contactShadowScratch',
|
|
61
|
+
uniforms: { direction: [1, 0] }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: 'fullscreen',
|
|
65
|
+
shaderPass: contactShadowBilateralBlur,
|
|
66
|
+
inputs: { sourceTexture: 'contactShadowScratch' },
|
|
67
|
+
output: 'contactShadowFiltered',
|
|
68
|
+
uniforms: { direction: [0, 1] }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
kind: 'fullscreen',
|
|
72
|
+
shaderPass: contactShadowComposite,
|
|
73
|
+
inputs: {
|
|
74
|
+
sourceTexture: 'previous',
|
|
75
|
+
contactShadowTexture: 'contactShadowFiltered'
|
|
47
76
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
contactShadowTexture: 'contactShadowFiltered'
|
|
53
|
-
},
|
|
54
|
-
output: 'previous'
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
}
|
|
77
|
+
output: 'previous'
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
};
|
|
59
81
|
//# sourceMappingURL=contact-shadow-composite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-shadow-composite.js","sourceRoot":"","sources":["../../src/lighting/contact-shadow-composite.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;
|
|
1
|
+
{"version":3,"file":"contact-shadow-composite.js","sourceRoot":"","sources":["../../src/lighting/contact-shadow-composite.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAI5D,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,uBAAuB,EAAC,4BAAyB;AAKzD,yDAAyD;AACzD,MAAM,2BAA2B,GAAsD;IACrF,OAAO,EAAE,UAAU;CACpB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,cAAc,EAAE,2BAA2B;IAC3C,cAAc,EAAE;QACd,MAAM,EAA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AAC,CAAC,EAAC;SAC9B;QACD;YACE,IAAI,EAAE,YAAqB;YAC3B,UAAU,EAAE,0BAA0B;YACtC,MAAM,EAAE,EAAC,aAAa,EAAE,sBAAsB,EAAC;YAC/C,MAAM,EAAE,uBAAuB;YAC/B,QAAQ,EAAE,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC;SAC9B;QACD;YACE,IAAI,EAAE,YAAqB;YAC3B,UAAU,EAAE,sBAAsB;YAClC,MAAM,EAAE;gBACN,aAAa,EAAE,UAAU;gBACzB,oBAAoB,EAAE,uBAAuB;aAC9C;YACD,MAAM,EAAE,UAAU;SACnB;KACF;CAIF,CAAC"}
|
|
@@ -17,56 +17,66 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var contact_shadow_pass_exports = {};
|
|
19
19
|
__export(contact_shadow_pass_exports, {
|
|
20
|
-
ContactShadowPass: () => ContactShadowPass
|
|
20
|
+
ContactShadowPass: () => ContactShadowPass,
|
|
21
|
+
contactShadowVisibilityEffect: () => contactShadowVisibilityEffect
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(contact_shadow_pass_exports);
|
|
23
24
|
var import_core = require("@luma.gl/core");
|
|
24
25
|
var import_shaders = require("@luma.gl/shaders");
|
|
25
26
|
var import_matrix = require("@math.gl/core/matrix");
|
|
26
|
-
var
|
|
27
|
+
var import_effect_renderer = require("../passes/effect-renderer.cjs");
|
|
27
28
|
var import_shadow_quality = require("./shadow-quality.cjs");
|
|
29
|
+
const contactShadowVisibilityEffect = {
|
|
30
|
+
name: "contactShadowVisibility",
|
|
31
|
+
configure: configureContactShadowVisibility
|
|
32
|
+
};
|
|
33
|
+
function configureContactShadowVisibility(props = {}) {
|
|
34
|
+
const settings = import_shadow_quality.SHADOW_QUALITY_SETTINGS[props.quality ?? "balanced"];
|
|
35
|
+
return {
|
|
36
|
+
name: "contactShadowVisibility",
|
|
37
|
+
resources: {
|
|
38
|
+
contactShadowRaw: {
|
|
39
|
+
scale: [settings.contactScale, settings.contactScale],
|
|
40
|
+
format: "rgba8unorm"
|
|
41
|
+
},
|
|
42
|
+
contactShadowScratch: {
|
|
43
|
+
scale: [settings.contactScale, settings.contactScale],
|
|
44
|
+
format: "rgba8unorm"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
passes: [
|
|
48
|
+
{
|
|
49
|
+
kind: "fullscreen",
|
|
50
|
+
shaderPass: import_shaders.contactShadowTrace,
|
|
51
|
+
inputs: { sourceTexture: "original" },
|
|
52
|
+
output: "contactShadowRaw",
|
|
53
|
+
uniforms: { stepCount: settings.contactStepCount }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
kind: "fullscreen",
|
|
57
|
+
shaderPass: import_shaders.contactShadowBilateralBlur,
|
|
58
|
+
inputs: { sourceTexture: "contactShadowRaw" },
|
|
59
|
+
output: "contactShadowScratch",
|
|
60
|
+
uniforms: { direction: [1, 0] }
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
kind: "fullscreen",
|
|
64
|
+
shaderPass: import_shaders.contactShadowBilateralBlur,
|
|
65
|
+
inputs: { sourceTexture: "contactShadowScratch" },
|
|
66
|
+
output: "previous",
|
|
67
|
+
uniforms: { direction: [0, 1] }
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
28
72
|
class ContactShadowPass {
|
|
29
73
|
device;
|
|
30
74
|
renderer;
|
|
31
75
|
destroyed = false;
|
|
32
76
|
constructor(device, props = {}) {
|
|
33
77
|
this.device = device;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
name: "contactShadowVisibility",
|
|
37
|
-
renderTargets: {
|
|
38
|
-
contactShadowRaw: {
|
|
39
|
-
scale: [settings.contactScale, settings.contactScale],
|
|
40
|
-
format: "rgba8unorm"
|
|
41
|
-
},
|
|
42
|
-
contactShadowScratch: {
|
|
43
|
-
scale: [settings.contactScale, settings.contactScale],
|
|
44
|
-
format: "rgba8unorm"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
steps: [
|
|
48
|
-
{
|
|
49
|
-
shaderPass: import_shaders.contactShadowTrace,
|
|
50
|
-
inputs: { sourceTexture: "original" },
|
|
51
|
-
output: "contactShadowRaw",
|
|
52
|
-
uniforms: { stepCount: settings.contactStepCount }
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
shaderPass: import_shaders.contactShadowBilateralBlur,
|
|
56
|
-
inputs: { sourceTexture: "contactShadowRaw" },
|
|
57
|
-
output: "contactShadowScratch",
|
|
58
|
-
uniforms: { direction: [1, 0] }
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
shaderPass: import_shaders.contactShadowBilateralBlur,
|
|
62
|
-
inputs: { sourceTexture: "contactShadowScratch" },
|
|
63
|
-
output: "previous",
|
|
64
|
-
uniforms: { direction: [0, 1] }
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
};
|
|
68
|
-
this.renderer = new import_shader_pass_renderer.ShaderPassRenderer(device, {
|
|
69
|
-
shaderPasses: [shaderPass],
|
|
78
|
+
this.renderer = new import_effect_renderer.EffectRenderer(device, {
|
|
79
|
+
effects: [{ effect: contactShadowVisibilityEffect, options: props }],
|
|
70
80
|
colorFormat: "rgba8unorm"
|
|
71
81
|
});
|
|
72
82
|
}
|
|
@@ -98,5 +108,6 @@ class ContactShadowPass {
|
|
|
98
108
|
}
|
|
99
109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
100
110
|
0 && (module.exports = {
|
|
101
|
-
ContactShadowPass
|
|
111
|
+
ContactShadowPass,
|
|
112
|
+
contactShadowVisibilityEffect
|
|
102
113
|
});
|
|
@@ -2,6 +2,7 @@ import { type Device, type Texture } from '@luma.gl/core';
|
|
|
2
2
|
import { type ContactTraceUniforms } from '@luma.gl/shaders';
|
|
3
3
|
import { Matrix4 } from '@math.gl/core/matrix';
|
|
4
4
|
import { type NumberArray3, type NumberArray16 } from '@math.gl/core/types';
|
|
5
|
+
import { type EffectDefinition } from "../passes/effect-renderer.js";
|
|
5
6
|
export type ContactShadowPassProps = {
|
|
6
7
|
quality?: 'low' | 'balanced' | 'cinematic';
|
|
7
8
|
};
|
|
@@ -11,6 +12,12 @@ export type ContactShadowRenderOptions = Partial<Omit<ContactTraceUniforms, 'pro
|
|
|
11
12
|
depthTexture: Texture;
|
|
12
13
|
normalTexture: Texture;
|
|
13
14
|
};
|
|
15
|
+
/** Produces an RGBA8 visibility texture for downstream lighting. */
|
|
16
|
+
export declare const contactShadowVisibilityEffect: {
|
|
17
|
+
readonly name: "contactShadowVisibility";
|
|
18
|
+
readonly configure: typeof configureContactShadowVisibility;
|
|
19
|
+
};
|
|
20
|
+
declare function configureContactShadowVisibility(props?: ContactShadowPassProps): EffectDefinition<'contactShadowRaw' | 'contactShadowScratch'>;
|
|
14
21
|
/** Prepares a screen-space visibility texture for one directional light. No history or submission. */
|
|
15
22
|
export declare class ContactShadowPass {
|
|
16
23
|
readonly device: Device;
|
|
@@ -21,4 +28,5 @@ export declare class ContactShadowPass {
|
|
|
21
28
|
render(options: ContactShadowRenderOptions): Texture;
|
|
22
29
|
destroy(): void;
|
|
23
30
|
}
|
|
31
|
+
export {};
|
|
24
32
|
//# sourceMappingURL=contact-shadow-pass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-shadow-pass.d.ts","sourceRoot":"","sources":["../../src/lighting/contact-shadow-pass.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,KAAK,MAAM,EAAE,KAAK,OAAO,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"contact-shadow-pass.d.ts","sourceRoot":"","sources":["../../src/lighting/contact-shadow-pass.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,KAAK,MAAM,EAAE,KAAK,OAAO,EAAC,MAAM,eAAe,CAAC;AAChE,OA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l/shaders';
|
|
5
5
|
import { Matrix4 } from '@math.gl/core/matrix';
|
|
6
|
-
import {
|
|
6
|
+
import { EffectRenderer } from "../passes/effect-renderer.js";
|
|
7
7
|
import { SHADOW_QUALITY_SETTINGS } from "./shadow-quality.js";
|
|
8
|
+
/** Produces an RGBA8 visibility texture for downstream lighting. */
|
|
9
|
+
export const contactShadowVisibilityEffect = {
|
|
10
|
+
name: 'contactShadowVisibility',
|
|
11
|
+
configure: configureContactShadowVisibility
|
|
12
|
+
};
|
|
13
|
+
function configureContactShadowVisibility(props = {}) {
|
|
14
|
+
const settings = SHADOW_QUALITY_SETTINGS[props.quality ?? 'balanced'];
|
|
15
|
+
return {
|
|
16
|
+
name: 'contactShadowVisibility',
|
|
17
|
+
resources: {
|
|
18
|
+
contactShadowRaw: {
|
|
19
|
+
scale: [settings.contactScale, settings.contactScale],
|
|
20
|
+
format: 'rgba8unorm'
|
|
21
|
+
},
|
|
22
|
+
contactShadowScratch: {
|
|
23
|
+
scale: [settings.contactScale, settings.contactScale],
|
|
24
|
+
format: 'rgba8unorm'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
passes: [
|
|
28
|
+
{
|
|
29
|
+
kind: 'fullscreen',
|
|
30
|
+
shaderPass: contactShadowTrace,
|
|
31
|
+
inputs: { sourceTexture: 'original' },
|
|
32
|
+
output: 'contactShadowRaw',
|
|
33
|
+
uniforms: { stepCount: settings.contactStepCount }
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
kind: 'fullscreen',
|
|
37
|
+
shaderPass: contactShadowBilateralBlur,
|
|
38
|
+
inputs: { sourceTexture: 'contactShadowRaw' },
|
|
39
|
+
output: 'contactShadowScratch',
|
|
40
|
+
uniforms: { direction: [1, 0] }
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
kind: 'fullscreen',
|
|
44
|
+
shaderPass: contactShadowBilateralBlur,
|
|
45
|
+
inputs: { sourceTexture: 'contactShadowScratch' },
|
|
46
|
+
output: 'previous',
|
|
47
|
+
uniforms: { direction: [0, 1] }
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
8
52
|
/** Prepares a screen-space visibility texture for one directional light. No history or submission. */
|
|
9
53
|
export class ContactShadowPass {
|
|
10
54
|
device;
|
|
@@ -12,42 +56,8 @@ export class ContactShadowPass {
|
|
|
12
56
|
destroyed = false;
|
|
13
57
|
constructor(device, props = {}) {
|
|
14
58
|
this.device = device;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
name: 'contactShadowVisibility',
|
|
18
|
-
renderTargets: {
|
|
19
|
-
contactShadowRaw: {
|
|
20
|
-
scale: [settings.contactScale, settings.contactScale],
|
|
21
|
-
format: 'rgba8unorm'
|
|
22
|
-
},
|
|
23
|
-
contactShadowScratch: {
|
|
24
|
-
scale: [settings.contactScale, settings.contactScale],
|
|
25
|
-
format: 'rgba8unorm'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
steps: [
|
|
29
|
-
{
|
|
30
|
-
shaderPass: contactShadowTrace,
|
|
31
|
-
inputs: { sourceTexture: 'original' },
|
|
32
|
-
output: 'contactShadowRaw',
|
|
33
|
-
uniforms: { stepCount: settings.contactStepCount }
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
shaderPass: contactShadowBilateralBlur,
|
|
37
|
-
inputs: { sourceTexture: 'contactShadowRaw' },
|
|
38
|
-
output: 'contactShadowScratch',
|
|
39
|
-
uniforms: { direction: [1, 0] }
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
shaderPass: contactShadowBilateralBlur,
|
|
43
|
-
inputs: { sourceTexture: 'contactShadowScratch' },
|
|
44
|
-
output: 'previous',
|
|
45
|
-
uniforms: { direction: [0, 1] }
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
};
|
|
49
|
-
this.renderer = new ShaderPassRenderer(device, {
|
|
50
|
-
shaderPasses: [shaderPass],
|
|
59
|
+
this.renderer = new EffectRenderer(device, {
|
|
60
|
+
effects: [{ effect: contactShadowVisibilityEffect, options: props }],
|
|
51
61
|
colorFormat: 'rgba8unorm'
|
|
52
62
|
});
|
|
53
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-shadow-pass.js","sourceRoot":"","sources":["../../src/lighting/contact-shadow-pass.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,MAAM,EAA4B,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"contact-shadow-pass.js","sourceRoot":"","sources":["../../src/lighting/contact-shadow-pass.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,MAAM,EAA4B,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EACL,cAAc,EAGf,qCAAkC;AACnC,OAAO,EAAC,uBAAuB,EAAC,4BAAyB;AAYzD,oEAAoE;AACpE,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,IAAI,EAAE,yBAAyB;IAC/B,SAAS,EAAE,gCAAgC;CAI5C,CAAC;AAEF,SAAS,gCAAgC,CACvC,QAAgC,EAAE;IAElC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,SAAS,EAAE;YACT,gBAAgB,EAAE;gBAChB,KAAK,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC;gBACrD,MAAM,EAAE,YAAY;aACrB;YACD,oBAAoB,EAAE;gBACpB,KAAK,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC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asOwnProp = 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_occluder_lookup_table_exports = {};
|
|
19
|
+
__export(cortao_occluder_lookup_table_exports, {
|
|
20
|
+
OCCLUDER_LOOKUP_DIRECTION_RESOLUTION: () => OCCLUDER_LOOKUP_DIRECTION_RESOLUTION,
|
|
21
|
+
OCCLUDER_LOOKUP_RADIUS_RESOLUTION: () => OCCLUDER_LOOKUP_RADIUS_RESOLUTION,
|
|
22
|
+
createOccluderLookupTable: () => createOccluderLookupTable,
|
|
23
|
+
getRayDirections: () => getRayDirections
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cortao_occluder_lookup_table_exports);
|
|
26
|
+
const OCCLUDER_LOOKUP_DIRECTION_RESOLUTION = 24;
|
|
27
|
+
const OCCLUDER_LOOKUP_RADIUS_RESOLUTION = 16;
|
|
28
|
+
const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
|
|
29
|
+
function createOccluderLookupTable(options) {
|
|
30
|
+
const { rayCount, directionResolution = OCCLUDER_LOOKUP_DIRECTION_RESOLUTION, radiusResolution = OCCLUDER_LOOKUP_RADIUS_RESOLUTION } = options;
|
|
31
|
+
const maxOccluderRadius = Math.SQRT2;
|
|
32
|
+
const rayDirections = getRayDirections(rayCount);
|
|
33
|
+
const texelCount = directionResolution * directionResolution * radiusResolution;
|
|
34
|
+
const data = rayCount <= 8 ? new Uint8Array(texelCount) : rayCount <= 16 ? new Uint16Array(texelCount) : new Uint32Array(texelCount);
|
|
35
|
+
for (let z = 0; z < radiusResolution; z++) {
|
|
36
|
+
const occluderRadius = maxOccluderRadius * (z + 0.5) / radiusResolution;
|
|
37
|
+
const occluderCosAngle = 1 - occluderRadius * occluderRadius * 0.5;
|
|
38
|
+
const sliceOffset = z * directionResolution * directionResolution;
|
|
39
|
+
const closestTexel = new Array(rayCount).fill(-1);
|
|
40
|
+
const closestCosAngle = new Array(rayCount).fill(-1);
|
|
41
|
+
for (let y = 0; y < directionResolution; y++) {
|
|
42
|
+
for (let x = 0; x < directionResolution; x++) {
|
|
43
|
+
const direction = decodeSphereMap((x + 0.5) / directionResolution, (y + 0.5) / directionResolution);
|
|
44
|
+
const texelIndex = y * directionResolution + x;
|
|
45
|
+
let rayBits = 0;
|
|
46
|
+
if (direction[2] !== -1) {
|
|
47
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
48
|
+
const cosAngle = dot(direction, rayDirections[rayIndex]);
|
|
49
|
+
if (cosAngle > closestCosAngle[rayIndex]) {
|
|
50
|
+
closestTexel[rayIndex] = texelIndex;
|
|
51
|
+
closestCosAngle[rayIndex] = cosAngle;
|
|
52
|
+
}
|
|
53
|
+
if (cosAngle > occluderCosAngle) {
|
|
54
|
+
rayBits |= 1 << rayIndex;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
data[sliceOffset + texelIndex] = rayBits >>> 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
62
|
+
const index = sliceOffset + closestTexel[rayIndex];
|
|
63
|
+
data[index] = (data[index] | 1 << rayIndex) >>> 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const format = rayCount <= 8 ? "r8uint" : rayCount <= 16 ? "r16uint" : "r32uint";
|
|
67
|
+
return { data, directionResolution, radiusResolution, format };
|
|
68
|
+
}
|
|
69
|
+
function getRayDirections(rayCount) {
|
|
70
|
+
const directions = [];
|
|
71
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
72
|
+
const angle = rayIndex * GOLDEN_ANGLE;
|
|
73
|
+
const radius = Math.sqrt((rayIndex + 0.5) / rayCount);
|
|
74
|
+
const x = Math.cos(angle) * radius;
|
|
75
|
+
const y = Math.sin(angle) * radius;
|
|
76
|
+
directions.push([x, y, Math.sqrt(1 - x * x - y * y)]);
|
|
77
|
+
}
|
|
78
|
+
return directions;
|
|
79
|
+
}
|
|
80
|
+
function decodeSphereMap(x, y) {
|
|
81
|
+
const encodedX = x * 2 - 1;
|
|
82
|
+
const encodedY = y * 2 - 1;
|
|
83
|
+
const z = Math.max(1 - encodedX * encodedX - encodedY * encodedY, 0);
|
|
84
|
+
const scale = 2 * Math.sqrt(z);
|
|
85
|
+
return [encodedX * scale, encodedY * scale, z * 2 - 1];
|
|
86
|
+
}
|
|
87
|
+
function dot(a, b) {
|
|
88
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
OCCLUDER_LOOKUP_DIRECTION_RESOLUTION,
|
|
93
|
+
OCCLUDER_LOOKUP_RADIUS_RESOLUTION,
|
|
94
|
+
createOccluderLookupTable,
|
|
95
|
+
getRayDirections
|
|
96
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Ray counts that have a CORTAO occluder lookup table. */
|
|
2
|
+
export type CORTAORayCount = 8 | 16 | 32;
|
|
3
|
+
/** Options for {@link createOccluderLookupTable}. */
|
|
4
|
+
export type OccluderLookupTableOptions = {
|
|
5
|
+
/** The number of rays per pixel. Each texel stores one bit per ray. */
|
|
6
|
+
rayCount: CORTAORayCount;
|
|
7
|
+
/** The X and Y resolution of the sphere-map direction axes. */
|
|
8
|
+
directionResolution?: number;
|
|
9
|
+
/** The Z resolution of the occluder radius axis. */
|
|
10
|
+
radiusResolution?: number;
|
|
11
|
+
};
|
|
12
|
+
/** The texels of an occluder lookup table, with X as the fastest axis. */
|
|
13
|
+
export type OccluderLookupTable = {
|
|
14
|
+
/** One unsigned integer of ray bits for each texel. */
|
|
15
|
+
data: Uint8Array | Uint16Array | Uint32Array;
|
|
16
|
+
/** The X and Y size of the table, in texels. */
|
|
17
|
+
directionResolution: number;
|
|
18
|
+
/** The Z size of the table, in texels. */
|
|
19
|
+
radiusResolution: number;
|
|
20
|
+
/** The integer texture format that holds one texel. */
|
|
21
|
+
format: 'r8uint' | 'r16uint' | 'r32uint';
|
|
22
|
+
};
|
|
23
|
+
/** The default direction resolution. CORTAO recommends 24 for up to 32 samples. */
|
|
24
|
+
export declare const OCCLUDER_LOOKUP_DIRECTION_RESOLUTION = 24;
|
|
25
|
+
/** The default radius resolution. CORTAO recommends 16 for up to 32 samples. */
|
|
26
|
+
export declare const OCCLUDER_LOOKUP_RADIUS_RESOLUTION = 16;
|
|
27
|
+
/**
|
|
28
|
+
* Creates the CORTAO occluder lookup table.
|
|
29
|
+
*
|
|
30
|
+
* Each texel holds the set of rays that an occluder blocks. The occluder has a tangent-space
|
|
31
|
+
* direction (sphere-map encoded on X and Y) and an angular radius (on Z). This is a port of
|
|
32
|
+
* `utils/generators/OccluderLookupTableGenerator.py` in the reference repository. The output is
|
|
33
|
+
* identical to the `.bin` tables in that repository.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createOccluderLookupTable(options: OccluderLookupTableOptions): OccluderLookupTable;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the tangent-space ray directions. The rays lie on a golden-angle spiral with a cosine
|
|
38
|
+
* distribution. The main pass shader uses the same formula.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getRayDirections(rayCount: number): [number, number, number][];
|
|
41
|
+
//# sourceMappingURL=cortao-occluder-lookup-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cortao-occluder-lookup-table.d.ts","sourceRoot":"","sources":["../../../src/lighting/cortao/cortao-occluder-lookup-table.ts"],"names":[],"mappings":"AAOA,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AAEzC,qDAAqD;AACrD,MAAM,MAAM,0BAA0B,GAAG;IACvC,uEAAuE;IACvE,QAAQ,EAAE,cAAc,CAAC;IACzB,+DAA+D;IAC/D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,uDAAuD;IACvD,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;IAC7C,gDAAgD;IAChD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;CAC1C,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,oCAAoC,KAAK,CAAC;AACvD,gFAAgF;AAChF,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAKpD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,mBAAmB,CAyDrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAU7E"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// Portions adapted from the CORTAO reference implementation.
|
|
5
|
+
// SPDX-FileCopyrightText: Copyright (c) 2026 Daniel Isheden
|
|
6
|
+
// See THIRD-PARTY-NOTICES.md in this module.
|
|
7
|
+
/** The default direction resolution. CORTAO recommends 24 for up to 32 samples. */
|
|
8
|
+
export const OCCLUDER_LOOKUP_DIRECTION_RESOLUTION = 24;
|
|
9
|
+
/** The default radius resolution. CORTAO recommends 16 for up to 32 samples. */
|
|
10
|
+
export const OCCLUDER_LOOKUP_RADIUS_RESOLUTION = 16;
|
|
11
|
+
/** The golden angle, PI * (3 - sqrt(5)). */
|
|
12
|
+
const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
|
|
13
|
+
/**
|
|
14
|
+
* Creates the CORTAO occluder lookup table.
|
|
15
|
+
*
|
|
16
|
+
* Each texel holds the set of rays that an occluder blocks. The occluder has a tangent-space
|
|
17
|
+
* direction (sphere-map encoded on X and Y) and an angular radius (on Z). This is a port of
|
|
18
|
+
* `utils/generators/OccluderLookupTableGenerator.py` in the reference repository. The output is
|
|
19
|
+
* identical to the `.bin` tables in that repository.
|
|
20
|
+
*/
|
|
21
|
+
export function createOccluderLookupTable(options) {
|
|
22
|
+
const { rayCount, directionResolution = OCCLUDER_LOOKUP_DIRECTION_RESOLUTION, radiusResolution = OCCLUDER_LOOKUP_RADIUS_RESOLUTION } = options;
|
|
23
|
+
const maxOccluderRadius = Math.SQRT2;
|
|
24
|
+
const rayDirections = getRayDirections(rayCount);
|
|
25
|
+
const texelCount = directionResolution * directionResolution * radiusResolution;
|
|
26
|
+
const data = rayCount <= 8
|
|
27
|
+
? new Uint8Array(texelCount)
|
|
28
|
+
: rayCount <= 16
|
|
29
|
+
? new Uint16Array(texelCount)
|
|
30
|
+
: new Uint32Array(texelCount);
|
|
31
|
+
for (let z = 0; z < radiusResolution; z++) {
|
|
32
|
+
const occluderRadius = (maxOccluderRadius * (z + 0.5)) / radiusResolution;
|
|
33
|
+
const occluderCosAngle = 1 - occluderRadius * occluderRadius * 0.5;
|
|
34
|
+
const sliceOffset = z * directionResolution * directionResolution;
|
|
35
|
+
const closestTexel = new Array(rayCount).fill(-1);
|
|
36
|
+
const closestCosAngle = new Array(rayCount).fill(-1);
|
|
37
|
+
for (let y = 0; y < directionResolution; y++) {
|
|
38
|
+
for (let x = 0; x < directionResolution; x++) {
|
|
39
|
+
const direction = decodeSphereMap((x + 0.5) / directionResolution, (y + 0.5) / directionResolution);
|
|
40
|
+
const texelIndex = y * directionResolution + x;
|
|
41
|
+
let rayBits = 0;
|
|
42
|
+
if (direction[2] !== -1) {
|
|
43
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
44
|
+
const cosAngle = dot(direction, rayDirections[rayIndex]);
|
|
45
|
+
if (cosAngle > closestCosAngle[rayIndex]) {
|
|
46
|
+
closestTexel[rayIndex] = texelIndex;
|
|
47
|
+
closestCosAngle[rayIndex] = cosAngle;
|
|
48
|
+
}
|
|
49
|
+
if (cosAngle > occluderCosAngle) {
|
|
50
|
+
rayBits |= 1 << rayIndex;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
data[sliceOffset + texelIndex] = rayBits >>> 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Each ray is always blocked by the texel that is nearest to it, so that small occluders
|
|
58
|
+
// that point straight at a ray do not fall between the texel centers.
|
|
59
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
60
|
+
const index = sliceOffset + closestTexel[rayIndex];
|
|
61
|
+
data[index] = (data[index] | (1 << rayIndex)) >>> 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const format = rayCount <= 8 ? 'r8uint' : rayCount <= 16 ? 'r16uint' : 'r32uint';
|
|
65
|
+
return { data, directionResolution, radiusResolution, format };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the tangent-space ray directions. The rays lie on a golden-angle spiral with a cosine
|
|
69
|
+
* distribution. The main pass shader uses the same formula.
|
|
70
|
+
*/
|
|
71
|
+
export function getRayDirections(rayCount) {
|
|
72
|
+
const directions = [];
|
|
73
|
+
for (let rayIndex = 0; rayIndex < rayCount; rayIndex++) {
|
|
74
|
+
const angle = rayIndex * GOLDEN_ANGLE;
|
|
75
|
+
const radius = Math.sqrt((rayIndex + 0.5) / rayCount);
|
|
76
|
+
const x = Math.cos(angle) * radius;
|
|
77
|
+
const y = Math.sin(angle) * radius;
|
|
78
|
+
directions.push([x, y, Math.sqrt(1 - x * x - y * y)]);
|
|
79
|
+
}
|
|
80
|
+
return directions;
|
|
81
|
+
}
|
|
82
|
+
/** Decodes a sphere-map coordinate in [0, 1] to a unit direction. */
|
|
83
|
+
function decodeSphereMap(x, y) {
|
|
84
|
+
const encodedX = x * 2 - 1;
|
|
85
|
+
const encodedY = y * 2 - 1;
|
|
86
|
+
const z = Math.max(1 - encodedX * encodedX - encodedY * encodedY, 0);
|
|
87
|
+
const scale = 2 * Math.sqrt(z);
|
|
88
|
+
return [encodedX * scale, encodedY * scale, z * 2 - 1];
|
|
89
|
+
}
|
|
90
|
+
/** Gets the dot product of two 3D vectors. */
|
|
91
|
+
function dot(a, b) {
|
|
92
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=cortao-occluder-lookup-table.js.map
|