PDA

View Full Version : HILO question



Ninja
09-26-2002, 02:01 AM
If I want to use the HILO format instread of the usual RGB for normalmaps, then I have to change

glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, bump);

to

glTexImage2D (GL_TEXTURE_2D, 0, GL_HILO16_NV, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, bump);

right?
What else do I have to do?

Btw, is there anyone how have done per-pixel specular lightning with texture shaders or know where to find info about it?


//Regards, Ninja

SirKnight
09-26-2002, 04:34 AM
Demos/papers/presentations on how to use everything about the nvidia cards is on their dev site.
http://developer.nvidia.com

-SirKnight

jwatte
09-26-2002, 09:28 PM
Normals are 3-valued vectors.

HILO textures contains 2-valued tuples.

Ergo, you can't easily put a normal map inside a HILO texture.

vshader
09-26-2002, 10:11 PM
actaully jwatte, you can, because there is a mode where it willl calculate a z value as a hemispherical projection of the x and y - giving you a unit length normal.

you must use a signed HILO format, though, and i think it only works for the dotproduct texture shader operations.

davepermen
09-26-2002, 11:34 PM
a normal is 2dimensional.. it has latitude and longitude.

and yes, teh hiloformat uses 2 components for the normalmap, it calculates z = sqrt(1 - x*x - y*y) in the textureshader and uses it for a textureshader dotproduct. on a normalmap, all normals are facing upwards, => z always greater zero