3 ms·
well, if you're doing that, then just use the distance function, at least you've got a perfectly circular cone, and you don't get tricked by the maximum distanc
by nraynaud 11y ago
well, if you're doing that, then just use the distance function, at least you've got a perfectly circular cone, and you don't get tricked by the maximum distance of the cone.
the complexity is num pixels*num entities.
implementation here: https://github.com/nraynaud/webgcode/blob/gh-pages/webapp/shaders/distance.frag https://github.com/nraynaud/webgcode/blob/gh-pages/webapp/sh...
I would gladly show the result here: http://nraynaud.github.io/webgcode/various_tests/test_voronoi.html http://nraynaud.github.io/webgcode/various_tests/test_vorono... but it looks like Chrome removed PathSegList that the SVG library was using internally
edit: it still works in firefox, it extracts the voronoi diagram, the medial axis, then does a subtraction on the medial axis (internal offset of the original polygon), then a minimum threshold (mickey ears for pocketting in milling), then a reconstruction of the polygon from the altered medial axis.
- exDM69 11y agoYour pixel shader implementation is quite clean and simple. But the method I described doesn't rely on shaders at all, it uses the fixed function triangle rasterization and depth testing. It has different performance characteristics. That method is also of historical interest because it works (and is fast) also on pre-shader graphics accelerators.