PDA

View Full Version : Question concerning the reflection



04-06-2004, 08:18 AM
Hi all, I have read some reference abt the implementation of reflection. And the procedure is as follows:

1. Initialize the modelview and projection matrices to the identity (glLoadIdentity).

2. Set up a projection matrix using the glFrustum command.

3. Set up the “real” eye point at the desired position using a gluLookAt command (or something
similar).

4. Reflect the viewing frustum (or the scene) through the plane containing the reflector by computing a reflection matrix and combining it with the current modelview or projectionmatrices
using the glMultMatrix command.

5. Draw the scene.

6. Move the eye point back to its “real” position.

I am a bit confused abt the first four procedure. If I have a pond and want to reflect the object above the pond.... is that what I should do in the first four procedure is to extract the modelview from the viewing frustum and then locate the eye point under the pond?
After that, is that i should draw the object above the pond and then move the eye point back to real position? If so, what is the reflection matrix referring to?

Thanks a lot

seed
04-06-2004, 02:39 PM
are you talking about simple mirror reflection? if so all you have to do is position your camera at the centre of your pond looking up, draw your scene and capture the screen into a texture, then place your camera back to where it should be, draw your scene as normal and use the texture you generated before to map to your pond geometry.

04-07-2004, 12:25 AM
Hi, ya! I think what I need to do is somehow quite similar to what you think. However, I just wonder if I place the eye point under the pond and then draw the scene, if suddenly there is a butterfly flying over the scene, how can the pond capture it?

Thanks for your help