Parameters
Name | Type | Description |
---|---|---|
n | vec2<f32> | Input 2D coordinate. |
Returns
Dependencies
WGSL Code
//! requires rand22Sin smoothStepVec2fn noise2(n: vec2f) -> f32 {let d = vec2f(0., 1.);let b = floor(n);let f = smoothStepVec2(vec2f(0.), vec2f(1.), fract(n));return mix(mix(rand22(b), rand22(b + d.yx), f.x), mix(rand22(b + d.xy), rand22(b + d.yy), f.x), f.y);}