RGB Normal Vector to HILO


Everything below refers to an application developed on a GeForce 4.

I’m currently doing a dynamic heightmap -> normalmap conversion in the register combiners using nvidia’s approximation of
z = ( 1 - x² - y² )

This resulted in insufficient precision, so I used ( as suggested in the nvidia demo ) a dependent texture pass to generate correct z-values in a RGB normalmap.

However, the precision is still not enough. I could perform a dependent texture pass to a HILO normalization map, but I need to use the generated normal map in several object-passes ( diffuse + spec lighting, refraction, reflection ) which I’m implementing using texture shaders. The RGB version is using render-to-texture to store the generated normal map.

The reflection pass uses up all 4 texture stages so I don’t have a spare stage to perform the dependent texture pass. Also, it’d be nice to be able to perform the dependent lookup once and keep the normal map for all 3 object passes.

Simply put, I’d like to do dynamic Heightmap -> Signed HILO Normal map. Any way to do this?