diff options
author | Charlie Jolly <charlie> | 2021-10-14 16:31:34 +0300 |
---|---|---|
committer | Charlie Jolly <mistajolly@gmail.com> | 2021-10-14 16:56:48 +0300 |
commit | 2341ca990c17df7a77d4527a707f7b9e3d5f0f1a (patch) | |
tree | a4d713830ad16e556dbd2c94848531c4435f7f44 /source/blender/blenlib/intern | |
parent | 55cf9bb5e653ef824cf32aae899437525d1f16e0 (diff) |
Geometry Nodes: Add White Noise texture
Port White Noise shader to geometry nodes.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12719
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/noise.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/noise.cc b/source/blender/blenlib/intern/noise.cc index 6ed1fae71ad..ce2e9594059 100644 --- a/source/blender/blenlib/intern/noise.cc +++ b/source/blender/blenlib/intern/noise.cc @@ -240,6 +240,47 @@ float hash_float_to_float(float4 k) return uint_to_float_01(hash_float(k)); } +float2 hash_float_to_float2(float2 k) +{ + return float2(hash_float_to_float(k), hash_float_to_float(float3(k.x, k.y, 1.0))); +} + +float3 hash_float_to_float3(float k) +{ + return float3(hash_float_to_float(k), + hash_float_to_float(float2(k, 1.0)), + hash_float_to_float(float2(k, 2.0))); +} + +float3 hash_float_to_float3(float2 k) +{ + return float3(hash_float_to_float(k), + hash_float_to_float(float3(k.x, k.y, 1.0)), + hash_float_to_float(float3(k.x, k.y, 2.0))); +} + +float3 hash_float_to_float3(float3 k) +{ + return float3(hash_float_to_float(k), + hash_float_to_float(float4(k.x, k.y, k.z, 1.0)), + hash_float_to_float(float4(k.x, k.y, k.z, 2.0))); +} + +float3 hash_float_to_float3(float4 k) +{ + return float3(hash_float_to_float(k), + hash_float_to_float(float4(k.z, k.x, k.w, k.y)), + hash_float_to_float(float4(k.w, k.z, k.y, k.x))); +} + +float4 hash_float_to_float4(float4 k) +{ + return float4(hash_float_to_float(k), + hash_float_to_float(float4(k.w, k.x, k.y, k.z)), + hash_float_to_float(float4(k.z, k.w, k.x, k.y)), + hash_float_to_float(float4(k.y, k.z, k.w, k.x))); +} + /* ------------ * Perlin Noise * ------------ |