jeudi 28 novembre 2013

A Fast Voronoi Diagram Sampler

Just a simple shader that shows how is it possible to render a Voronoi diagram quite easily. The trick is that we store control points in a grid. For a given pixel, I just need to test 9 points to find the closest one. This avoids a lot of computations. To see the underlying structure //#define DEBUG should be uncommented in the shader code.

 

This sampler can be used in an other shader code. Here we use it in a cube sampler which is used to render a pseudo voronoi skybox .

 

Aucun commentaire:

Enregistrer un commentaire