Triangle Pattern GLSL Shader

Is there any simple algorithm like the Voronoi diagram to divide any rectangular plane into triangles, ultimately using # predefined points.

Honestly, I need to write a very simple fragment shader, like this .

Theoretically, this Voronoi shader can be β€œmodernized” by Delaunay triangulation, but I want to find a more elegant solution.

+5
source share
2 answers

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

I see it something like this:

cylinder

Thus, neighboring points must be connected to each other. The formation of tetrahedrons filling the volume of the cylinder. Therefore, create a single grid of the tetrahedron and add random noise to the position of the points (with a specific seed).

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

Since the 4D simplex is also a tetrahedron. The only difference is that you are in 3D and cut with a 3D plane.

+1
source

You can reverse engineer this shadertoy.com/view/MdfBzl example like me. Thanks mattz .

0
source

Source: https://habr.com/ru/post/1270344/


All Articles