@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.
Files changed (89) hide show
  1. package/dist/dist.dev.js +1776 -58
  2. package/dist/dist.min.js +1394 -147
  3. package/dist/index.cjs +35 -0
  4. package/dist/index.cjs.map +3 -3
  5. package/dist/index.d.ts +17 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +9 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.cjs +40 -0
  10. package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts +6 -0
  11. package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts.map +1 -0
  12. package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js +15 -0
  13. package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js.map +1 -0
  14. package/dist/modules/lighting/contact-shadow/contact-shadow.cjs +348 -0
  15. package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts +188 -0
  16. package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts.map +1 -0
  17. package/dist/modules/lighting/contact-shadow/contact-shadow.js +307 -0
  18. package/dist/modules/lighting/contact-shadow/contact-shadow.js.map +1 -0
  19. package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.cjs +87 -0
  20. package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts +21 -0
  21. package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts.map +1 -0
  22. package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js +61 -0
  23. package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js.map +1 -0
  24. package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.cjs +87 -0
  25. package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts +21 -0
  26. package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts.map +1 -0
  27. package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js +61 -0
  28. package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js.map +1 -0
  29. package/dist/modules/lighting/pbr-material/pbr-material-glsl.cjs +33 -11
  30. package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts +2 -2
  31. package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts.map +1 -1
  32. package/dist/modules/lighting/pbr-material/pbr-material-glsl.js +33 -11
  33. package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -1
  34. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +33 -11
  35. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts +1 -1
  36. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts.map +1 -1
  37. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js +33 -11
  38. package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js.map +1 -1
  39. package/dist/modules/lighting/pbr-material/pbr-material.d.ts +3 -3
  40. package/dist/modules/lighting/pbr-shadow/pbr-shadow.cjs +97 -0
  41. package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts +15 -0
  42. package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts.map +1 -0
  43. package/dist/modules/lighting/pbr-shadow/pbr-shadow.js +69 -0
  44. package/dist/modules/lighting/pbr-shadow/pbr-shadow.js.map +1 -0
  45. package/dist/modules/lighting/pbr-surface/pbr-surface.cjs +114 -0
  46. package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts +15 -0
  47. package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts.map +1 -0
  48. package/dist/modules/lighting/pbr-surface/pbr-surface.js +88 -0
  49. package/dist/modules/lighting/pbr-surface/pbr-surface.js.map +1 -0
  50. package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.cjs +379 -0
  51. package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts +41 -0
  52. package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts.map +1 -0
  53. package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js +345 -0
  54. package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js.map +1 -0
  55. package/dist/modules/lighting/shadow/shadow-glsl.cjs +228 -0
  56. package/dist/modules/lighting/shadow/shadow-glsl.d.ts +3 -0
  57. package/dist/modules/lighting/shadow/shadow-glsl.d.ts.map +1 -0
  58. package/dist/modules/lighting/shadow/shadow-glsl.js +204 -0
  59. package/dist/modules/lighting/shadow/shadow-glsl.js.map +1 -0
  60. package/dist/modules/lighting/shadow/shadow-types.cjs +15 -0
  61. package/dist/modules/lighting/shadow/shadow-types.d.ts +63 -0
  62. package/dist/modules/lighting/shadow/shadow-types.d.ts.map +1 -0
  63. package/dist/modules/lighting/shadow/shadow-types.js +5 -0
  64. package/dist/modules/lighting/shadow/shadow-types.js.map +1 -0
  65. package/dist/modules/lighting/shadow/shadow.cjs +458 -0
  66. package/dist/modules/lighting/shadow/shadow.d.ts +117 -0
  67. package/dist/modules/lighting/shadow/shadow.d.ts.map +1 -0
  68. package/dist/modules/lighting/shadow/shadow.js +450 -0
  69. package/dist/modules/lighting/shadow/shadow.js.map +1 -0
  70. package/dist/modules/lighting/unlit-material/unlit-material.cjs +60 -0
  71. package/dist/modules/lighting/unlit-material/unlit-material.d.ts +9 -0
  72. package/dist/modules/lighting/unlit-material/unlit-material.d.ts.map +1 -0
  73. package/dist/modules/lighting/unlit-material/unlit-material.js +40 -0
  74. package/dist/modules/lighting/unlit-material/unlit-material.js.map +1 -0
  75. package/package.json +3 -3
  76. package/src/index.ts +48 -0
  77. package/src/modules/lighting/clustered-light-grid/clustered-light-grid.ts +17 -0
  78. package/src/modules/lighting/contact-shadow/contact-shadow.ts +365 -0
  79. package/src/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.ts +78 -0
  80. package/src/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.ts +78 -0
  81. package/src/modules/lighting/pbr-material/pbr-material-glsl.ts +33 -11
  82. package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +33 -11
  83. package/src/modules/lighting/pbr-shadow/pbr-shadow.ts +85 -0
  84. package/src/modules/lighting/pbr-surface/pbr-surface.ts +103 -0
  85. package/src/modules/lighting/prefiltered-environment/prefiltered-environment.ts +370 -0
  86. package/src/modules/lighting/shadow/shadow-glsl.ts +204 -0
  87. package/src/modules/lighting/shadow/shadow-types.ts +68 -0
  88. package/src/modules/lighting/shadow/shadow.ts +536 -0
  89. package/src/modules/lighting/unlit-material/unlit-material.ts +44 -0
