From: Michael Polis (mfp++at++terrasim.com)
Date: 06/24/2000 10:37:39
Angus Dorbie writes:
> You need to compute the reflection matrix for the surface in question
> and mask the mirror database to the reflecting surface maybe using
> stencil operations, this matrix is the tricky part and is an exercise
> left for the reader. Reversing the face winding as the other post
> suggested is the right thing to do. The only other issue is how you
> choose to draw the scene multiple times, you can have a duplicate
> channel which is over your main channel or you can add the scene twice,
> once below the reflection matrix with a winding & stencil mask callback.
> Light sources need to be reflected too so you should probably do the two
> channel thing to allow this without too much pain.
These pages discuss this technique and have sample code using GLUT and OpenGL.
http://reality.sgi.com/opengl/tips/Reflect.html
http://reality.sgi.com/opengl/tips/TimHall_Reflections.txt
http://reality.sgi.com/opengl/tips/TexShadowReflectLight.html
The sample code has the mirror in the y==0 plane, which makes the reflection matrix calculation trivial, but the second page talks about how to calculate a reflection matrix in the general case.
> You can then get clever with glScissor or portal culling to improve
> performance.
--- Mike Polis TerraSim, Inc. mfp++at++terrasim.com 4620 Henry Street, Third Floor http://www.terrasim.com Pittsburgh, PA 15213 Phone: (412) 681-3703 FAX: (412) 681-3705
This archive was generated by hypermail 2b29 : Sat Jun 24 2000 - 10:39:47 PDT