Re-Creating a Portal Effect,

Now you’re playing with portals.

4 Likes

I was reading this post for quite a while now, and what you have done is incredible, and the next thing I see is this:

29 Likes

This seems cool! I saw the game, Great work guys!

2 Likes

I found a bug.
If you leave the game, your character will not be removed by the view point frame. And some characters don’t have their appearences.
Edit: I am pasting this example. Warning: This picture may not be suitable for all audiences.

12 Likes

Also, if the character gets too far away from the portal their clothes disappear.

2 Likes

Yeah. I should have posted the other side. Ima do so now. Same warning as before


What is actually on the other side:

1 Like

So I was playing around with the portals. I tried to do the infinite fall to see what would happen. it did not turn out good xD.

3 Likes

That is pretty easy actually but last time I made that, I had a speed mirage then my character started glitching because I was moving at a crazy speed!!!

1 Like

I love that you took on this challenge. One thing that bugs me is the fact that in portal, someone standing halfway between two portals is appears to be in both locations. However in your game and the video, you’re on whatever side the center is on, making it appear like part of your arm is missing. Other than that, great job.

Absolutely awesome stuff, especially the camera’s ability to go through whilst remaining on the other side.

1 Like

Love it, but this is going on. As I know this is a WIP, it shouldn’t be much of an issue but i just wanted to put it out there for you to maybe fix later. I replicated this by standing inside the actual block :slight_smile:

3 Likes

Wow! Awesome portal. Thanks for making this.

2 Likes
13 Likes

Roblox doesn’t quite give much control on customizing Viewports mainly because of the graphical processing power required which is unfortunate but it’s a price developers pay to be on a platform with millions of free games for mostly kids on usually slower PC’s.

4 Likes

This bug could easily be fixed by Removing other Characters when they are removed and when a player leaves the game.

It’s just not coded into the Demo

I somewhat fixed loose ends on your script. Allowing for multiple viewports, freezing the viewport, either parts (characters, workspace, etc) and the camera. Not updating viewports not in the camera, of course, this aspect doesnt account for parts covering it, so it isnt perfect. and some other things that make this much easier to understand and code for.

I plan to add some more features, at the current moment i dont think i have addinitems working, although i havent tried yet. I also didnt add character removing/adding when the players leave/join.

Updated Mirror Test.rbxl (34.1 KB)

The module has a comment in it describing each function in it. Read it and experiment.
The camera feature isnt added. Please dont ask for this, somehow add it yourself, ill figure a way to do it if i want to.

I added the character system. Now characters will be removed when a player leaves, and added when a player joins. I also added the :Modify() function, as i didnt do so before. One last thing i did was fix up the rendering to disable easier, without it overwrite a bind action, so you can have many viewport objects at once without it bugging or something.
Also added some cool testing keybinds.

holding F will freeze the viewport, but not cam. To freeze cam too, hold shift while holding F. Letting go of F with shift pressed will resume the viewport but with no camera updates. Otherwise camera will be unfroze.
Pressing Q will set the viewport to the original part, while pressing E will change the viewport. Pressing L will delete the portal viewport on the side… This i used to test the destory method.

[Upd] Updated Mirror Test.rbxl (35.1 KB)

20 Likes

I had nothing better to do yesterday than dig up my own portal experiment from last summer and see if I could find a workaround for the CFrame limitations I encountered with my original homography-based approach. Turns out, there is a way that doesn’t require the full 4x4 projection matrix to be correct, on account of the flattening to 2D. So I solved it like a 3x3 homogeneous system, and it works pretty well (crude demo file attached).

Pros of this approach:

  • No scaling or translation of the ViewportFrame on the SurfaceGui, it’s always just sized to the gui: UDim2 of (0,1,0,1)
  • Full ViewportFrame pixel resolution is always rendered (1024 x 1024 in my example place) because there is no cropping
  • Less distortion when close-up (though not zero, because of resampling and hard 1024x1024 limit** (see notes below)

Cons:

  • Way more calculation per frame, because gnarlier underlying mathematics.
  • Resulting camera CFrame is not orthonormal. This is not 100% guaranteed to be future proof since CFrames expect the 3x3 matrix to be a valid orthonormal rotation matrix.

** If you were really ambitious, you could dynamically-resize the SurfaceGui itself to only be as large as need to fill the main camera view, and squeeze out a little more pixel resolution that way, at the expense of having to work out a whole other layer of translation and scaling :slight_smile:

I present the proof of concept place as a demo hacked together on a Sunday afternoon with no expectation of it being a clean, optimized, or properly-generalized solution for any portal shape or orientation, only for its academic value and further inspiration.

Portal_Demo.rbxl (24.9 KB)

21 Likes

I think there’s a possible glitch with the portal. For some reason, when I was in the portal testing, the other side of the portal showed some of the player characters on the other side without some of their body parts, or some of their accessories or clothing missing. This has happened to me on both sides of the portal, and has happened when I zoomed out right into the portal’s way and saw the entire other end. This doesn’t happen with all player characters. Some of the characters, including mine, have been fully seen properly with all body parts. Other than that, thanks for making the portal, it is amazing among what I have seen before!
image

This guy figured how how to make a portal without using ViewPortFrame. I’m not sure how it works exactly but it looks pretty cool. It’s uncopylocked for anyone who wants to check it out.

8 Likes

I’ve seen this done a few times before. I’ll give you a hint: There’s a reason the floors, walls, and ceiling are all comprised of tiny parts, a reason the frame of the portal is so thick, and a reason the camera is locked to a certain distance from your character.

2 Likes