Parameters
Name | Type | Description |
---|---|---|
distanceA | f32 | First signed distance field. |
distanceB | f32 | Second signed distance field to subtract. |
smoothing | f32 | Smoothing factor for the blend. |
Returns
f32subtracted signed distance field.
WGSL Code
fn sdfSmoothSubtract(distanceA: f32, distanceB: f32, smoothing: f32) -> f32 {let h = clamp(0.5 - 0.5 * (distanceB + distanceA) / smoothing, 0.0, 1.0);return mix(distanceA, -distanceB, h) + smoothing * h * (1.0 - h);}