Skip to main content
Inspiring
February 15, 2023
Question

What math is the best for combining several 32b channels?

  • February 15, 2023
  • 1 reply
  • 412 views

I'd like to combine height, two UV gradients and ID  into single 32-bit  gray channel to use it in fx-map node max blending to then split successfully  after.
I tried to put  the height before the comma and  two gradients as passengers after in  digits order  using just floor  and add nodes ?   It works  with one gradient at best , the second comes  pretty degraded due to values precision and  no room for ID at all.   
 

Should I use  some other math . Rather multiplying one to another?    Isn't floating point value should allow to pack lots of info?    Is there any cool advanced way  to do it that could workaround  precision issue?   Sort of bit masks maybe?

 

This topic has been closed for replies.

1 reply

davescm
Community Expert
Community Expert
February 16, 2023

Isn't floating point value should allow to pack lots of info?

Not really, the point of floating point numbers was to combine an extended range with good precision (which relates to significant digits not to decimal places i.e. decimal place precision varies on the size of the number being represented). 

 

What are you trying to achieve by combining the channels that treating them separately and using instancing for the fx would not?

 

Dave

kirkr5689Author
Inspiring
February 16, 2023

Too many instances nesessary.  Works too slow. 

davescm
Community Expert
Community Expert
February 16, 2023

The issue with packing such data into a single floating value using the pre decimal point and post decimal point parts is that changes to the pre-decimal point part can affect the post-decimal point part. This is due to the way floating point numbers work with larger numbers having less precision after the decimal point (the precision is set in terms of significant digits not decimal points).

 

Dave