GL_NV_texgen_reflection

Can anyone provide me with or point me to the exact mathematical formula used to generate the s,t coordinates using this extension given the eye vector and vertex normal… Say, I wanted to implement this myself…
Thanks

This extension exposes two texgen modes: REFLECTION_MAP, and NORMAL_MAP. Both of these modes should be used to compute and (s,t,r) – not just an (s,t) as with SPHERE_MAP.

The extension spec (which can be found at the NVIDIA web site), states that the reflection vector is calculated in the same way described in the OpenGL spec, so I’ll refer you there for the details of the computation.

It is simply the “standard” reflection equation: R = 2N(N dot E) - E, where R is the reflection vector, N is the normalized vertex normal, and E is the eye vector. The OpenGL spec actually uses normalize(-E), but otherwise it’s the same computation.

Also note that you probably don’t really want to normalize E before using it in the reflection equation if you’re using cube maps.

Hope this helps…
Cass