Search Unity

Float texture using EncodeToEXR save to .exr not the same value

Discussion in 'Scripting' started by flyer19, Sep 13, 2019.

  1. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    13
  2. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    13
  3. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    216
    That's definitely a bug :)

    As a workaround, encode signed floats to unsigned by using the 2nd to last highest order bit as the sign bit. In other words:

    Actual value that does not store:

    100011 (-3)

    Value that stores:
    000011 (3)

    Your New Value:
    010011 (3 + 16 = 19)
    --^ use this bit as sign bit
     
    flyer19 likes this.
  4. flyer19

    flyer19

    Joined:
    Aug 26, 2016
    Posts:
    13
    waiting for unity team fixed this.