I have a bunch of normals all within a cone - at the moment I am compressing the normals individually, so Im not making use of the fact that the angle between any normal and the cone axis is less than a certain amount,
Each normal consists of three floats (IEEE754 32 bit ). Although the compression I outline below works well for general normals, The fact that they all lie in a cone would imply that I should be able to compress better… any ideas here ??
Current compression:
Take the absolute biggest scalar component of the normal, call it ‘b’, which will be in the range [1/root(3), 1]. Scales to the closed/open range [1, 2) so that the sign and exponent are constant and then storing only the mantissa (as many bits as required) and the sign of the component. The second biggest (absolute) will be in range [ root( (1 - b^2) / 2 ), root(1 - b^2) ] - so similarly scale to [1, 2) etc. The third element can be trivially calculated from the first two on decomopression ie. +-sqrt(1 - b^2 - c"2). Note: when scaling to the range [1, 2) care needs to be taken with fpt rounding etc. as the maximum value should be the floating point value corresponding to bit pattern: 0x3fffffff, which is the biggest value less than 2. When decompressing the two mantissas the bit patterns are ‘OR’d' with 0x3f800000 to get [1.2) and then scaled back to the original range. ( I have code for this, too much for here but I can post snippets….)