/** * Procedural sky shader — fullscreen triangle with atmospheric gradient + sun disc. * Writes z = 1.0 (far plane) so all geometry draws on top. */ export declare const SKY_SHADER = "\nstruct SkyUniforms {\n invVP: mat4x4,\n sunDir: vec4,\n zenithColor: vec4,\n horizonColor: vec4,\n groundColor: vec4,\n params: vec4, // x = sunIntensity, y = groundFalloff\n};\n\n@group(0) @binding(0) var sky: SkyUniforms;\n\nstruct VertexOutput {\n @builtin(position) position: vec4,\n @location(0) ndc: vec2,\n};\n\nvar pos: array, 3> = array(\n vec2(-1.0, -1.0),\n vec2( 3.0, -1.0),\n vec2(-1.0, 3.0),\n);\n\n@vertex\nfn vs(@builtin(vertex_index) i: u32) -> VertexOutput {\n var out: VertexOutput;\n let p = pos[i];\n out.position = vec4(p, 1.0, 1.0); // z = 1.0 \u2192 far plane\n out.ndc = p;\n return out;\n}\n\n@fragment\nfn fs(input: VertexOutput) -> @location(0) vec4 {\n // Reconstruct world-space ray direction from NDC\n let clipNear = vec4(input.ndc, 0.0, 1.0);\n let clipFar = vec4(input.ndc, 1.0, 1.0);\n let worldNear = sky.invVP * clipNear;\n let worldFar = sky.invVP * clipFar;\n let near3 = worldNear.xyz / worldNear.w;\n let far3 = worldFar.xyz / worldFar.w;\n let dir = normalize(far3 - near3);\n\n // Atmospheric gradient: blend zenith \u2192 horizon based on elevation\n let up = vec3(0.0, 1.0, 0.0);\n let elevation = dot(dir, up);\n let t = clamp(elevation, 0.0, 1.0);\n let gradient = mix(sky.horizonColor.rgb, sky.zenithColor.rgb, sqrt(t));\n\n // Below horizon: fade quickly to ground color\n let falloff = sky.params.y;\n let belowT = clamp(-elevation * falloff, 0.0, 1.0);\n let skyColor = mix(gradient, sky.groundColor.rgb, belowT * belowT);\n\n // Sun disc + glow\n let sunDir = normalize(sky.sunDir.xyz);\n let cosAngle = dot(dir, sunDir);\n let sunIntensity = sky.params.x;\n\n // Sharp sun disc (angular radius ~0.5 degrees = cos(0.00873) \u2248 0.99996)\n let discMask = smoothstep(0.9997, 0.9999, cosAngle);\n let sunDisc = discMask * sunIntensity * 20.0;\n\n // Soft glow around sun\n let glow = pow(max(cosAngle, 0.0), 256.0) * sunIntensity * 4.0;\n let outerGlow = pow(max(cosAngle, 0.0), 32.0) * sunIntensity * 0.3;\n\n let sunColor = vec3(1.0, 0.95, 0.85);\n let finalColor = skyColor + sunColor * (sunDisc + glow + outerGlow);\n\n return vec4(finalColor, 1.0);\n}\n"; /** Size of the SkyUniforms buffer in bytes (mat4 + 5×vec4 = 16+4+4+4+4+4 = 36 floats = 144). */ export declare const SKY_UNIFORM_SIZE = 144; //# sourceMappingURL=sky-shader.d.ts.map