fuckingtech/public/assets/glsl/lygia/math/aastep.wgsl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

9 lines
No EOL
357 B
WebGPU Shading Language

/*
contributors: Matt DesLauriers
description: Performs a smoothstep using standard derivatives for anti-aliased edges at any level of magnification. From https://github.com/glslify/glsl-aastep
*/
fn aastep(threshold: f32, value: f32) -> f32 {
let afwidth = 0.7 * fwidth(value);
return smoothstep(threshold - afwidth, threshold + afwidth, value);
}