Hellbinder

10-03-03, 02:10 AM

...By our Friend OpenGL Guy. One of the well known D3D Driver Gurus at ATi.

He posted this tonight in a response to something at Rage3D.

Let me clarify some of this. There are two main components to a floating point number, the mantissa (precision) and the exponent (range). In some cases, one is more important than the other (i.e. you want more precision when sampling textures, you want more exponent when demonstrating high dynamic range).

FP16 = s10e5, which means the mantissa is 10 bits plus 1 implied bit = 11 bits (the "s" represents the sign bit). The exponent is 5 bits, which means your maximum exponent is 15.

Since your maximum exponent is 15, that means the largest difference you can have between your dimmest areas and your brightest areas is only a factor of 2^15 = 32768. (I am neglecting non-normalized floating point values as those are uncommon.) Since your mantissa is 11 bits (note that this is lower than the precision of FX12), you can sample 2048 different positions from a texture map, but note that you'd want about 4-5 bits of subpixel precision, so you end up only being able to accurately sample a 256x256 texture.

FP24 = s16e7 = 17 mantissa bits, 7 exponent bits. This means your largest exponent is 63.

With such a large exponent, you can acheive differences in brightness of over 9.2 * 10^18! With 17 bits of mantissa, you can sample 2048x2048 textures and still have 4-5 bits of subpixel precision left over. Very well balanced.

FP32 = s23e8 = 24 mantissa bits, 8 exponent bits. This means your largest exponent is 127.

Now your range goes up to 1.7 * 10^38. Pretty much overkill compared to FP24. With 24 bits of mantissa, you could sample a 524288x524288 texture with 4-5 bits of subpixel precision. Again, overkill.

This doesn't mean that FP32 is bad. What it means is that FP32 is not likely to offer noticable improvements over FP24 on today's shaders. The jump from FP16 to FP24 is very large, because you are getting a large jump in precision and range. The difference from FP24 to FP32 is mostly in the precision... which was already sufficient to begin with.

This is it fellas, does not get any more straight up than this. Lets forget who offers what for a second and just look at..

1. The Straight Math of it all.

2. What games are actually using today and into the Future a couple years.

Looking at the facts of the math and the game engines out there.. what is the best solution?

(Lets not forget Ram limitations)

He posted this tonight in a response to something at Rage3D.

Let me clarify some of this. There are two main components to a floating point number, the mantissa (precision) and the exponent (range). In some cases, one is more important than the other (i.e. you want more precision when sampling textures, you want more exponent when demonstrating high dynamic range).

FP16 = s10e5, which means the mantissa is 10 bits plus 1 implied bit = 11 bits (the "s" represents the sign bit). The exponent is 5 bits, which means your maximum exponent is 15.

Since your maximum exponent is 15, that means the largest difference you can have between your dimmest areas and your brightest areas is only a factor of 2^15 = 32768. (I am neglecting non-normalized floating point values as those are uncommon.) Since your mantissa is 11 bits (note that this is lower than the precision of FX12), you can sample 2048 different positions from a texture map, but note that you'd want about 4-5 bits of subpixel precision, so you end up only being able to accurately sample a 256x256 texture.

FP24 = s16e7 = 17 mantissa bits, 7 exponent bits. This means your largest exponent is 63.

With such a large exponent, you can acheive differences in brightness of over 9.2 * 10^18! With 17 bits of mantissa, you can sample 2048x2048 textures and still have 4-5 bits of subpixel precision left over. Very well balanced.

FP32 = s23e8 = 24 mantissa bits, 8 exponent bits. This means your largest exponent is 127.

Now your range goes up to 1.7 * 10^38. Pretty much overkill compared to FP24. With 24 bits of mantissa, you could sample a 524288x524288 texture with 4-5 bits of subpixel precision. Again, overkill.

This doesn't mean that FP32 is bad. What it means is that FP32 is not likely to offer noticable improvements over FP24 on today's shaders. The jump from FP16 to FP24 is very large, because you are getting a large jump in precision and range. The difference from FP24 to FP32 is mostly in the precision... which was already sufficient to begin with.

This is it fellas, does not get any more straight up than this. Lets forget who offers what for a second and just look at..

1. The Straight Math of it all.

2. What games are actually using today and into the Future a couple years.

Looking at the facts of the math and the game engines out there.. what is the best solution?

(Lets not forget Ram limitations)