ViewportFrame Release

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

Although now released, there is still no support for Terrain as mentioned in another thread - so a rendered world will look peculiar if it includes smooth terrain. Can we get an update on this?

4 Likes

Good point, I hope that support for lightning and skybox is added soon, alongside Terrain.

2 Likes

I feel just allowing us to render the whole terrain that is in the workspace could be a bad idea (Especially for performance). However it would be nice if we could insert a secondary terrain instance within the viewport.

3 Likes

Agreed, inserting the entire Terrain object could result in lag/rendering issues, however, you should be able to do this still, or, insert specific regions of Terrain for your map - so that it does not look weird.

1 Like

The thing is, if the developer chooses to render terrain at the expense of performance, it was their choice. Adding support for terrain does not necessarily mean it has to used.

2 Likes

This is a great update! :smiley:

1 Like

Now that it’s live, I can finally start working on character customization.

1 Like

Hi developers,

As you may have already noticed, ViewportFrames are live on all platforms! All credit goes to @programeow for making this happen.

Feel free to post screenshots or videos of how you are using ViewportFrames in your game. We will be showcasing some of the best examples for all players to see in the next few weeks!

56 Likes

I’m using it to give a 3D preview of buildings players can build in my game:

54 Likes

I’m using viewport frames to create a stylized outline effect


EDIT: might as well dump my other use cases for viewport frames
Custom handles
aw
HUD Icons (not the most creative but still cool)
aw

80 Likes

This is the most creative use I have seen so far! Nice job!

4 Likes