Sign in to follow this  
tasseloff

OpenGL planar reflections

Recommended Posts

Hi, i am currently working on a project to simulate a rainfall over a lake. I've read and re-read Yann's article (Realistic Natural Effect Rendering: Water I ) but im still having trouble at the first part of it; render the reflection to texture. so far i've used Yann's equation Mreflview = Mc * Mf (* Mo) however, when i put that matrix into my model view and display it, it doesn'T seem right. if i remove the (* Mo) i get exactly the reflection camera (which is what i want) but i still can'T render that to texture since im looking from under my water and if i render that picture well, the water is in the way! i need to somehow find the point where the view camera and reflection camera intersect and render from there...i think this page illustrates what i mean: http://www.futurenation.net/glbase/reflect.htm please let me know if you can help :/ Actually, im not sure about the local object reflection matrix (Mo), i used the PROJECTION matrix in opengl and realised thats probably not what Yann meant, so...what exactly is the local object reflection matrix?? [Edited by - tasseloff on November 13, 2004 12:55:52 PM]

Share this post


Link to post
Share on other sites
when rendering a planar reflection you DONT render the object the reflection is going to be cast on, instead you want to clip to that plane, so if you are rendering mirror you setup your reflection matrix for rendering from the mirrors POV, and then render all the objects apart from that mirror to the framebuffer/pbuffer/whatever, then when you render the scene from the view cameras pov you render that object with the texture projected onto it.

As for how to set it up, there have been a number of threads on it, not least of all the one or two i've started myself (one of which refers back to another thread where I started from) and has Yann's and Eric Lengyel's input into it for various reasons. Check my posting history and limit it to posts started in the OpenGL forum to find 'em (I dont start many threads in there so it should be hard to find).

I do use GLSL to project the texture, but everything else should be clear enuff to help you out (more so when combined with the other thread I reference which was in this forum).

Share this post


Link to post
Share on other sites
alright, i fixed myself a clip plane and everything seems ok now, however i was just wondering, when copying to a texture with glCopyTexImage2D, should i copy the whole window (which i defined to be 900x500) or should i just change the viewport to copy a smaller area? what happens when there's gonna be a resize...should i take all that into account and modify the texture to which i will render according to that?

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