Real time mirror and magnify effects

I’m trying to do a remake of a famous demo using the game engine.

I need to make a magnify glass effect, I read you can set a video texture comming from a camera to any object, to simulate glass effects, like magnify or distortion, but i don’t know how to do it.

I also wanted to know if there is some way to make curved realtime mirrors, I already made flat realtime mirrors using python script, but The video texture trick will work better i think.

Thanks a lot.

I think you can get pretty good approximations with the right UV-sets.
Look for VideoTexture.

I’m sure you will find some demos.

Thabks, it works very well, i think i can also fake spheric mirrors with this…)

I was interested to know how to do it myself and I came up with this:


Mirror00.blend (100 KB)

This sounds interesting, any screenshots or sample files?

EDIT: That mirror00.blend was really interesting, very useful, thanks!

You’re welcome. I’m not sure what you mean by screenshots or sample files. Could you elaborate?

EDIT: I also wanted to put a filter on the camera, but don’t know how. Do you have an idea? I noticed that if I add one to one of the camera’s it shows in the viewport.

I referred to what Mills332 said above that he found something that worked, and with sample file I meant a blend :wink:

Ah okay. I have another question though. Maybe you 've noticed that the resolution in the Render tab is influencing the textures. For the spherical objects it’s convenient if aspect ratio would be 1:1 so that’s why I changed the resolution to match that. But the problem is that now also the viewport has this fixed ratio. Is there a way to set different settings for each camera?

You are right. It would be useful to be able to have different resolutions for different cameras, I do not seem to find any way to change that. But what about having a square resolution and have a zoomed in view for the player view… Not clean solution but… At the moment I cannot find any better solution…

That’s an option. I always assumed it would be possible to have different resolutions, so I’m a bit surprised it’s not supported. Anyway, with planar shapes it’s easy fixed by just sizing, but with the spherical shapes it’s a little bit tricky. It seems that the Z-position of the Camera is transforming the texture. It will have something to do with the resolution change of course, but why? Maybe there’s a solution by adjusting the UV-texture to that shift, I’ll just keep on looking.

Edit: I guess I fixed the problem. The UV-map on the sphere has to be projected from view (bounds) and resized to the opposite aspect ratio of the screen resolution. Also the UV-map on the plane has to be resized to the opposite aspect ratio. The cameras always have to be positioned so that the view is aligned with the center of the object.

Edit2: I’ve been silly. The UV of the Sphere isn’t right…

Edit3: I think this is it. The UV is Spherical and as mentioned earlier it has to be resized to the opposite aspect ratio of the screen resolution. Hope this makes sense. Sorry about the confusion. Ignore my previous statement on UV-mapping the sphere.


Mirror01.blend (104 KB)