Skip to content

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Dec 2, 2025

Related issue: #28825 #32380

Description

Fixed incorrect alpha channel initialization values in the HDR buffer.

For HalfFloatType, the fill value was 23544 which represents 255 in half-float encoding. The correct value for alpha 1.0 is 15360 (0x3C00).

For FloatType, the fill value was 255 instead of 1.0.

/fyi @mjurczyk

@mrdoob mrdoob added this to the r182 milestone Dec 2, 2025
@mrdoob mrdoob merged commit 4e86f50 into dev Dec 3, 2025
8 of 9 checks passed
@mrdoob mrdoob deleted the ultrahdr-fix branch December 3, 2025 00:16
@WestLangley
Copy link
Collaborator

For HalfFloatType, the fill value was 23544 which represents ~127.75 in half-float encoding.

three.js utils says it represents 255.

@mrdoob
Copy link
Owner Author

mrdoob commented Dec 3, 2025

You're right, I made an error in my half-float conversion. Let me verify:

23544 = 0x5BF8
Binary: 0 10110 1111111000
      sign=0, exponent=22, mantissa=1016
Value = 2^(22-15) * (1 + 1016/1024) = 2^7 * 1.9921875 = 255

So 23544 represents 255, not ~127.75. My apologies for the incorrect conversion! The bug is still the same though - alpha should be 1.0 (which is 15360 in half-float), not 255 (which is 23544). The fix is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants