1
0
mirror of https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git synced 2025-09-20 04:15:58 +08:00

Pseudo random noise node added

This commit is contained in:
Digvijaysinh Gohil
2023-12-24 20:47:18 +05:30
parent 8b1f8d246e
commit db2384c5df
5 changed files with 63 additions and 8 deletions

View File

@ -7,12 +7,12 @@ float value_noise(vec2 uv){
vec2 _fraction = fract(uv);
_fraction = _fraction * _fraction * (3.0 - 2.0 * _fraction);
vec2 _corner = vec2(1.0, 0.0);
float _c0 = noise_random_value(_floor + _corner.yy);
float _c1 = noise_random_value(_floor + _corner.xy);
float _c2 = noise_random_value(_floor + _corner.yx);
float _c3 = noise_random_value(_floor + _corner.xx);
vec2 _blur = smoothstep(0.0, 1.0, _fraction);
float mix_one = mix(_c0, _c1, _blur.x) + (_c2 - _c0) * _blur.y * (1.0 - _blur.x) + (_c3 - _c1) * _blur.x * _blur.y;
return mix_one;
@ -22,7 +22,7 @@ float simple_noise(vec2 uv, float scale){
int octaves = 6;
float amplitude = 0.25;
float value = 0.0;
for(int i = 0; i < octaves; i++) {
value += amplitude * value_noise(scale * uv);
amplitude *= 0.85;