- Home /
Can anyone help me make portals (like Valve's)
I know Unity can do this because there is a unity game called Portalizer. I've tried everything, but I just can't get this to work as well as Portalizer or Portal. I have a game idea inspired by both Portalizer and Valve's Portal series. I found something online that could help me, but It confuses me. It's from the people who make Portalizer here it is:
1) Rendering: i look into MirrorReflection shader and script that you can find in Wiki. I have add two mirrors on scene and my goal was to render Reflection for camera that look on other mirror. I have modified transformation matrix that know relations between 2 portals and voila, all works fine.
2) Object teleporting: i have add inner trigger zone to portal which activates when you add moving object here. It simply create clone of this object and add script to it, that control his position and rotation using similar transformation matrix (like in previous step)
3) I have add a few zones to portals that send info about colliders to global script that manage them (enable|disable collision with walls, other objects e.t.c.)
4) To make object culling visually when it is inside portal, i have used interesting shader that i found on forum written by Aras. I modified it and got cool result, now my portals are connected and can seamless teleport object.
5) FPS teleporting: This is the most tricky part. How to teleport camera? I thinking about it too much and here is what i get. To make Camera looks fluid, i played with "Depth only" option. When i am creating clone for FPS, i also create Eyes for it, with absolutely the same params as your MainCam with rotation and position multiply on transformation matrix. Then i "wear glasses" while going through portal. This is basically a plane with transparent shader placed in front of camera. Then i placing projector behind each portal that project "Depth only shader" on this glasses and mix 2 camera views automatically.
So can someone please help me, I'll put all who help in the credits of my game. More Info: I script in C# and I do have Unity Pro
Thanks Dave, but I'm not finding anything that really answers how am i going to do this.
I know it's there somewhere, has been asked/answered many times. If I get some time later I might track it down.
Okay thanks, do you know how to do the steps above, that is supposed to work to make good portals
NOT AN ANSWER THIS IS A REPLY: Thanks, but i know all of that. I got the rendering working but i need help getting smooth transitions through portals flawlessly like portal and portalizer. I'm stuck on that.
Answer by UnbreakableOne · Jan 10, 2014 at 01:46 AM
I'm not sure about this but I think render to texture might help, for example, when you open up a portal, you actually see through the portal, it's like a camera feed on a texture/mesh.
At least that might help for the mirror part.
I think you have to do some tricks, for example, when going through a portal, you may have to disable collision on the wall object, and when you go through it, enable the collision again and move the player to the portal's destination.
I know it's not that helpful, just thought it might help.
I was thinking stencil buffer, it would look better
Answer by thornekey · Jan 10, 2014 at 01:28 PM
u just need a camera behind the player and the RenderToTexture.. to make it appear on the portal.
Thanks, but i know all of that. I got the rendering working but i need help getting smooth transitions through portals flawlessly like portal and portalizer. I'm stuck on that.
Your answer
![](https://koobas.hobune.stream/wayback/20220613130003im_/https://answers.unity.com/themes/thub/images/avi.jpg)