View Full Version : 16x16Bit Normalmaps
05-15-2003, 08:57 AM
i saw the Ferrari Demo on a R9700 now and i have a question on the normalmap format they are using.
I know perpixel lighting on fragment basis, but i used 8x8x8bit components to compute the normalvector. This little demo show the usage of 16x16bits instead. Ofcourse it looks amazing precise, but i don't understand how they compute the third component out of the texture. Can some1 help ?
I know that it uses floatingpoint precision, but how can i reconstruct a third component for the normal from a 16x16 texture ?
05-15-2003, 09:27 AM
r = sqrt(x*x+y*y+z*z), where x, y, z - coordinales of a vector, r - it's length.
Normal's length is always 1(normalized), so:
z = +-sqrt(r*r-x*x-y*y), and z is always positiv.
z = sqrt(r*r-x*x-y*y)
05-15-2003, 09:35 AM
Cool, never thought of it from this side. Thank you will try it later.
05-15-2003, 09:39 AM
However, in OpenGL, ATI supports the RGB[A]16 internal format, so you could just upload it as you normally would only with unsigned_short or float at the source data format. That's how I do it now, and it saves fragment program instructions.
Otherwise you would have to upload as an lum_alpha 16bit/channel texture (32bit total) and do some swizzling in the fragment program then re-calculate the z channel. That could save texture memory.
Just remember, on current hardware (R3xx, NV3x) floating point textures aren't filtered, so you would have to deal with nearest filtering (with the GL_RGB16 internal format you get filtering).
05-15-2003, 10:29 AM
How do u mean they are not filtered ? Is it something that still has to be implemented like float arb_pbuffers or is it a limitation in hardware and i will end up writing fragment programs for filtering purposes (if this feature will get added to OpenGl later, i would not mind now if filtered or not).
05-15-2003, 10:39 AM
Its a hardware limit.
05-15-2003, 01:26 PM
What do you think about filtering inside a fragment program ? Or do you think, that filtering is not required there ?
05-15-2003, 01:41 PM
If you need it, you can definitely do your own filtering in the fragment program.
05-15-2003, 10:31 PM
Thanks for the answer http://www.opengl.org/discussion_boards/ubb/smile.gif.
Now i will sit down and try out if i need filtering or if my textures are good enough to do it without.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.