Original Post
G'day! I should have joined this community a long time ago... but thats another story Im putting together a deferred shading engine (like everyone seems to be doing at the moment) and i've stumbled across a problem. I initially started storing all components of the normal in 3x8 bits (RGB). For specular lighting, this just doesn't cut it. After reading through the Killzone pdf on their renderer, the concept of storing 2x FP16's while deriving the third component later seemed like a good option! The normal im storing is basically just the varying variable created from gl_NormalMatrix * gl_Normal in the vertex shader. I then pack normal.x and normal.y into an RGBA occupying 2 channels each. This part definitely works... and works really well! The precision is far better than with 8bit components. The problem is, though, that the sign of normal.z in this current state is not attainable on the lighting pass. x^2 + y^2 + z^2 = 1 z = +- sqrt( 1 - x^2 - y^2) As you can see, normal.z can obviously take on the value of 2 quite different values. There must be something im missing here, or not doing correctly. I dont really want to store more data about the sign of normal.z. I've briefly tried to pack 1bit into a channel (reduced specular to have precision 2^7) to store the sign, but without too much luck. Any help appreciated! Cheers
