Distance function visualized through a gyroid volume. Solid red and blue are uncalculated inside/outside areas. Gradients are distance from the surface. Otherwise I thought it just made a cool animation.
This forms the core of applying surface effects at a specific distance. You could hollow a model > some distance from the surface or you could apply a pattern up to some distance on the surface to make it more interesting. Check out DistanceTransformExact.java for the code. We’re working on more optimized versions as well but this class forms the basis for unit testing other approximations. When we get the library level done then we’ll expose this at ShapeJS.