14 lines
375 B
GLSL
14 lines
375 B
GLSL
#pragma import phraseHash21
|
|
|
|
float valueNoise21(vec2 x) {
|
|
vec2 i = floor(x);
|
|
vec2 f = fract(x);
|
|
|
|
float a = hash21(i);
|
|
float b = hash21(i + vec2(1.0, 0.0));
|
|
float c = hash21(i + vec2(0.0, 1.0));
|
|
float d = hash21(i + vec2(1.0, 1.0));
|
|
|
|
vec2 u = f * f * (3.0 - 2.0 * f);
|
|
return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
|
|
} |