Parameters
| Name | Type | Description |
|---|---|---|
| signedDistance | f32 | Signed distance field value. |
| thickness | f32 | Stroke thickness. |
| center | f32 | Center distance for the stroke. |
| smoothing | f32 | Smoothing factor for anti-aliasing. |
Returns
f32stroke value between 0.0 and 1.0.
WGSL Code
fn sdfToSmoothStroke(signedDistance: f32, thickness: f32, center: f32, smoothing: f32) -> f32 {let distance = abs(signedDistance - center);return 1.0 - smoothstep(thickness * 0.5 - smoothing, thickness * 0.5 + smoothing, distance);}