Changed the minimum value of a float when converting it to half float. It was 5.96046E-8f and it's now 3.054738E-5f. This values seems to be the lowest one before 0 when converting back half to float.

This issue has been revealed in this post https://hub.jmonkeyengine.org/t/pbr-nan-to-half-conversion-errors/37219
The bad minimum was causing erratic data being wrote to the texture when the value was very close to 0, and causing the glitches and even crashes when color values were given as Float.Infinity or Float.NaN.
cleanup_build_scripts
Nehon 8 years ago
parent efd47c4347
commit 1315af8d52
  1. 4
      jme3-core/src/main/java/com/jme3/math/FastMath.java

@ -981,9 +981,9 @@ final public class FastMath {
return 0x7bff;
} else if (flt < -65504f) {
return (short) (0x7bff | 0x8000);
} else if (flt > 0f && flt < 5.96046E-8f) {
} else if (flt > 0f && flt < 3.054738E-5f) {
return 0x0001;
} else if (flt < 0f && flt > -5.96046E-8f) {
} else if (flt < 0f && flt > -3.054738E-5f) {
return (short) 0x8001;
}

Loading…
Cancel
Save