[Bf-blender-cvs] [e005ad5b547] master: Fix T92103: Update BLI hash_float_to_float functions to be shader compatible

Charlie Jolly noreply at git.blender.org
Mon Oct 11 23:59:21 CEST 2021


Commit: e005ad5b547627914a87469b58bcd6a249c95c55
Author: Charlie Jolly
Date:   Mon Oct 11 21:59:04 2021 +0100
Branches: master
https://developer.blender.org/rBe005ad5b547627914a87469b58bcd6a249c95c55

Fix T92103: Update BLI hash_float_to_float functions to be shader compatible

Previously the functions called `hash_float` instead of `uint_to_float_01`.
This meant that the float was hashed twice instead of once.
The new functions are also compatible with Cycles/Eevee.

Differential Revision: https://developer.blender.org/D12832

===================================================================

M	source/blender/blenlib/intern/noise.cc

===================================================================

diff --git a/source/blender/blenlib/intern/noise.cc b/source/blender/blenlib/intern/noise.cc
index e80975f618c..6ed1fae71ad 100644
--- a/source/blender/blenlib/intern/noise.cc
+++ b/source/blender/blenlib/intern/noise.cc
@@ -222,22 +222,22 @@ float hash_to_float(uint32_t kx, uint32_t ky, uint32_t kz, uint32_t kw)
 
 float hash_float_to_float(float k)
 {
-  return hash_to_float(hash_float(k));
+  return uint_to_float_01(hash_float(k));
 }
 
 float hash_float_to_float(float2 k)
 {
-  return hash_to_float(hash_float(k));
+  return uint_to_float_01(hash_float(k));
 }
 
 float hash_float_to_float(float3 k)
 {
-  return hash_to_float(hash_float(k));
+  return uint_to_float_01(hash_float(k));
 }
 
 float hash_float_to_float(float4 k)
 {
-  return hash_to_float(hash_float(k));
+  return uint_to_float_01(hash_float(k));
 }
 
 /* ------------



More information about the Bf-blender-cvs mailing list