portal-style portals
Blitz3D Forums/Blitz3D Programming/portal-style portals
| ||
OK, I'm gonna be forced to ask a really open ended question- but I want an effect that will allow me to create a "portal", (like in the game portal) in other words, a surface that looks as if it's just a regular door, but the room behind it is actually stored somewhere else. I was thinking of doing something with multiple cameras and projecting them onto surfaces, but I can't get that right either. so... I decided to ask for help because I just don't know how to go about doing it. thanks in advance if you know how to do this.. |
| ||
You need render to texture, which you can have with FastExt library. You will just place a second camera where the portal opens to, and render that camera to the portal texture. |
| ||
You need render to texture No you don't. You can just render as normal and use CopyRect to copy to a texture. FastExt might be faster (might meaning I have no idea, I've never used it) but it's certainly not required. |
| ||
what you need to do for a cool door effect is something like this. render camera in the other room from an equivalent position/rotation and copyrect to texture. Then get the projected x and y of each corner of the door. You can use this to set the UV coords for the texture. I may get an example up later. If your door is partially offscreen then it doesnt work an your out of luck. So I dont think there is a bugless way to do it when its partially offscreen. you can also try cubemapping to another room. :) |
| ||
here is an example! use left/right arrows to turn camera Here is another cooler example |
| ||
Heh, move forward and backwards. I added TranslateEntity campiv,0,0,(KeyDown(200)-KeyDown(208)) PositionEntity portalcampiv,EntityX(portalcampiv),EntityY(portalcampiv),-980+EntityZ(campiv) |
| ||
thanks Nate the Great. that code is what I am looking for- and I'll credit you for it if you like. although I'm having a few problems getting that to work in my own engine. I haven't changed anything about it, apart from the 640*480 graphics to 1024*768 and assigned the portal to a type. I also changed it so the "CameraPick" picks the vertex's actual location so you can move the portal around. it seems to tile the texture whenever you turn the viewpoint, though. |
| ||
Be sure to check out our own Jeremy Alessi's article on Gamasutra: http://www.gamasutra.com/view/feature/3770/games_demystified_portal.php |
| ||
@Wigwam - why use camerapick? I dont see how camera pick would help. Try changing it back to cameraproject and it should work. |
| ||
@Morbius - That's extremely interesting. It makes me want to pause on my recreation project and try out a portal thing. :D |
| ||
That would be cool if it permitted you to travel in the window and that you'd "teleport" to where that portal points to. Then it would be a functionnal portal. |
| ||
From what I read, it does. It checks if you're touching the portal, and if you are, it disables your collision. Then if you go in too far, you come out the other side. |