Mirror image....

Started by
11 comments, last by Frag 20 years, 5 months ago
Hello, I have mirred a image on a surrface which works fine except when I view the surface from below the mirroed image is there, like its real. It shouldn''t be below the surface, and I was wonder how to fix this... Thanks Frag
Advertisement
I dont know much about mirrors, but i do think that your post is kind of confusing. Maybe post a screenshot or two.
quote:Original post by Frag
Hello, I have mirred a image on a surrface which works fine except when I view the surface from below the mirroed image is there, like its real. It shouldn''t be below the surface, and I was wonder how to fix this...

Thanks Frag


i''m guessing you are using stencil reflections that''s why you are getting this effect.

just do a test to determine if you are on the same side of the plane as the relfected object and dont draw it if you''re on the other side. In this case you could blend the surface onto the object (if it''s a transparent window or a water surface)

to do this test do:

CVector3 vNormal = Cross((vSurfacePoint1 - vSurfacePoint2), (vSurfacePoint1 - vSurfacePoint3));

float dot1 = Dot((vObject - vSurfacePoint1), vNormal);
float dot2 = Dot((vCamera - vSurfacePoint1), vNormal);

if (dot1 * dot2 > 0) renderobject();

This picture shows the mirrored brick cubes that should not be displayed.



This picture shows the bottom of the floor, as you can see everything is mirrored exactly.

[edited by - Frag on November 9, 2003 1:31:47 PM]
Nehe has a tutorial on this
"...."
Yes i know nehe has a tutorial on mirror images, but it didn''t seem to address or solve my problem.
render a quad on the reflection plane which you blend over the reflected image.

EDIT: i see what you mean now: render only the reflective parts in the stencil buffer! then render the mirrored image with stencil test, then render the reflective plane again, then the normal image!

[edited by - Ilici on November 9, 2003 1:41:24 PM]
quote:Original post by Ilici
render a quad on the reflection plane which you blend over the reflected image.


There is no problem with the reflections them selves, just the other side of the surface.

For example, I have it set up to properly i give the effect if your looking at the mirror, but when you move to the other side of the mirror you see where the reflections would be.
quote:Original post by Frag
Yes i know nehe has a tutorial on mirror images, but it didn''t seem to address or solve my problem.


If you read the tutorial, it WOULD have solved your problem.
"...."
quote:Original post by Lunatic Raven
quote:Original post by Frag
Yes i know nehe has a tutorial on mirror images, but it didn''t seem to address or solve my problem.


If you read the tutorial, it WOULD have solved your problem.


The only difference that i see between my rendering code any NEHE''s 26th tutorial is that my floor is rendering in small blocks. would this make a difference?

This topic is closed to new replies.

Advertisement