Open HugoPeters1024 opened 1 year ago
Hey! I just was directed to this. But I have a very hard time where you are actually creating the Voronoi diagram? in void main () you start finding distances. But what happens next?
@SamHatami Hey! I just was directed to this. But I have a very hard time where you are actually creating the Voronoi diagram? in void main () you start finding distances. But what happens next?
Hi Sam! Thanks for reading :). In the void main of the fragment shader I find the distances to each point, and keep track of the smallest distance (min_dis), as well as the index of that point (min_id). After the loop we know which point this fragment (pixel) associates with. By using a deterministic function to map this min_id to a color value, each pixel that associates with that same point gets the same color. This forms the voronoi diagram.
Does that clear things up? Feel free to follow up if something is still unclear.
Hey, thanks for the quick reply!
No unfortunately not. I'm quite new at computational geometry, and actually don't know anything about shader programming. I'm trying to understand the generation of Voronoi diagrams using either delaunay or Fortunes algorithms. I've probably taken water over my head. But I'll keep digging and trying until I manage something.
Again, Thanks!
Can you show some result pictures on this page ? Would brighten it up and make the code more accessible :-)
@FredGannett Can you show some result pictures on this page ? Would brighten it up and make the code more accessible :-)
If your browser supports WebGL2 then the program is actually running right there at the start of the post!
https://hugopeters.me/posts/19/