import type { ShaderPassPipeline } from '@luma.gl/shadertools'; export type OutlineShaderPassPipelineOptions = { normalSource?: 'reconstruct-from-depth' | 'normal-texture'; }; type OutlineUniforms = { color: [number, number, number, number]; thickness: number; depthThreshold: number; normalThreshold: number; useNormalTexture: number; }; export declare const outlinePass: { readonly name: "screenSpaceOutline"; readonly source: "struct screenSpaceOutlineUniforms {\n color: vec4f,\n thickness: f32,\n depthThreshold: f32,\n normalThreshold: f32,\n useNormalTexture: f32,\n};\n@group(0) @binding(auto) var screenSpaceOutline: screenSpaceOutlineUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n@group(0) @binding(auto) var normalTexture: texture_2d;\n@group(0) @binding(auto) var normalTextureSampler: sampler;\nfn advancedSceneUV(uv: vec2f) -> vec2f {\n return uv;\n}\n\nfn advancedLinearDepth(depth: f32, nearPlane: f32, farPlane: f32) -> f32 {\n return (nearPlane * farPlane) / max(farPlane - depth * (farPlane - nearPlane), 0.0001);\n}\n\nfn advancedDepthNormal(depthTexture: texture_depth_2d, depthTextureSampler: sampler, uv: vec2f) -> vec3f {\n let dimensions = vec2i(textureDimensions(depthTexture));\n let coordinate = clamp(vec2i(uv * vec2f(dimensions)), vec2i(0), dimensions - vec2i(1));\n let center = textureLoad(depthTexture, coordinate, 0);\n let right = textureLoad(depthTexture, min(coordinate + vec2i(1, 0), dimensions - vec2i(1)), 0);\n let up = textureLoad(depthTexture, min(coordinate + vec2i(0, 1), dimensions - vec2i(1)), 0);\n return normalize(vec3f((center - right) * f32(dimensions.x), (center - up) * f32(dimensions.y), 1.0));\n}\n\nfn screenSpaceOutline_sampleColor(\n sourceTexture: texture_2d, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let texel = screenSpaceOutline.thickness / vec2f(textureDimensions(depthTexture));\n let centerSceneUv = advancedSceneUV(texCoord);\n let centerDepth = textureSample(depthTexture, depthTextureSampler, centerSceneUv);\n let centerReconstructed = advancedDepthNormal(depthTexture, depthTextureSampler, centerSceneUv);\n let centerTextureNormal = normalize(textureSample(normalTexture, normalTextureSampler, centerSceneUv).xyz * 2.0 - 1.0);\n let centerNormal = normalize(mix(centerReconstructed, centerTextureNormal, screenSpaceOutline.useNormalTexture));\n var depthEdge = 0.0;\n var normalEdge = 0.0;\n let offsets = array(vec2f(texel.x, 0.0), vec2f(-texel.x, 0.0), vec2f(0.0, texel.y), vec2f(0.0, -texel.y));\n for (var index: i32 = 0; index < 4; index++) {\n let sampleUv = clamp(texCoord + offsets[index], vec2f(0.0), vec2f(1.0));\n let sampleSceneUv = advancedSceneUV(sampleUv);\n let sampleDepth = textureSample(depthTexture, depthTextureSampler, sampleSceneUv);\n depthEdge = max(depthEdge, abs(sampleDepth - centerDepth));\n let reconstructed = advancedDepthNormal(depthTexture, depthTextureSampler, sampleSceneUv);\n let textureNormal = normalize(textureSample(normalTexture, normalTextureSampler, sampleSceneUv).xyz * 2.0 - 1.0);\n let sampleNormal = normalize(mix(reconstructed, textureNormal, screenSpaceOutline.useNormalTexture));\n normalEdge = max(normalEdge, 1.0 - max(dot(centerNormal, sampleNormal), 0.0));\n }\n let edge = max(smoothstep(screenSpaceOutline.depthThreshold, screenSpaceOutline.depthThreshold * 2.0, depthEdge),\n smoothstep(screenSpaceOutline.normalThreshold, screenSpaceOutline.normalThreshold * 2.0, normalEdge));\n let sourceColor = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n return mix(sourceColor, screenSpaceOutline.color, edge * screenSpaceOutline.color.a);\n}"; readonly bindingLayout: readonly [{ readonly name: "depthTexture"; readonly group: 0; }, { readonly name: "normalTexture"; readonly group: 0; }]; readonly uniforms: OutlineUniforms; readonly uniformTypes: { readonly color: "vec4"; readonly thickness: "f32"; readonly depthThreshold: "f32"; readonly normalThreshold: "f32"; readonly useNormalTexture: "f32"; }; readonly propTypes: { readonly color: { readonly value: readonly [0.02, 0.08, 0.12, 0.48]; }; readonly thickness: { readonly value: 1.5; readonly min: 0.5; readonly softMax: 5; }; readonly depthThreshold: { readonly value: 0.003; readonly min: 0.0001; readonly softMax: 0.05; }; readonly normalThreshold: { readonly value: 0.18; readonly min: 0.01; readonly softMax: 1; }; readonly useNormalTexture: { readonly value: 0; readonly min: 0; readonly max: 1; readonly private: true; }; }; readonly passes: [{ readonly sampler: true; }]; }; export declare function createOutlineShaderPassPipeline(options?: OutlineShaderPassPipelineOptions): ShaderPassPipeline; export {}; //# sourceMappingURL=outlines.d.ts.map