fn sdfTriangularPrism(position: vec3<f32>, radius: f32, height: f32) -> f32 {
var q = abs(position);
// Triangle distance in xy-plane
let k = sqrt(3.0);
q.x = abs(q.x - q.y * k * 0.5);
q.y = q.y * 0.866025404 + q.x * 0.5;
// Combine with z distance
let d1 = vec2<f32>(q.x - radius, q.y);
let d2 = vec2<f32>(q.y - radius, q.x);
let d = min(d1, d2);
// Account for height
let h = height * 0.5;
let dz = q.z - h;
let dz2 = max(dz, 0.0);
return length(max(vec2<f32>(max(d.x, 0.0), dz2), vec2<f32>(0.0))) + min(max(d.x, dz), 0.0);
}