Sign in to follow this  
dawidjoubert

My Reflection, please look and help

Recommended Posts

Hey I am trying to achieve planar reflections using stencil buffer and arbitary planes. ATM this is how i find my reflection matrix. An objects matrix is defined as Rotx * Roty *Rotz * Translate And so the inverse matrix moves it back to the origin, by mutliplying the scene with the inversematrix like this glMultMatrixf(objInversematrix); glScalef(1,-1,-1); glMultMatrixf(objMatrix); I get my reflection matrix. Please check my app and see if the reflection is correct. I will post more source code if needed. http://rmcommando.co.uk/reflectionmatrix.zip

Share this post


Link to post
Share on other sites
Quote:
glScalef(1,-1,-1);


why are you inverting the z axis as well as the y axis?

if you are inverting around a plane pointing upward, just flip the y axis.

you should also be aware that using negative sizes within glScale are likely to mess up lighting equations etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by Exorcist
Quote:
glScalef(1,-1,-1);


why are you inverting the z axis as well as the y axis?

if you are inverting around a plane pointing upward, just flip the y axis.

you should also be aware that using negative sizes within glScale are likely to mess up lighting equations etc.


Yes I noticed the double inverting as well, I don't know. If i just invert the one axis it doesn't work right.

IF negative scalling effects lighting how do i get around it?

I think the double scaling could be because the plane is rotated 90 degrees.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this