Parameters
Name | Type | Description |
---|---|---|
p | vec2<f32> | Input 2D coordinate. |
Returns
Dependencies
WGSL Code
//! requires hash22fn noise2D(p: vec2<f32>) -> f32 {let i = floor(p);let f = fract(p);let u = f * f * (3.0 - 2.0 * f);return mix(mix(dot(hash22(i + vec2<f32>(0.0, 0.0)), f - vec2<f32>(0.0, 0.0)),dot(hash22(i + vec2<f32>(1.0, 0.0)), f - vec2<f32>(1.0, 0.0)), u.x),mix(dot(hash22(i + vec2<f32>(0.0, 1.0)), f - vec2<f32>(0.0, 1.0)),dot(hash22(i + vec2<f32>(1.0, 1.0)), f - vec2<f32>(1.0, 1.0)), u.x), u.y);}