Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangle pattern GLSL shader

Is there any simple algorithm like Voronoi diagram to divide any rectangular plane to triangles, eventually, using # of pre-defined points.

To be honest, I have to write a very simple fragment shader like this.

Theoretically, this Voronoii shader could be 'upgraded' by Delaunay triangulation but wanna find the more elegant solution.

like image 473
VVK Avatar asked Nov 08 '22 19:11

VVK


1 Answers

The first thing that comes to my mind is to create n random points (with specific seed) to fill a cylinder volume. The triangle points will be intersection of lines between those points and plane going through the axis of cylinder. The animation would be simply done by rotating the plane ...

I see it something like this:

cylinder

So the neighboring points should be interconnected with each other. Forming tetrahedrons that fills the volume of the cylinder. So create uniform tetrahedron grid and add random noise to the points position (with specific seed).

This whole task is very similar to rendering cross section of 4D mesh see:

  • 4D rendering techniques

As the 4D simplex is also tetrahedron. The only diference is you are in 3D and cutting by 3D plane.

like image 92
Spektre Avatar answered Nov 25 '22 22:11

Spektre