Reputation: 469
I am now trying to sample a texture using floating point vectors but I found that the floating point precision is only 2 ^ -10 bits and the resolution is very limited. So I am wondering whether it is possible for me to use all the 16 bits of a mediump floating variable to sample textures? Thank you.
Upvotes: 0
Views: 589
Reputation: 473407
You are using all 16 bits of a 16-bit floating point number. That's what a 16-bit floating-point number is. They have ~11 bits of mantissa and 5 bits of exponent. You cannot make a half-precision floating-point value have more than ~11 bits of mantissa.
You could try multiplying the number by 4096 in the vertex shader, but this would only help if the texture coordinate was originally a 32-bit float (before converting it to half-precision).
In short: texture coordinates generally need more precision than this. So you're going to have to use a higher-precision floating-point value.
Upvotes: 2