About Store Forum Documentation Contact



Post Reply 
Render to texture mirror
Author Message
b1s Offline
Member

Post: #1
Render to texture mirror
So. As the mirrors seem to be moving further and further on the roadmap I decided to take shot at creating mirrors by using the render texture tutorial as a base.

The problem for my crap mathematics comes when I try to calculate the camera matrix for the mirror camera.

I tried looking about how to calculate this but I just couldn't quite figure out how to do it correctly in Esenthel.

Reference


So what I have is
Camera camera[0]; //Main camera
Camera camera[1]; //Camera used for rendering mirrors

in the RenderToTexture() function I setup the Mirror camera as the rendering camera and now im actually able to render the mirror camera to a texture and set it up as a texture for a mesh.

Now here comes the tricky part.
On every mirror object I should try to get the matrix for the mirror camera.
I tried several times to achive this mirrored matrix by using the functions in matrix.h (like inverse and mirror)
Some how It did not give the effect I was looking for.

PHP Code:
    Matrix mirrorMatrix;
mirrorMatrix camera[0].matrix;
mirrorMatrix.mirror(mirrorPlane);
camera[1].matrix mirrorMatrix

If anyone has any experience or any advice how to do this It would be very appriaciated.
07-20-2011 04:31 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Render to texture mirror
Have tried the EE::Reflect function? Or perhaps EE::Mirror, though, if I understood the header comments correctly, EE::Reflect is what you want.
07-20-2011 07:13 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: Render to texture mirror
Ok.. By mirroring alot of stuff I managed to get the right matrix for the camera.
I also had to calculate the fov according to the surface and that also now seems to be working well enough.
It's not perfect but does the job close enough.
07-21-2011 12:12 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #4
RE: Render to texture mirror
Any chance you'd be willing to post a Code Snippet or write a tutorial for the Wiki? I think a lot of people would be interested in this. I know I am...
07-21-2011 08:07 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #5
RE: Render to texture mirror
Yeah I'll do that as soon as I have the chance.
07-22-2011 07:39 AM
Find all posts by this user Quote this message in a reply
Post Reply