Iris Shaders

Iris Shaders

36M Downloads

Figure out the cause of precision issues from a packed integer midTexCoord

IMS212 opened this issue ยท 3 comments

commented

For now, we will likely be reverting to floats until the cause is found.

commented

As discussed in the Iris Discord, this issue does not affect 1.16. It is likely the result of Sodium 1.16 and 1.18 encoding UVs differently. Sodium 1.16 multiplies UVs by 32768 whereas Sodium 1.18 multiples UVs by 65536. Multiplying the midU and midV by 65536 instead of 65535 fixes the issue, but the case of midU == 1 and midV == 1 should be handled separately. This can be accomplished by either intentionally falling back to 0 ((short) (65536) == 0) or using 65535.0f/65536.0f as the upper limit.

commented

midU == 1 and midV == 1 shouldn't be possible/sensible under normal circumstances, since that would mean that the texture coordinates of all vertices involved would have to be at the lower right corner of the atlas. So we don't really need to worry about that edge case I don't think.

commented

Sodium itself does not handle u == 1 or v == 1 (they are encoded as 0) so I think the same can be done for the midTexCoord.