@luma.gl/shaders 10.0.0-alpha.10 → 10.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +1776 -58
- package/dist/dist.min.js +1394 -147
- package/dist/index.cjs +35 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.cjs +40 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts +6 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts.map +1 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js +15 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.cjs +348 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts +188 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js +307 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.cjs +87 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts +21 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js +61 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.cjs +87 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts +21 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js +61 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.cjs +33 -11
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts +2 -2
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js +33 -11
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +33 -11
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js +33 -11
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +3 -3
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.cjs +97 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts +15 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js +69 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.cjs +114 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts +15 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js +88 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.cjs +379 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts +41 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js +345 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.cjs +228 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts +3 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js +204 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.cjs +15 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts +63 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.js +5 -0
- package/dist/modules/lighting/shadow/shadow-types.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow.cjs +458 -0
- package/dist/modules/lighting/shadow/shadow.d.ts +117 -0
- package/dist/modules/lighting/shadow/shadow.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow.js +450 -0
- package/dist/modules/lighting/shadow/shadow.js.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.cjs +60 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts +9 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js +40 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +48 -0
- package/src/modules/lighting/clustered-light-grid/clustered-light-grid.ts +17 -0
- package/src/modules/lighting/contact-shadow/contact-shadow.ts +365 -0
- package/src/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.ts +78 -0
- package/src/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.ts +78 -0
- package/src/modules/lighting/pbr-material/pbr-material-glsl.ts +33 -11
- package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +33 -11
- package/src/modules/lighting/pbr-shadow/pbr-shadow.ts +85 -0
- package/src/modules/lighting/pbr-surface/pbr-surface.ts +103 -0
- package/src/modules/lighting/prefiltered-environment/prefiltered-environment.ts +370 -0
- package/src/modules/lighting/shadow/shadow-glsl.ts +204 -0
- package/src/modules/lighting/shadow/shadow-types.ts +68 -0
- package/src/modules/lighting/shadow/shadow.ts +536 -0
- package/src/modules/lighting/unlit-material/unlit-material.ts +44 -0
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export { lighting } from "./modules/lighting/lights/lighting.js";
|
|
|
58
58
|
export type { IBLBindings } from "./modules/lighting/ibl/ibl.js";
|
|
59
59
|
export { ibl } from "./modules/lighting/ibl/ibl.js";
|
|
60
60
|
export { dirlight } from "./modules/lighting/no-material/dirlight.js";
|
|
61
|
+
export { unlitMaterial } from "./modules/lighting/unlit-material/unlit-material.js";
|
|
61
62
|
export type { LambertMaterialProps } from "./modules/lighting/lambert-material/lambert-material.js";
|
|
62
63
|
export { lambertMaterial } from "./modules/lighting/lambert-material/lambert-material.js";
|
|
63
64
|
export type { GouraudMaterialProps } from "./modules/lighting/gouraud-material/gouraud-material.js";
|
|
@@ -88,4 +89,20 @@ export { surfaceWeather, integrateSurfaceWeather, type SurfaceWeatherProps, type
|
|
|
88
89
|
export { firefly, type FireflyProps, type FireflyUniforms } from "./modules/lighting/firefly/firefly.js";
|
|
89
90
|
export { globeClouds, type GlobeCloudProps, type GlobeCloudUniforms } from "./modules/lighting/globe-clouds/globe-clouds.js";
|
|
90
91
|
export { areaLighting, type AreaLight, type AreaLightingProps } from "./modules/lighting/area-lighting/area-lighting.js";
|
|
92
|
+
export { pbrEnvironmentFilter, PBR_ENVIRONMENT_FRAGMENT_GLSL, PBR_ENVIRONMENT_FRAGMENT_WGSL } from "./modules/lighting/prefiltered-environment/prefiltered-environment.js";
|
|
93
|
+
export type { PBREnvironmentFilterProps, PBREnvironmentFilterUniforms, PBREnvironmentFilterBindings } from "./modules/lighting/prefiltered-environment/prefiltered-environment.js";
|
|
94
|
+
export { shadow } from "./modules/lighting/shadow/shadow.js";
|
|
95
|
+
export type { ShadowBindings, ShadowUniforms } from "./modules/lighting/shadow/shadow.js";
|
|
96
|
+
export type { DirectionalShadowLight, SpotShadowLight, PointShadowLight, ShadowProps, ShadowTexture, ShadowBiasProps } from "./modules/lighting/shadow/shadow-types.js";
|
|
97
|
+
export { pbrShadow } from "./modules/lighting/pbr-shadow/pbr-shadow.js";
|
|
98
|
+
export type { PBRShadowProps, PBRShadowUniforms } from "./modules/lighting/pbr-shadow/pbr-shadow.js";
|
|
99
|
+
export { pbrSurface } from "./modules/lighting/pbr-surface/pbr-surface.js";
|
|
100
|
+
export type { PBRSurfaceProps, PBRSurfaceUniforms } from "./modules/lighting/pbr-surface/pbr-surface.js";
|
|
101
|
+
export { contactShadowTrace, contactShadowBilateralBlur, contactShadowComposite } from "./modules/lighting/contact-shadow/contact-shadow.js";
|
|
102
|
+
export type { ContactTraceUniforms, ContactBlurUniforms, ContactShadowBindings, ContactShadowProps } from "./modules/lighting/contact-shadow/contact-shadow.js";
|
|
103
|
+
export { pbrContactShadow } from "./modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js";
|
|
104
|
+
export type { PBRContactShadowProps } from "./modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js";
|
|
105
|
+
export { clusteredLightGrid } from "./modules/lighting/clustered-light-grid/clustered-light-grid.js";
|
|
106
|
+
export { pbrAmbientOcclusion } from "./modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js";
|
|
107
|
+
export type { PBRAmbientOcclusionProps } from "./modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js";
|
|
91
108
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,YAAY,EAAC,YAAY,EAAC,+CAA4C;AACtE,YAAY,EAAC,qBAAqB,EAAC,oDAAiD;AACpF,OAAO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A2E;AAE5E,OAAO,EAAC,MAAM,EAAC,4CAAyC;AACxD,YAAY,EAAC,cAAc,EAAE,cAAc,EAAC,4CAAyC;AACrF,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,kDAA+C;AAEhD,OAAO,EAAC,SAAS,EAAC,oDAAiD;AACnE,YAAY,EAAC,cAAc,EAAE,iBAAiB,EAAC,oDAAiD;AAEhG,OAAO,EAAC,UAAU,EAAC,sDAAmD;AACtE,YAAY,EAAC,eAAe,EAAE,kBAAkB,EAAC,sDAAmD;AAEpG,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACvB,4DAAyD;AAC1D,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EACnB,4DAAyD;AAE1D,OAAO,EAAC,gBAAgB,EAAC,oEAAiE;AAC1F,YAAY,EAAC,qBAAqB,EAAC,oEAAiE;AAEpG,OAAO,EAAC,kBAAkB,EAAC,wEAAqE;AAChG,OAAO,EAAC,mBAAmB,EAAC,0EAAuE;AACnG,YAAY,EAAC,wBAAwB,EAAC,0EAAuE"}
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ export { gpuAnimation } from "./modules/engine/gpu-animation/gpu-animation.js";
|
|
|
43
43
|
export { lighting } from "./modules/lighting/lights/lighting.js";
|
|
44
44
|
export { ibl } from "./modules/lighting/ibl/ibl.js";
|
|
45
45
|
export { dirlight } from "./modules/lighting/no-material/dirlight.js";
|
|
46
|
+
export { unlitMaterial } from "./modules/lighting/unlit-material/unlit-material.js";
|
|
46
47
|
export { lambertMaterial } from "./modules/lighting/lambert-material/lambert-material.js";
|
|
47
48
|
export { gouraudMaterial } from "./modules/lighting/gouraud-material/gouraud-material.js";
|
|
48
49
|
export { phongMaterial } from "./modules/lighting/phong-material/phong-material.js";
|
|
@@ -62,4 +63,12 @@ export { surfaceWeather, integrateSurfaceWeather } from "./modules/lighting/surf
|
|
|
62
63
|
export { firefly } from "./modules/lighting/firefly/firefly.js";
|
|
63
64
|
export { globeClouds } from "./modules/lighting/globe-clouds/globe-clouds.js";
|
|
64
65
|
export { areaLighting } from "./modules/lighting/area-lighting/area-lighting.js";
|
|
66
|
+
export { pbrEnvironmentFilter, PBR_ENVIRONMENT_FRAGMENT_GLSL, PBR_ENVIRONMENT_FRAGMENT_WGSL } from "./modules/lighting/prefiltered-environment/prefiltered-environment.js";
|
|
67
|
+
export { shadow } from "./modules/lighting/shadow/shadow.js";
|
|
68
|
+
export { pbrShadow } from "./modules/lighting/pbr-shadow/pbr-shadow.js";
|
|
69
|
+
export { pbrSurface } from "./modules/lighting/pbr-surface/pbr-surface.js";
|
|
70
|
+
export { contactShadowTrace, contactShadowBilateralBlur, contactShadowComposite } from "./modules/lighting/contact-shadow/contact-shadow.js";
|
|
71
|
+
export { pbrContactShadow } from "./modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js";
|
|
72
|
+
export { clusteredLightGrid } from "./modules/lighting/clustered-light-grid/clustered-light-grid.js";
|
|
73
|
+
export { pbrAmbientOcclusion } from "./modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js";
|
|
65
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAU5D,OAAO,EACL,iBAAiB,EAElB,qDAAkD;AAyBnD,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,6CAA0C;AAClG,OAAO,EAAC,uBAAuB,EAAC,6CAA0C;AAC1E,OAAO,EAAC,2BAA2B,EAAC,0DAAuD;AAC3F,OAAO,EAAC,6BAA6B,EAAC,6CAA0C;AAChF,OAAO,EAAC,wBAAwB,EAAE,oBAAoB,EAAC,+BAA4B;AAMnF,OAAO,EAC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nPropNames = 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 clustered_light_grid_exports = {};
|
|
19
|
+
__export(clustered_light_grid_exports, {
|
|
20
|
+
clusteredLightGrid: () => clusteredLightGrid
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(clustered_light_grid_exports);
|
|
23
|
+
const clusteredLightGrid = {
|
|
24
|
+
name: "clusteredLightGrid",
|
|
25
|
+
source: (
|
|
26
|
+
/* wgsl */
|
|
27
|
+
`
|
|
28
|
+
fn clusteredLightGrid_getIndex(coordinates: vec2f, viewDepth: f32, dimensions: vec3u, nearPlane: f32, farPlane: f32) -> u32 {
|
|
29
|
+
let tile = min(vec2u(clamp(coordinates, vec2f(0.0), vec2f(0.999999)) * vec2f(dimensions.xy)), dimensions.xy - vec2u(1));
|
|
30
|
+
let normalizedDepth = clamp(log(clamp(viewDepth, nearPlane, farPlane) / nearPlane) / log(farPlane / nearPlane), 0.0, 0.999999);
|
|
31
|
+
let depthSlice = min(u32(normalizedDepth * f32(dimensions.z)), dimensions.z - 1u);
|
|
32
|
+
return (depthSlice * dimensions.y + tile.y) * dimensions.x + tile.x;
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
)
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
clusteredLightGrid
|
|
40
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Renderer-independent lookup for top-left normalized screen coordinates and positive view depth. */
|
|
2
|
+
export declare const clusteredLightGrid: {
|
|
3
|
+
readonly name: "clusteredLightGrid";
|
|
4
|
+
readonly source: "\nfn clusteredLightGrid_getIndex(coordinates: vec2f, viewDepth: f32, dimensions: vec3u, nearPlane: f32, farPlane: f32) -> u32 {\n let tile = min(vec2u(clamp(coordinates, vec2f(0.0), vec2f(0.999999)) * vec2f(dimensions.xy)), dimensions.xy - vec2u(1));\n let normalizedDepth = clamp(log(clamp(viewDepth, nearPlane, farPlane) / nearPlane) / log(farPlane / nearPlane), 0.0, 0.999999);\n let depthSlice = min(u32(normalizedDepth * f32(dimensions.z)), dimensions.z - 1u);\n return (depthSlice * dimensions.y + tile.y) * dimensions.x + tile.x;\n}\n";
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=clustered-light-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clustered-light-grid.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/clustered-light-grid/clustered-light-grid.ts"],"names":[],"mappings":"AAKA,sGAAsG;AACtG,eAAO,MAAM,kBAAkB;;;CAUE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
3
|
+
/** Renderer-independent lookup for top-left normalized screen coordinates and positive view depth. */
|
|
4
|
+
export const clusteredLightGrid = {
|
|
5
|
+
name: 'clusteredLightGrid',
|
|
6
|
+
source: /* wgsl */ `
|
|
7
|
+
fn clusteredLightGrid_getIndex(coordinates: vec2f, viewDepth: f32, dimensions: vec3u, nearPlane: f32, farPlane: f32) -> u32 {
|
|
8
|
+
let tile = min(vec2u(clamp(coordinates, vec2f(0.0), vec2f(0.999999)) * vec2f(dimensions.xy)), dimensions.xy - vec2u(1));
|
|
9
|
+
let normalizedDepth = clamp(log(clamp(viewDepth, nearPlane, farPlane) / nearPlane) / log(farPlane / nearPlane), 0.0, 0.999999);
|
|
10
|
+
let depthSlice = min(u32(normalizedDepth * f32(dimensions.z)), dimensions.z - 1u);
|
|
11
|
+
return (depthSlice * dimensions.y + tile.y) * dimensions.x + tile.x;
|
|
12
|
+
}
|
|
13
|
+
`
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=clustered-light-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clustered-light-grid.js","sourceRoot":"","sources":["../../../../src/modules/lighting/clustered-light-grid/clustered-light-grid.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4DAA4D;AAI5D,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE,UAAU,CAAC;;;;;;;CAOpB;CACgC,CAAC"}
|
|
@@ -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 contact_shadow_exports = {};
|
|
19
|
+
__export(contact_shadow_exports, {
|
|
20
|
+
contactShadowBilateralBlur: () => contactShadowBilateralBlur,
|
|
21
|
+
contactShadowComposite: () => contactShadowComposite,
|
|
22
|
+
contactShadowTrace: () => contactShadowTrace
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(contact_shadow_exports);
|
|
25
|
+
const IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
26
|
+
const contactShadowTrace = {
|
|
27
|
+
name: "contactShadowTrace",
|
|
28
|
+
source: (
|
|
29
|
+
/* wgsl */
|
|
30
|
+
`struct contactShadowTraceUniforms {
|
|
31
|
+
projectionMatrix: mat4x4f,
|
|
32
|
+
inverseProjectionMatrix: mat4x4f,
|
|
33
|
+
lightDirectionView: vec3f,
|
|
34
|
+
maxDistance: f32,
|
|
35
|
+
thickness: f32,
|
|
36
|
+
stepCount: f32,
|
|
37
|
+
frameIndex: f32,
|
|
38
|
+
normalBias: f32,
|
|
39
|
+
};
|
|
40
|
+
@group(0) @binding(auto) var<uniform> contactShadowTrace: contactShadowTraceUniforms;
|
|
41
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
42
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
43
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
44
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
45
|
+
|
|
46
|
+
fn contactShadow_reconstructViewPosition(uv: vec2f, depth: f32) -> vec3f {
|
|
47
|
+
let clip = vec4f(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);
|
|
48
|
+
let view = contactShadowTrace.inverseProjectionMatrix * clip;
|
|
49
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fn contactShadow_projectViewPosition(position: vec3f) -> vec2f {
|
|
53
|
+
let clip = contactShadowTrace.projectionMatrix * vec4f(position, 1.0);
|
|
54
|
+
let ndc = clip.xy / max(abs(clip.w), 0.00001);
|
|
55
|
+
return vec2f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn contactShadowTrace_sampleColor(
|
|
59
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
60
|
+
) -> vec4f {
|
|
61
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
62
|
+
if (centerDepth >= 0.99999) { return vec4f(1.0); }
|
|
63
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
64
|
+
let centerPosition = contactShadow_reconstructViewPosition(texCoord, centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
65
|
+
let rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
66
|
+
let noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex, vec2f(12.9898, 78.233))) * 43758.5453);
|
|
67
|
+
for (var index: i32 = 0; index < 40; index++) {
|
|
68
|
+
if (f32(index) >= contactShadowTrace.stepCount) { break; }
|
|
69
|
+
let fraction = (f32(index) + 0.35 + noise * 0.5) / max(contactShadowTrace.stepCount, 1.0);
|
|
70
|
+
let travel = contactShadowTrace.maxDistance * fraction * fraction;
|
|
71
|
+
let rayPosition = centerPosition + rayDirection * travel;
|
|
72
|
+
let sampleUv = contactShadow_projectViewPosition(rayPosition);
|
|
73
|
+
if (any(sampleUv <= vec2f(0.0)) || any(sampleUv >= vec2f(1.0))) { break; }
|
|
74
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
75
|
+
if (sampleDepth >= 0.99999) { continue; }
|
|
76
|
+
let scenePosition = contactShadow_reconstructViewPosition(sampleUv, sampleDepth);
|
|
77
|
+
let depthDelta = (-rayPosition.z) - (-scenePosition.z);
|
|
78
|
+
let hitThickness = contactShadowTrace.thickness + travel * 0.02;
|
|
79
|
+
if (depthDelta >= 0.0 && depthDelta <= hitThickness) {
|
|
80
|
+
let distanceFade = 1.0 - clamp(travel / contactShadowTrace.maxDistance, 0.0, 1.0);
|
|
81
|
+
return vec4f(vec3f(1.0 - distanceFade), 1.0);
|
|
82
|
+
}
|
|
83
|
+
if (depthDelta > hitThickness * 8.0) { break; }
|
|
84
|
+
}
|
|
85
|
+
return vec4f(1.0);
|
|
86
|
+
}`
|
|
87
|
+
),
|
|
88
|
+
fs: (
|
|
89
|
+
/* glsl */
|
|
90
|
+
`
|
|
91
|
+
layout(std140) uniform contactShadowTraceUniforms {
|
|
92
|
+
mat4 projectionMatrix;
|
|
93
|
+
mat4 inverseProjectionMatrix;
|
|
94
|
+
vec3 lightDirectionView;
|
|
95
|
+
float maxDistance;
|
|
96
|
+
float thickness;
|
|
97
|
+
float stepCount;
|
|
98
|
+
float frameIndex;
|
|
99
|
+
float normalBias;
|
|
100
|
+
} contactShadowTrace;
|
|
101
|
+
uniform sampler2D depthTexture;
|
|
102
|
+
uniform sampler2D normalTexture;
|
|
103
|
+
vec3 contactShadow_reconstructViewPosition(vec2 uv, float depth) {
|
|
104
|
+
vec4 view = contactShadowTrace.inverseProjectionMatrix * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
|
105
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
106
|
+
}
|
|
107
|
+
vec2 contactShadow_projectViewPosition(vec3 position) {
|
|
108
|
+
vec4 clip = contactShadowTrace.projectionMatrix * vec4(position,1.0);
|
|
109
|
+
return clip.xy / max(abs(clip.w),0.00001) * 0.5 + 0.5;
|
|
110
|
+
}
|
|
111
|
+
vec4 contactShadowTrace_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
112
|
+
float centerDepth = texture(depthTexture,texCoord).r;
|
|
113
|
+
if(centerDepth >= 0.99999) return vec4(1.0);
|
|
114
|
+
vec3 centerNormal = normalize(texture(normalTexture,texCoord).xyz * 2.0 - 1.0);
|
|
115
|
+
vec3 centerPosition = contactShadow_reconstructViewPosition(texCoord,centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
116
|
+
vec3 rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
117
|
+
float noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex,vec2(12.9898,78.233))) * 43758.5453);
|
|
118
|
+
for(int index=0;index<40;index++) {
|
|
119
|
+
if(float(index)>=contactShadowTrace.stepCount) break;
|
|
120
|
+
float fraction=(float(index)+0.35+noise*0.5)/max(contactShadowTrace.stepCount,1.0);
|
|
121
|
+
float travel=contactShadowTrace.maxDistance*fraction*fraction;
|
|
122
|
+
vec3 rayPosition=centerPosition+rayDirection*travel;
|
|
123
|
+
vec2 sampleUv=contactShadow_projectViewPosition(rayPosition);
|
|
124
|
+
if(any(lessThanEqual(sampleUv,vec2(0.0)))||any(greaterThanEqual(sampleUv,vec2(1.0))))break;
|
|
125
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
126
|
+
if(sampleDepth>=0.99999)continue;
|
|
127
|
+
vec3 scenePosition=contactShadow_reconstructViewPosition(sampleUv,sampleDepth);
|
|
128
|
+
float depthDelta=(-rayPosition.z)-(-scenePosition.z);
|
|
129
|
+
float hitThickness=contactShadowTrace.thickness+travel*0.02;
|
|
130
|
+
if(depthDelta>=0.0&&depthDelta<=hitThickness) {
|
|
131
|
+
float distanceFade=1.0-clamp(travel/contactShadowTrace.maxDistance,0.0,1.0);
|
|
132
|
+
return vec4(vec3(1.0-distanceFade),1.0);
|
|
133
|
+
}
|
|
134
|
+
if(depthDelta>hitThickness*8.0)break;
|
|
135
|
+
}
|
|
136
|
+
return vec4(1.0);
|
|
137
|
+
}
|
|
138
|
+
`
|
|
139
|
+
),
|
|
140
|
+
bindingLayout: [
|
|
141
|
+
{ name: "depthTexture", group: 0 },
|
|
142
|
+
{ name: "normalTexture", group: 0 }
|
|
143
|
+
],
|
|
144
|
+
props: {},
|
|
145
|
+
uniforms: {},
|
|
146
|
+
bindings: {},
|
|
147
|
+
uniformTypes: {
|
|
148
|
+
projectionMatrix: "mat4x4<f32>",
|
|
149
|
+
inverseProjectionMatrix: "mat4x4<f32>",
|
|
150
|
+
lightDirectionView: "vec3<f32>",
|
|
151
|
+
maxDistance: "f32",
|
|
152
|
+
thickness: "f32",
|
|
153
|
+
stepCount: "f32",
|
|
154
|
+
frameIndex: "f32",
|
|
155
|
+
normalBias: "f32"
|
|
156
|
+
},
|
|
157
|
+
propTypes: {
|
|
158
|
+
projectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
159
|
+
inverseProjectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
160
|
+
lightDirectionView: { value: [0, 1, 0], private: true },
|
|
161
|
+
maxDistance: { value: 4, min: 0.1, softMax: 16 },
|
|
162
|
+
thickness: { value: 0.12, min: 5e-3, softMax: 1 },
|
|
163
|
+
stepCount: { value: 24, min: 1, max: 40 },
|
|
164
|
+
frameIndex: { value: 0, private: true },
|
|
165
|
+
normalBias: { value: 0.035, min: 0, softMax: 0.2 }
|
|
166
|
+
},
|
|
167
|
+
passes: [{ sampler: true }]
|
|
168
|
+
};
|
|
169
|
+
const contactShadowBilateralBlur = {
|
|
170
|
+
name: "contactShadowBilateralBlur",
|
|
171
|
+
source: (
|
|
172
|
+
/* wgsl */
|
|
173
|
+
`struct contactShadowBilateralBlurUniforms {
|
|
174
|
+
direction: vec2f,
|
|
175
|
+
radius: f32,
|
|
176
|
+
depthSigma: f32,
|
|
177
|
+
normalPower: f32,
|
|
178
|
+
};
|
|
179
|
+
@group(0) @binding(auto) var<uniform> contactShadowBilateralBlur: contactShadowBilateralBlurUniforms;
|
|
180
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
181
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
182
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
183
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
184
|
+
|
|
185
|
+
fn contactShadowBilateralBlur_sampleColor(
|
|
186
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
187
|
+
) -> vec4f {
|
|
188
|
+
let sourceDimensions = vec2f(textureDimensions(sourceTexture));
|
|
189
|
+
let texel = contactShadowBilateralBlur.direction / sourceDimensions;
|
|
190
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
191
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
192
|
+
var result = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0).r;
|
|
193
|
+
var totalWeight = 1.0;
|
|
194
|
+
for (var index: i32 = 1; index <= 6; index++) {
|
|
195
|
+
if (f32(index) > contactShadowBilateralBlur.radius) { break; }
|
|
196
|
+
for (var side: i32 = -1; side <= 1; side += 2) {
|
|
197
|
+
let sampleUv = clamp(texCoord + texel * f32(index * side), vec2f(0.0), vec2f(1.0));
|
|
198
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
199
|
+
let sampleNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, sampleUv, 0.0).xyz * 2.0 - 1.0);
|
|
200
|
+
let depthDelta = abs(sampleDepth - centerDepth);
|
|
201
|
+
let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * contactShadowBilateralBlur.depthSigma * contactShadowBilateralBlur.depthSigma, 0.000001));
|
|
202
|
+
let normalWeight = pow(max(dot(centerNormal, sampleNormal), 0.0), contactShadowBilateralBlur.normalPower);
|
|
203
|
+
let spatialWeight = exp(-f32(index * index) / 8.0);
|
|
204
|
+
let weight = depthWeight * normalWeight * spatialWeight;
|
|
205
|
+
result += textureSampleLevel(sourceTexture, sourceTextureSampler, sampleUv, 0.0).r * weight;
|
|
206
|
+
totalWeight += weight;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
let visibility = result / totalWeight;
|
|
210
|
+
return vec4f(vec3f(visibility), 1.0);
|
|
211
|
+
}`
|
|
212
|
+
),
|
|
213
|
+
fs: (
|
|
214
|
+
/* glsl */
|
|
215
|
+
`
|
|
216
|
+
layout(std140) uniform contactShadowBilateralBlurUniforms {
|
|
217
|
+
vec2 direction;
|
|
218
|
+
float radius;
|
|
219
|
+
float depthSigma;
|
|
220
|
+
float normalPower;
|
|
221
|
+
} contactShadowBilateralBlur;
|
|
222
|
+
uniform sampler2D depthTexture;
|
|
223
|
+
uniform sampler2D normalTexture;
|
|
224
|
+
vec4 contactShadowBilateralBlur_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
225
|
+
vec2 texel=contactShadowBilateralBlur.direction/vec2(textureSize(sourceTexture,0));
|
|
226
|
+
float centerDepth=texture(depthTexture,texCoord).r;
|
|
227
|
+
vec3 centerNormal=normalize(texture(normalTexture,texCoord).xyz*2.0-1.0);
|
|
228
|
+
float result=texture(sourceTexture,texCoord).r;
|
|
229
|
+
float totalWeight=1.0;
|
|
230
|
+
for(int index=1;index<=6;index++) {
|
|
231
|
+
if(float(index)>contactShadowBilateralBlur.radius)break;
|
|
232
|
+
for(int side=-1;side<=1;side+=2) {
|
|
233
|
+
vec2 sampleUv=clamp(texCoord+texel*float(index*side),vec2(0.0),vec2(1.0));
|
|
234
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
235
|
+
vec3 sampleNormal=normalize(texture(normalTexture,sampleUv).xyz*2.0-1.0);
|
|
236
|
+
float depthDelta=abs(sampleDepth-centerDepth);
|
|
237
|
+
float depthWeight=exp(-(depthDelta*depthDelta)/max(2.0*contactShadowBilateralBlur.depthSigma*contactShadowBilateralBlur.depthSigma,0.000001));
|
|
238
|
+
float normalWeight=pow(max(dot(centerNormal,sampleNormal),0.0),contactShadowBilateralBlur.normalPower);
|
|
239
|
+
float spatialWeight=exp(-float(index*index)/8.0);
|
|
240
|
+
float weight=depthWeight*normalWeight*spatialWeight;
|
|
241
|
+
result+=texture(sourceTexture,sampleUv).r*weight;totalWeight+=weight;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return vec4(vec3(result/totalWeight),1.0);
|
|
245
|
+
}
|
|
246
|
+
`
|
|
247
|
+
),
|
|
248
|
+
bindingLayout: [
|
|
249
|
+
{ name: "depthTexture", group: 0 },
|
|
250
|
+
{ name: "normalTexture", group: 0 }
|
|
251
|
+
],
|
|
252
|
+
props: {},
|
|
253
|
+
uniforms: {},
|
|
254
|
+
bindings: {},
|
|
255
|
+
uniformTypes: {
|
|
256
|
+
direction: "vec2<f32>",
|
|
257
|
+
radius: "f32",
|
|
258
|
+
depthSigma: "f32",
|
|
259
|
+
normalPower: "f32"
|
|
260
|
+
},
|
|
261
|
+
propTypes: {
|
|
262
|
+
direction: { value: [1, 0], private: true },
|
|
263
|
+
radius: { value: 4, min: 1, max: 6 },
|
|
264
|
+
depthSigma: { value: 6e-3, min: 1e-4, softMax: 0.05 },
|
|
265
|
+
normalPower: { value: 24, min: 1, softMax: 64 }
|
|
266
|
+
},
|
|
267
|
+
passes: [{ sampler: true }]
|
|
268
|
+
};
|
|
269
|
+
const contactShadowComposite = {
|
|
270
|
+
name: "contactShadowComposite",
|
|
271
|
+
source: (
|
|
272
|
+
/* wgsl */
|
|
273
|
+
`struct contactShadowCompositeUniforms {
|
|
274
|
+
strength: f32,
|
|
275
|
+
debugMode: f32,
|
|
276
|
+
};
|
|
277
|
+
@group(0) @binding(auto) var<uniform> contactShadowComposite: contactShadowCompositeUniforms;
|
|
278
|
+
@group(0) @binding(auto) var contactShadowTexture: texture_2d<f32>;
|
|
279
|
+
@group(0) @binding(auto) var contactShadowTextureSampler: sampler;
|
|
280
|
+
@group(0) @binding(auto) var directionalDirectTexture: texture_2d<f32>;
|
|
281
|
+
@group(0) @binding(auto) var directionalDirectTextureSampler: sampler;
|
|
282
|
+
@group(0) @binding(auto) var shadowDebugTexture: texture_2d<f32>;
|
|
283
|
+
@group(0) @binding(auto) var shadowDebugTextureSampler: sampler;
|
|
284
|
+
|
|
285
|
+
fn contactShadowComposite_sampleColor(
|
|
286
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
287
|
+
) -> vec4f {
|
|
288
|
+
let color = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);
|
|
289
|
+
let contact = textureSampleLevel(contactShadowTexture, contactShadowTextureSampler, texCoord, 0.0).r;
|
|
290
|
+
let appliedContact = mix(1.0, contact, contactShadowComposite.strength);
|
|
291
|
+
if (contactShadowComposite.debugMode > 0.5 && contactShadowComposite.debugMode < 1.5) {
|
|
292
|
+
return vec4f(vec3f(contact), 1.0);
|
|
293
|
+
}
|
|
294
|
+
if (contactShadowComposite.debugMode >= 1.5) {
|
|
295
|
+
let factors = textureSampleLevel(shadowDebugTexture, shadowDebugTextureSampler, texCoord, 0.0).rgb;
|
|
296
|
+
return vec4f(vec3f(factors.x * factors.y * factors.z * contact), 1.0);
|
|
297
|
+
}
|
|
298
|
+
let directionalDirect = textureSampleLevel(
|
|
299
|
+
directionalDirectTexture,
|
|
300
|
+
directionalDirectTextureSampler,
|
|
301
|
+
texCoord,
|
|
302
|
+
0.0
|
|
303
|
+
).rgb;
|
|
304
|
+
return vec4f(max(color.rgb - directionalDirect * (1.0 - appliedContact), vec3f(0.0)), color.a);
|
|
305
|
+
}`
|
|
306
|
+
),
|
|
307
|
+
fs: (
|
|
308
|
+
/* glsl */
|
|
309
|
+
`
|
|
310
|
+
layout(std140) uniform contactShadowCompositeUniforms {
|
|
311
|
+
float strength;
|
|
312
|
+
float debugMode;
|
|
313
|
+
} contactShadowComposite;
|
|
314
|
+
uniform sampler2D contactShadowTexture;
|
|
315
|
+
uniform sampler2D directionalDirectTexture;
|
|
316
|
+
uniform sampler2D shadowDebugTexture;
|
|
317
|
+
vec4 contactShadowComposite_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
318
|
+
vec4 color=texture(sourceTexture,texCoord);
|
|
319
|
+
float contact=texture(contactShadowTexture,texCoord).r;
|
|
320
|
+
float appliedContact=mix(1.0,contact,contactShadowComposite.strength);
|
|
321
|
+
if(contactShadowComposite.debugMode>0.5&&contactShadowComposite.debugMode<1.5)return vec4(vec3(contact),1.0);
|
|
322
|
+
if(contactShadowComposite.debugMode>=1.5){vec3 factors=texture(shadowDebugTexture,texCoord).rgb;return vec4(vec3(factors.x*factors.y*factors.z*contact),1.0);}
|
|
323
|
+
vec3 directionalDirect=texture(directionalDirectTexture,texCoord).rgb;
|
|
324
|
+
return vec4(max(color.rgb-directionalDirect*(1.0-appliedContact),vec3(0.0)),color.a);
|
|
325
|
+
}
|
|
326
|
+
`
|
|
327
|
+
),
|
|
328
|
+
bindingLayout: [
|
|
329
|
+
{ name: "contactShadowTexture", group: 0 },
|
|
330
|
+
{ name: "directionalDirectTexture", group: 0 },
|
|
331
|
+
{ name: "shadowDebugTexture", group: 0 }
|
|
332
|
+
],
|
|
333
|
+
props: {},
|
|
334
|
+
uniforms: {},
|
|
335
|
+
bindings: {},
|
|
336
|
+
uniformTypes: { strength: "f32", debugMode: "f32" },
|
|
337
|
+
propTypes: {
|
|
338
|
+
strength: { value: 1, min: 0, max: 1 },
|
|
339
|
+
debugMode: { value: 0, min: 0, max: 2, private: true }
|
|
340
|
+
},
|
|
341
|
+
passes: [{ sampler: true }]
|
|
342
|
+
};
|
|
343
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
344
|
+
0 && (module.exports = {
|
|
345
|
+
contactShadowBilateralBlur,
|
|
346
|
+
contactShadowComposite,
|
|
347
|
+
contactShadowTrace
|
|
348
|
+
});
|