@@ -0,0 +1,204 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /** WebGL2 sampling uses raw depth arrays and explicit comparisons; cube arrays are face arrays. */
5
+ export const SHADOW_GLSL = /* glsl */ `
6
+ precision highp sampler2DArray;
7
+ struct DirectionalShadowLightUniform {
8
+ vec3 direction;
9
+ float strength;
10
+ float normalBias;
11
+ float sourceAngularRadius;
12
+ float cascadeBlendFraction;
13
+ float farFadeFraction;
14
+ float shadowDistance;
15
+ };
16
+ struct SpotShadowLightUniform {
17
+ vec3 position;
18
+ float range;
19
+ vec3 direction;
20
+ float outerConeCos;
21
+ float sourceRadius;
22
+ float normalBias;
23
+ float strength;
24
+ float nearPlane;
25
+ };
26
+ struct PointShadowLightUniform {
27
+ vec3 position;
28
+ float range;
29
+ float sourceRadius;
30
+ float normalBias;
31
+ float strength;
32
+ float nearPlane;
33
+ };
34
+ layout(std140) uniform shadowUniforms {
35
+ int directionalLightCount;
36
+ int spotLightCount;
37
+ int pointLightCount;
38
+ int cascadeCount;
39
+ int blockerSampleCount;
40
+ int filterSampleCount;
41
+ vec4 cascadeSplits;
42
+ mat4 directionalViewProjectionMatrices[4];
43
+ mat4 spotViewProjectionMatrices[4];
44
+ mat4 pointViewProjectionMatrices[24];
45
+ DirectionalShadowLightUniform directionalLights[1];
46
+ SpotShadowLightUniform spotLights[4];
47
+ PointShadowLightUniform pointLights[4];
48
+ } shadow;
49
+ uniform sampler2DArray directionalShadowTexture;
50
+ uniform sampler2DArray spotShadowTexture;
51
+ uniform sampler2DArray pointShadowTexture;
52
+ const float SHADOW_PI = 3.141592653589793;
53
+ float shadow_hash(vec3 position) {
54
+ return fract(sin(dot(position, vec3(12.9898, 78.233, 37.719))) * 43758.5453);
55
+ }
56
+ vec2 shadow_diskSample(int index, int count, float rotation) {
57
+ float fraction = (float(index) + 0.5) / max(float(count), 1.0);
58
+ float angle = float(index) * 2.39996323 + rotation;
59
+ return sqrt(fraction) * vec2(cos(angle), sin(angle));
60
+ }
61
+ vec3 shadow_project(mat4 matrix, vec3 worldPosition) {
62
+ vec4 clip = matrix * vec4(worldPosition, 1.0);
63
+ vec3 projected = clip.xyz / max(abs(clip.w), 0.00001);
64
+ // Shared matrices retain [0,1] depth; WebGL texture rows start at the bottom.
65
+ return vec3(projected.xy * 0.5 + 0.5, projected.z);
66
+ }
67
+ bool shadow_validProjection(vec3 projected) {
68
+ return all(greaterThanEqual(projected, vec3(0.0))) && all(lessThanEqual(projected, vec3(1.0)));
69
+ }
70
+ // Bilinear interpolation of four depth comparisons matches a hardware 2x2 PCF lookup.
71
+ float shadow_compare(sampler2DArray shadowMap, vec2 coordinate, int layer, float reference) {
72
+ ivec2 dimensions = textureSize(shadowMap, 0).xy;
73
+ vec2 position = coordinate * vec2(dimensions) - 0.5;
74
+ ivec2 base = ivec2(floor(position));
75
+ vec2 fraction = fract(position);
76
+ ivec2 maximum = dimensions - 1;
77
+ float lowerLeft = step(reference, texelFetch(shadowMap, ivec3(clamp(base, ivec2(0), maximum), layer), 0).r);
78
+ float lowerRight = step(reference, texelFetch(shadowMap, ivec3(clamp(base + ivec2(1,0), ivec2(0), maximum), layer), 0).r);
79
+ float upperLeft = step(reference, texelFetch(shadowMap, ivec3(clamp(base + ivec2(0,1), ivec2(0), maximum), layer), 0).r);
80
+ float upperRight = step(reference, texelFetch(shadowMap, ivec3(clamp(base + ivec2(1,1), ivec2(0), maximum), layer), 0).r);
81
+ return mix(mix(lowerLeft, lowerRight, fraction.x), mix(upperLeft, upperRight, fraction.x), fraction.y);
82
+ }
83
+ float shadow_arrayPCSS(sampler2DArray shadowMap, int layer, vec3 projected, float searchRadius, float rotation, float penumbraScale) {
84
+ if (!shadow_validProjection(projected)) return 1.0;
85
+ float texel = 1.0 / float(textureSize(shadowMap, 0).x);
86
+ searchRadius = max(texel, searchRadius);
87
+ float blockerDepth = 0.0;
88
+ float blockerCount = 0.0;
89
+ for (int index = 0; index < 24; index++) {
90
+ if (index >= shadow.blockerSampleCount) break;
91
+ vec2 coordinate = clamp(projected.xy + shadow_diskSample(index, shadow.blockerSampleCount, rotation) * searchRadius, vec2(0.0), vec2(1.0));
92
+ float depth = textureLod(shadowMap, vec3(coordinate, float(layer)), 0.0).r;
93
+ if (depth < projected.z) { blockerDepth += depth; blockerCount += 1.0; }
94
+ }
95
+ if (blockerCount == 0.0) return 1.0;
96
+ float averageBlocker = blockerDepth / blockerCount;
97
+ float penumbra = clamp((projected.z - averageBlocker) / max(abs(averageBlocker), 0.001), 0.0, 1.0);
98
+ float radius = max(texel, searchRadius * (1.0 + penumbra * penumbraScale));
99
+ float visibility = 0.0;
100
+ for (int index = 0; index < 48; index++) {
101
+ if (index >= shadow.filterSampleCount) break;
102
+ vec2 coordinate = clamp(projected.xy + shadow_diskSample(index, shadow.filterSampleCount, rotation) * radius, vec2(0.0), vec2(1.0));
103
+ visibility += shadow_compare(shadowMap, coordinate, layer, projected.z);
104
+ }
105
+ return visibility / max(float(shadow.filterSampleCount), 1.0);
106
+ }
107
+ int shadow_directionalCascadeIndex(float viewDepth) {
108
+ int cascadeIndex = 0;
109
+ for (int index = 0; index < 4; index++) {
110
+ if (index >= shadow.cascadeCount) break;
111
+ cascadeIndex = index;
112
+ if (viewDepth <= shadow.cascadeSplits[index]) break;
113
+ }
114
+ return cascadeIndex;
115
+ }
116
+ int shadow_getDirectionalCascadeIndex(float viewDepth) {
117
+ return shadow.directionalLightCount == 0 ? -1 : shadow_directionalCascadeIndex(viewDepth);
118
+ }
119
+ float shadow_directionalPCSS(int cascadeIndex, vec3 worldPosition, float viewDepth) {
120
+ DirectionalShadowLightUniform light = shadow.directionalLights[0];
121
+ return shadow_arrayPCSS(directionalShadowTexture, cascadeIndex,
122
+ shadow_project(shadow.directionalViewProjectionMatrices[cascadeIndex], worldPosition),
123
+ light.sourceAngularRadius * viewDepth / max(light.shadowDistance, 0.001),
124
+ shadow_hash(worldPosition) * 2.0 * SHADOW_PI, 18.0);
125
+ }
126
+ float shadow_getDirectionalFactor(vec3 worldPosition, vec3 worldNormal, float viewDepth) {
127
+ if (shadow.directionalLightCount == 0 || viewDepth <= 0.0) return 1.0;
128
+ DirectionalShadowLightUniform light = shadow.directionalLights[0];
129
+ if (viewDepth >= light.shadowDistance) return 1.0;
130
+ vec3 position = worldPosition + normalize(worldNormal) * light.normalBias;
131
+ int cascadeIndex = shadow_directionalCascadeIndex(viewDepth);
132
+ float visibility = shadow_directionalPCSS(cascadeIndex, position, viewDepth);
133
+ if (cascadeIndex + 1 < shadow.cascadeCount) {
134
+ float cascadeStart = cascadeIndex > 0 ? shadow.cascadeSplits[cascadeIndex - 1] : 0.0;
135
+ float cascadeEnd = shadow.cascadeSplits[cascadeIndex];
136
+ float blendWidth = max((cascadeEnd - cascadeStart) * light.cascadeBlendFraction, 0.0001);
137
+ float blend = smoothstep(cascadeEnd - blendWidth, cascadeEnd, viewDepth);
138
+ if (blend > 0.0) visibility = mix(visibility, shadow_directionalPCSS(cascadeIndex + 1, position, viewDepth), blend);
139
+ }
140
+ float fadeWidth = max(light.shadowDistance * light.farFadeFraction, 0.0001);
141
+ visibility = mix(visibility, 1.0, smoothstep(light.shadowDistance - fadeWidth, light.shadowDistance, viewDepth));
142
+ return mix(1.0, visibility, light.strength);
143
+ }
144
+ float shadow_getSpotFactor(int lightIndex, vec3 worldPosition, vec3 worldNormal) {
145
+ if (lightIndex < 0 || lightIndex >= shadow.spotLightCount) return 1.0;
146
+ SpotShadowLightUniform light = shadow.spotLights[lightIndex];
147
+ vec3 fromLight = worldPosition - light.position;
148
+ float distanceToLight = length(fromLight);
149
+ if (distanceToLight >= light.range || dot(normalize(fromLight), normalize(light.direction)) < light.outerConeCos) return 1.0;
150
+ vec3 position = worldPosition + normalize(worldNormal) * light.normalBias;
151
+ float visibility = shadow_arrayPCSS(spotShadowTexture, lightIndex,
152
+ shadow_project(shadow.spotViewProjectionMatrices[lightIndex], position),
153
+ light.sourceRadius / max(distanceToLight, 0.001) * 0.5,
154
+ shadow_hash(worldPosition) * 2.0 * SHADOW_PI, 16.0);
155
+ return mix(1.0, visibility, light.strength);
156
+ }
157
+ float shadow_pointReferenceDepth(float majorDistance, float nearPlane, float farPlane) {
158
+ return farPlane / (farPlane - nearPlane) - (farPlane * nearPlane) / ((farPlane - nearPlane) * majorDistance);
159
+ }
160
+ vec3 shadow_pointCoordinate(int lightIndex, vec3 direction) {
161
+ vec3 magnitude = abs(direction);
162
+ int face = magnitude.x >= magnitude.y && magnitude.x >= magnitude.z ? (direction.x >= 0.0 ? 0 : 1)
163
+ : magnitude.y >= magnitude.z ? (direction.y >= 0.0 ? 2 : 3) : (direction.z >= 0.0 ? 4 : 5);
164
+ PointShadowLightUniform light = shadow.pointLights[lightIndex];
165
+ vec3 projected = shadow_project(shadow.pointViewProjectionMatrices[lightIndex * 6 + face], light.position + direction * light.range * 0.5);
166
+ return vec3(projected.xy, float(lightIndex * 6 + face));
167
+ }
168
+ float shadow_getPointFactor(int lightIndex, vec3 worldPosition, vec3 worldNormal) {
169
+ if (lightIndex < 0 || lightIndex >= shadow.pointLightCount) return 1.0;
170
+ PointShadowLightUniform light = shadow.pointLights[lightIndex];
171
+ vec3 fromLight = worldPosition + normalize(worldNormal) * light.normalBias - light.position;
172
+ float distanceToLight = length(fromLight);
173
+ if (distanceToLight >= light.range || distanceToLight <= light.nearPlane) return 1.0;
174
+ vec3 direction = normalize(fromLight);
175
+ float referenceDepth = shadow_pointReferenceDepth(max(max(abs(fromLight.x), abs(fromLight.y)), abs(fromLight.z)), light.nearPlane, light.range);
176
+ vec3 reference = abs(direction.y) > 0.99 ? vec3(0,0,1) : vec3(0,1,0);
177
+ vec3 tangent = normalize(cross(direction, reference));
178
+ vec3 bitangent = normalize(cross(direction, tangent));
179
+ float searchRadius = light.sourceRadius / max(distanceToLight, 0.001);
180
+ float rotation = shadow_hash(worldPosition) * 2.0 * SHADOW_PI;
181
+ float blockerDepth = 0.0;
182
+ float blockerCount = 0.0;
183
+ for (int index = 0; index < 24; index++) {
184
+ if (index >= shadow.blockerSampleCount) break;
185
+ vec2 disk = shadow_diskSample(index, shadow.blockerSampleCount, rotation) * searchRadius;
186
+ vec3 coordinate = shadow_pointCoordinate(lightIndex, normalize(direction + tangent * disk.x + bitangent * disk.y));
187
+ float depth = textureLod(pointShadowTexture, coordinate, 0.0).r;
188
+ if (depth < referenceDepth) { blockerDepth += depth; blockerCount += 1.0; }
189
+ }
190
+ if (blockerCount == 0.0) return 1.0;
191
+ float averageBlocker = blockerDepth / blockerCount;
192
+ float penumbra = clamp((referenceDepth - averageBlocker) / max(abs(averageBlocker), 0.001), 0.0, 1.0);
193
+ float radius = searchRadius * (1.0 + penumbra * 12.0);
194
+ float visibility = 0.0;
195
+ for (int index = 0; index < 48; index++) {
196
+ if (index >= shadow.filterSampleCount) break;
197
+ vec2 disk = shadow_diskSample(index, shadow.filterSampleCount, rotation) * radius;
198
+ vec3 coordinate = shadow_pointCoordinate(lightIndex, normalize(direction + tangent * disk.x + bitangent * disk.y));
199
+ visibility += shadow_compare(pointShadowTexture, coordinate.xy, int(coordinate.z), referenceDepth);
200
+ }
201
+ return mix(1.0, visibility / max(float(shadow.filterSampleCount), 1.0), light.strength);
202
+ }
203
+ `;
204
+ //# sourceMappingURL=shadow-glsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-glsl.js","sourceRoot":"","sources":["../../../../src/modules/lighting/shadow/shadow-glsl.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,mGAAmG;AACnG,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsMrC,CAAC"}
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var shadow_types_exports = {};
15
+ module.exports = __toCommonJS(shadow_types_exports);
@@ -0,0 +1,63 @@
1
+ import type { Matrix4, NumberArray3, NumberArray16 } from '@math.gl/core';
2
+ /** Minimal texture metadata used to select backend-specific sampler bindings. */
3
+ export type ShadowTexture = {
4
+ readonly device: {
5
+ readonly type: string;
6
+ };
7
+ };
8
+ export type ShadowBiasProps = {
9
+ /** Receiver displacement along the world-space normal. */
10
+ normalBias?: number;
11
+ /** Constant raster depth bias applied by the caster pipeline. */
12
+ depthBias?: number;
13
+ /** Slope-scaled raster depth bias applied by the caster pipeline. */
14
+ depthBiasSlopeScale?: number;
15
+ /** Fraction of the direct-light contribution affected by the shadow. */
16
+ strength?: number;
17
+ };
18
+ /** Directional light shadow configuration. `direction` points from a surface toward the light. */
19
+ export type DirectionalShadowLight = ShadowBiasProps & {
20
+ direction: Readonly<NumberArray3>;
21
+ shadowDistance?: number;
22
+ casterDistance?: number;
23
+ sourceAngularRadius?: number;
24
+ cascadeSplitLambda?: number;
25
+ cascadeBlendFraction?: number;
26
+ farFadeFraction?: number;
27
+ };
28
+ /** Perspective shadow configuration for a spot light. */
29
+ export type SpotShadowLight = ShadowBiasProps & {
30
+ position: Readonly<NumberArray3>;
31
+ direction: Readonly<NumberArray3>;
32
+ range: number;
33
+ outerConeAngle: number;
34
+ nearPlane?: number;
35
+ sourceRadius?: number;
36
+ };
37
+ /** Cube-array shadow configuration for an omnidirectional point light. */
38
+ export type PointShadowLight = ShadowBiasProps & {
39
+ position: Readonly<NumberArray3>;
40
+ range: number;
41
+ nearPlane?: number;
42
+ sourceRadius?: number;
43
+ };
44
+ /** Fully resolved props returned by the renderer and consumed by the `shadow` shader module. */
45
+ export type ShadowProps<TextureT extends ShadowTexture = ShadowTexture, SamplerT = unknown> = {
46
+ quality: 'low' | 'balanced' | 'cinematic';
47
+ cascadeCount: number;
48
+ cascadeSplits: readonly number[];
49
+ blockerSampleCount: number;
50
+ filterSampleCount: number;
51
+ directionalLights: readonly DirectionalShadowLight[];
52
+ spotLights: readonly SpotShadowLight[];
53
+ pointLights: readonly PointShadowLight[];
54
+ directionalViewProjectionMatrices: readonly Readonly<Matrix4 | NumberArray16>[];
55
+ spotViewProjectionMatrices: readonly Readonly<Matrix4 | NumberArray16>[];
56
+ pointViewProjectionMatrices: readonly Readonly<Matrix4 | NumberArray16>[];
57
+ directionalShadowTexture: TextureT;
58
+ spotShadowTexture: TextureT;
59
+ pointShadowTexture: TextureT;
60
+ comparisonSampler: SamplerT;
61
+ nonFilteringSampler: SamplerT;
62
+ };
63
+ //# sourceMappingURL=shadow-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-types.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/shadow/shadow-types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAExE,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG;IAAC,QAAQ,CAAC,MAAM,EAAE;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG;IAC5B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,kGAAkG;AAClG,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,SAAS,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjC,SAAS,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAC/C,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,gGAAgG;AAChG,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,aAAa,GAAG,aAAa,EAAE,QAAQ,GAAG,OAAO,IAAI;IAC5F,OAAO,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACrD,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;IACvC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACzC,iCAAiC,EAAE,SAAS,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,EAAE,CAAC;IAChF,0BAA0B,EAAE,SAAS,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,EAAE,CAAC;IACzE,2BAA2B,EAAE,SAAS,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,EAAE,CAAC;IAC1E,wBAAwB,EAAE,QAAQ,CAAC;IACnC,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,kBAAkB,EAAE,QAAQ,CAAC;IAC7B,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,mBAAmB,EAAE,QAAQ,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,5 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ export {};
5
+ //# sourceMappingURL=shadow-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-types.js","sourceRoot":"","sources":["../../../../src/modules/lighting/shadow/shadow-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D"}