import type { Texture } from '@luma.gl/core'; export type DepthAwareBlurProps = { direction?: [number, number]; radius?: number; depthSigma?: number; spatialSigma?: number; }; type DepthAwareBlurUniforms = Required; type DepthAwareBlurBindings = { depthTexture?: Texture; }; export declare const depthAwareBlur: { readonly name: "depthAwareBlur"; readonly source: "struct depthAwareBlurUniforms {\n direction: vec2f,\n radius: f32,\n depthSigma: f32,\n spatialSigma: f32,\n};\n\n@group(0) @binding(auto) var depthAwareBlur: depthAwareBlurUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n\nfn depthAwareBlur_sampleColor(\n sourceTexture: texture_2d,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let sourceDimensions = vec2f(textureDimensions(sourceTexture));\n let texel = depthAwareBlur.direction / sourceDimensions;\n let centerDepth = textureSample(depthTexture, depthTextureSampler, texCoord);\n var color = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var totalWeight = 1.0;\n for (var index: i32 = 1; index <= 8; index++) {\n if (f32(index) > depthAwareBlur.radius) { break; }\n let offset = texel * f32(index);\n for (var side: i32 = -1; side <= 1; side += 2) {\n let sampleUv = clamp(texCoord + offset * f32(side), vec2f(0.0), vec2f(1.0));\n let sampleDepth = textureSample(depthTexture, depthTextureSampler, sampleUv);\n let spatialWeight = exp(-f32(index * index) / max(2.0 * depthAwareBlur.spatialSigma * depthAwareBlur.spatialSigma, 0.0001));\n let depthDelta = abs(sampleDepth - centerDepth);\n let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * depthAwareBlur.depthSigma * depthAwareBlur.depthSigma, 0.000001));\n let weight = spatialWeight * depthWeight;\n color += textureSample(sourceTexture, sourceTextureSampler, sampleUv) * weight;\n totalWeight += weight;\n }\n }\n return color / totalWeight;\n}\n"; readonly bindingLayout: readonly [{ readonly name: "depthTexture"; readonly group: 0; }]; readonly props: DepthAwareBlurProps & DepthAwareBlurBindings; readonly uniforms: DepthAwareBlurUniforms; readonly bindings: DepthAwareBlurBindings; readonly uniformTypes: { readonly direction: "vec2"; readonly radius: "f32"; readonly depthSigma: "f32"; readonly spatialSigma: "f32"; }; readonly propTypes: { readonly direction: { readonly value: readonly [1, 0]; }; readonly radius: { readonly value: 4; readonly min: 1; readonly max: 8; }; readonly depthSigma: { readonly value: 0.01; readonly min: 0.0001; readonly softMax: 0.1; }; readonly spatialSigma: { readonly value: 3; readonly min: 0.1; readonly softMax: 8; }; }; readonly passes: [{ readonly sampler: true; }]; }; export declare const depthAwareBlurShaderPassPipeline: { name: string; renderTargets: { depthAwareBlurScratch: {}; }; steps: ({ shaderPass: { readonly name: "depthAwareBlur"; readonly source: "struct depthAwareBlurUniforms {\n direction: vec2f,\n radius: f32,\n depthSigma: f32,\n spatialSigma: f32,\n};\n\n@group(0) @binding(auto) var depthAwareBlur: depthAwareBlurUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n\nfn depthAwareBlur_sampleColor(\n sourceTexture: texture_2d,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let sourceDimensions = vec2f(textureDimensions(sourceTexture));\n let texel = depthAwareBlur.direction / sourceDimensions;\n let centerDepth = textureSample(depthTexture, depthTextureSampler, texCoord);\n var color = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var totalWeight = 1.0;\n for (var index: i32 = 1; index <= 8; index++) {\n if (f32(index) > depthAwareBlur.radius) { break; }\n let offset = texel * f32(index);\n for (var side: i32 = -1; side <= 1; side += 2) {\n let sampleUv = clamp(texCoord + offset * f32(side), vec2f(0.0), vec2f(1.0));\n let sampleDepth = textureSample(depthTexture, depthTextureSampler, sampleUv);\n let spatialWeight = exp(-f32(index * index) / max(2.0 * depthAwareBlur.spatialSigma * depthAwareBlur.spatialSigma, 0.0001));\n let depthDelta = abs(sampleDepth - centerDepth);\n let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * depthAwareBlur.depthSigma * depthAwareBlur.depthSigma, 0.000001));\n let weight = spatialWeight * depthWeight;\n color += textureSample(sourceTexture, sourceTextureSampler, sampleUv) * weight;\n totalWeight += weight;\n }\n }\n return color / totalWeight;\n}\n"; readonly bindingLayout: readonly [{ readonly name: "depthTexture"; readonly group: 0; }]; readonly props: DepthAwareBlurProps & DepthAwareBlurBindings; readonly uniforms: DepthAwareBlurUniforms; readonly bindings: DepthAwareBlurBindings; readonly uniformTypes: { readonly direction: "vec2"; readonly radius: "f32"; readonly depthSigma: "f32"; readonly spatialSigma: "f32"; }; readonly propTypes: { readonly direction: { readonly value: readonly [1, 0]; }; readonly radius: { readonly value: 4; readonly min: 1; readonly max: 8; }; readonly depthSigma: { readonly value: 0.01; readonly min: 0.0001; readonly softMax: 0.1; }; readonly spatialSigma: { readonly value: 3; readonly min: 0.1; readonly softMax: 8; }; }; readonly passes: [{ readonly sampler: true; }]; }; inputs: { sourceTexture: "previous"; }; output: "depthAwareBlurScratch"; uniforms: { direction: [number, number]; }; } | { shaderPass: { readonly name: "depthAwareBlur"; readonly source: "struct depthAwareBlurUniforms {\n direction: vec2f,\n radius: f32,\n depthSigma: f32,\n spatialSigma: f32,\n};\n\n@group(0) @binding(auto) var depthAwareBlur: depthAwareBlurUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n\nfn depthAwareBlur_sampleColor(\n sourceTexture: texture_2d,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let sourceDimensions = vec2f(textureDimensions(sourceTexture));\n let texel = depthAwareBlur.direction / sourceDimensions;\n let centerDepth = textureSample(depthTexture, depthTextureSampler, texCoord);\n var color = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var totalWeight = 1.0;\n for (var index: i32 = 1; index <= 8; index++) {\n if (f32(index) > depthAwareBlur.radius) { break; }\n let offset = texel * f32(index);\n for (var side: i32 = -1; side <= 1; side += 2) {\n let sampleUv = clamp(texCoord + offset * f32(side), vec2f(0.0), vec2f(1.0));\n let sampleDepth = textureSample(depthTexture, depthTextureSampler, sampleUv);\n let spatialWeight = exp(-f32(index * index) / max(2.0 * depthAwareBlur.spatialSigma * depthAwareBlur.spatialSigma, 0.0001));\n let depthDelta = abs(sampleDepth - centerDepth);\n let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * depthAwareBlur.depthSigma * depthAwareBlur.depthSigma, 0.000001));\n let weight = spatialWeight * depthWeight;\n color += textureSample(sourceTexture, sourceTextureSampler, sampleUv) * weight;\n totalWeight += weight;\n }\n }\n return color / totalWeight;\n}\n"; readonly bindingLayout: readonly [{ readonly name: "depthTexture"; readonly group: 0; }]; readonly props: DepthAwareBlurProps & DepthAwareBlurBindings; readonly uniforms: DepthAwareBlurUniforms; readonly bindings: DepthAwareBlurBindings; readonly uniformTypes: { readonly direction: "vec2"; readonly radius: "f32"; readonly depthSigma: "f32"; readonly spatialSigma: "f32"; }; readonly propTypes: { readonly direction: { readonly value: readonly [1, 0]; }; readonly radius: { readonly value: 4; readonly min: 1; readonly max: 8; }; readonly depthSigma: { readonly value: 0.01; readonly min: 0.0001; readonly softMax: 0.1; }; readonly spatialSigma: { readonly value: 3; readonly min: 0.1; readonly softMax: 8; }; }; readonly passes: [{ readonly sampler: true; }]; }; inputs: { sourceTexture: "depthAwareBlurScratch"; }; output: "previous"; uniforms: { direction: [number, number]; }; })[]; }; export {}; //# sourceMappingURL=depth-aware-blur.d.ts.map