浏览代码

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.

Nehon 8 年之前
父节点
当前提交
1315af8d52
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      jme3-core/src/main/java/com/jme3/math/FastMath.java

+ 2 - 2
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;
         }