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

10 lines
No EOL
250 B
WebGPU Shading Language

/*
contributors: Inigo Quiles
description: generate the SDF of a cylinder
*/
fn cylinderSDF(p: vec3f, h: vec2f) -> f32 {
let d = abs(vec2f(length(p.xz),p.y)) - h;
return min(max(d.x,d.y),0.0) + length(vec2f(max(d.x, 0.0), max(d.y, 0.0)));
}