ViewportFrame Release

It does work with surfaceguis, but not if the surfacegui is directly inside of workspace.
To make it work with surfaceguis, just set its adornee to whatever object you want it to render on :slight_smile:

As zeuxcg said here:

2 Likes

There are already a lot of advanced and creative uses for ViewportFrames (of course I’m going to try out the popular TARDIS effect eventually), but I’m looking to at least implement it as a photo-taking feature.

10 Likes

That’s actually pretty neat. Didn’t actually think of using it like that.

2 Likes

Not yet, the viewport frames don’t support custom shaders and without them it looks really weird and ruins the effect

1 Like

How did you manage the Tardis effect exactly? I tried exactly what you did, but somehow, just panning my camera makes the part move.

Edit:
NVM, I solved it.

1 Like

I tried doing portals with SurfaceGUI’s too. I tried all sorts of things, but I always get distortion if I walk from side to side. I did manage to make the center line seemless though.

This is due to perspective I believe. The part of the surface closer to you will appear larger, which distorts the image.

Compensating for that distortion is impossible without shaders, as you would need to compress the part of the image closer to you.

If anyone is planning to make Portals, I recommend you watch this video, it practically tells you exactly how to make portals.

12 Likes

Could you elaborate on how you cropped the GUI using glass? I’ve been trying all sorts of combinations, but without success.

Edit:
Wow, you are getting a lot of attention for the portals. Nice job!

Also, how did you make it possible to walk through it like that?

You should check out https://www.youtube.com/watch?v=_SmPR5mvH7w

It explains what you should have to make a portal work, excellent video. Essentially, you need perfect timing…

1 Like

Can not wait when this will be available in game :heart:

5 Likes

I cant wait until we can change the shaders of the viewport frame! i just wonder what this example using rays to reflect off of this mirror and then return the color would look like with a viewport frameimage

9 Likes

This seems to be live in non-Studio.

7 Likes

Can confirm, showing in my game THANK YOU ROBLOX, BEST FEATURE EVER

4 Likes

Is that considered raycasting? :thinking:

4 Likes

Yes, I can also confirm it is

Same here, I’m pumped to see it working :slight_smile:

My game will be releasing sooner than expected, I guess!

You’re correct that it’s not possible to make a proper perspective portal with a SurfaceGui. But a custom shader to correct the distortion is not how you’d normally it this either, you’d do it by simply masking the portal camera’s view in screen space with the quad that’s the screen space projection of the portal rect.

A couple people have mentioned above the idea of trying to use a non-orthonormal camera CFrame to correct the perspective. Let me save any of you who are considering this a few hours of frustration: it can’t be done. The inverse of the model-view-projection transform you would need cannot be represented by a CFrame. Not only that, there is no CFrame you can multiply the view matrix by to manipulate the camera’s projection transform to be the required “back projection” transform. The projection transform is a full 4x4 matrix whose 4th row, 4th column entry is zero. But the inverse of a projection matrix has a non-zero value in this position, which for a typical projection transform will be ∝(Zfar - Znear) / (2 * Znear^2 * Zfar - 2 * Znear * Zfar^2). The last (4th) row of a CFrame is always 0,0,0,1 so there is no way for a CFrame multiplication to put a non-zero value into this element of the view-projection transform matrix! This is not exactly what the value will be in Roblox, since Znear and Zfar are internally swapped, but this is an implementation detail that is irrelevant here.

8 Likes

Thank you! You worded my argument better than I ever could!

1 Like

Np!

FWIW, ViewportFrames weren’t going to be the magic bullet for portals anyways, as they don’t fully support the same lighting conditions as the regular world view, and can’t show things like smooth terrain. Also… copy of the world parented to a UI frame… that’s a performance non-starter right there.

1 Like

I am aware, the portals won’t move, so I only have to grab the portion of the world that is visible, and parent it to the viewport frame.

As for the lighting issues, I don’t really mind them, since it is still better than not having the portal render at all.

I will link your reply on: How do I crop/mask a billboard GUI over a surface?
People keep telling me to use SurfaceGui’s.

1 Like