ioquan
10-04-2003, 11:01 PM
Hi.
I am currently using a cube map with GL_REFLECTION_MAP_EXT texture coordinate generation to render reflections of the sky and sun on a water surface. Here is a screenshot: http://users.ms11.net/~ioquan/screenshots/water0.jpg
The cube map works for reflecting objects that are infinitely far away, i.e. the skybox, but does not work for local objects, such as my terrain. I would like to change my method of drawing reflections so that I can have reflections of local objects too.
In order to this, I intend to render the scene flipped about the reflection plane into a texture, and then map that texture to my water surface. I have a few questions regarding generation of texture coordinates for drawing such a reflection texture.
1. Is there a way to automatically generate the texture coordinates, similar to using GL_REFLECTION_MAP_EXT, but not for cube maps.
2. If the answer to #1 is no, would there be a way to render the reflection into one face of the cube map, and use texture matrix tricks to make GL_REFLECTION_MAP_EXT still work?
3. If the answers to number #1 and #2 are no, what is the formula I should use to generate texture coordinates manually on the cpu? It must take into account the vertex normals.
Any help would be greatly appreciated. Thanks in advance.
I am currently using a cube map with GL_REFLECTION_MAP_EXT texture coordinate generation to render reflections of the sky and sun on a water surface. Here is a screenshot: http://users.ms11.net/~ioquan/screenshots/water0.jpg
The cube map works for reflecting objects that are infinitely far away, i.e. the skybox, but does not work for local objects, such as my terrain. I would like to change my method of drawing reflections so that I can have reflections of local objects too.
In order to this, I intend to render the scene flipped about the reflection plane into a texture, and then map that texture to my water surface. I have a few questions regarding generation of texture coordinates for drawing such a reflection texture.
1. Is there a way to automatically generate the texture coordinates, similar to using GL_REFLECTION_MAP_EXT, but not for cube maps.
2. If the answer to #1 is no, would there be a way to render the reflection into one face of the cube map, and use texture matrix tricks to make GL_REFLECTION_MAP_EXT still work?
3. If the answers to number #1 and #2 are no, what is the formula I should use to generate texture coordinates manually on the cpu? It must take into account the vertex normals.
Any help would be greatly appreciated. Thanks in advance.