This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How far points in grid cells can go from the center of the grid cell. Setting this to a value above 0.5 will make the noise discontinuous, and there will be visible seams. | |
// It is reccomended to leave this at 0.3. | |
const float CLOVER_NOISE_2D_POINT_SPREAD = .3; | |
// The value of pi. Used in the offset function. | |
const float CLOVER_NOISE_2D_PI = radians(180.); | |
// Hashes a 2D vector into a point. It isn't 100% random, but it's good enough for clover noise to appear random. | |
float clover_noise_2d_hash(vec2 p) { | |
return fract(1e4 * sin(17.0 * p.x + p.y * 0.1) * (0.1 + abs(sin(p.y * 13.0 + p.x)))); |