Advertisement

opengl and mirrors???

Started by July 12, 2002 07:41 AM
12 comments, last by mirrormack 22 years, 7 months ago
um, you were perfectly right, i think.

http://www.sgi.com/software/opengl/advanced97/notes/node91.html#SECTION000113120000000000000

"The texture coordinates at the vertices of the reflective object must be in the same location as the vertices of the reflective object in the texture. These coordinates may be computed by figuring the projection of the corners of the object into the viewing plane used to compute the reflection map (the command gluProject() may prove helpful). Alternately, the texture matrix can be loaded with the composite modelview and projection matrices and postmultiplied by a scale of 1 divided by the size in pixels of the region used to compute the texture. The texture coordinates would then be the model coordinates of the vertices."

i have no idea what this means on planet earth, but i think
this is where i get it wrong.
i think i got this one:

i could render the scene from the original viewpoint with
the scene mirrored according to the mirror plane and save
(using stencil buffer) the mirror area. now i have only the
mirror rendered in the view buffer and i could take that
as use it as a texture map, but i don't get a very good
resolution (if and when the viewer is not in fron of the mirror
facing the mirror directly) to the texture map (mirror's).
this isn't either what i wanted. ;(

humh, do i only get that mirror texture by ray tracing?

[edited by - mirrormack on July 12, 2002 2:46:31 PM]
Advertisement
for getting the reflected camera position and (most important) direction, probably the easiest way would be to represent the mirrow with a matrix...
I can''t say my logic is perfect here, but (in my head at least) you''d just multiply the current view matrix by the inverse of the mirrors, inverse that, then mult it by the mirror... But I bet there is somethign I''ve missed...

getting the position is easier though..

newPos = oldPos+(oldPos-pointOnPlane).DOT(planeNormal)*-2*planeNormal

although thats just off my head... so I might have a sign wrong.
i gave up on my goal, getting the mirror texture (eg. 256x256).
instead used the scene flipping with reflection matrix and
stencil buffer so at least i get the reflection right.

http://www.opengl.org/developers/code/sig99/advanced99/notes/node159.html

and 11.1.2.1.

unfortunately this gives me only the mirror image from the
viewers point of view so i have to do all the extra effects
i wanted to perform on the mirror image (mirror''s texture)
directly to framebuffer (by rendering the mirror multiple
times). anyway, this works...

it seems that what i wanted was something like this (nice
reading anyway):

http://www.cs.yorku.ca/~wolfgang/papers/TR98-026.pdf

This topic is closed to new replies.

Advertisement