Crafter.Graphics/examples/HDRBloom/miss.wgsl

10 lines
453 B
WebGPU Shading Language

//SPDX-License-Identifier: MIT
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
// HDRBloom miss (runs in SHADE). Dark, sub-threshold background so the
// bloom pass only picks up the bright cubes, not the sky.
fn miss_main(ray: RayDesc, payload: ptr<function, Payload>) {
let t = clamp(ray.direction.y * 0.5 + 0.5, 0.0, 1.0);
rtAccumulate(mix(vec3<f32>(0.015, 0.018, 0.030),
vec3<f32>(0.030, 0.040, 0.070), t));
}