enkimute / hdrpng.js

:high_brightness: High Dynamic Range image support for the web. (HTML, canvas & webGL) Used for HDR support in the official Khronos glTF examples.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

floatToRgbe seems doesn't work

bbbbx opened this issue · comments

commented

floatToRgbe seems doesn't work for some float point number.

for example:

const rgbe = floatToRgbe(new Float32Array([0.5, 0.5, 0.5])); // [0, 0, 0, 127]
// result should be [128, 128, 128, 128]

// convert back: failed
const float = rgbeToFloat(rgbe); // [0, 0, 0]

// use correct rgbe
rgbeToFloat(new Uint8Array([128, 128, 128, 128])); // [0.5, 0.5, 0.5]