|

Fills

On this page, we explore ways to close a drawn gesture into a region that can be filled.

The two methods below turn an open path into a closed region. The region is represented as a signed distance field in the fragment shader, allowing a fill to push the boundary, texture the interior, or shade it as a surface without adding geometry. Unlike the analytic primitives a distance field is usually built from (a circle, a box), here the exact drawn contour is passed to the shader, which measures the distance to that polygon.

Blob drawing

open full size ↗

This demo creates a closed path that encloses the entire drawn gesture. It finds the smallest convex region containing all drawn points, then smooths and fills it.

Tight blob

open full size ↗

The convex hull method fills in every concavity, which can turn a crescent into a solid lump. This demo's method closes the drawn path into a smooth loop, then defines the shape as the region within a chosen radius of that loop.