ViewportFrame Release

A viewport is a “region of the screen used to display a portion of the total image to be shown”. That is the definition of a viewport in 3D graphics and it clearly explains that a viewport is just simply a rasterisation of your 3D scene from the viewpoint of a rectangle, or put it simply, just one of your cameras.

A “RenderTexture” is just a feature present in Unity which should rather be called a “ViewportTexture”, since that is exactly what it does. It takes an image generated by a viewport and wraps it around a mesh of your choice.

My solution will still allow you to isolate a specific object by parenting it to the ViewportFrame itself just like we can right now. What I’m saying is that you should be able to select models already present in the Workspace as well, especially since what most stuff people are trying to use it for is already present in the game, so there is no need to clone it. This way, you have a double use for the same class: being able to show a specific model on the screen without having to clone it, as well as being able to add a 2nd camera to your screen.

As for the performance issues almost everyone is screaming about. What stops the developers from creating an insanely over-complicated and laggy implementation by constantly updating the CFrame of the wanted model, especially characters? Nothing! I did it and I might use it in my games just for the sake of being able to do this without any alternatives.

3 Likes

Wow, that open up a lot of new possibilities. So, is it possible to take a “CCTV” system that can get uploaded to a third-party website and viewed online since it creates texture for rendering?

The problem is that the “textures” are still objects, but if you manage to store data for each frame, then yes. I recommend setting up when objects appear and tweening them using a set of values it tables of some sort.

You can’t access texture data (as in, the colors of the pixels themselves), so no.

How exactly do you make it “take a photo”? And also I seem to be the only one who can’t make SurfaceGui and BillboardGui ViewportFrames render anything at all

You have to place the SurfaceGui in the PlayerGui/StarterGui and set its adornee to the Part you want to render it on.

2 Likes

Wow thanks a lot! I don’t think I would have found that out on my own. Would you also know how to “take a picture” like in the post?

The way ViewportFrames work is that they render whatever is parented to them. To take a picture, just clone whatever you want to be static and it will stay that way, unless you move it with a script.

Also, forgot to add that you have to create a new Camera and copy your current camera’s CFrame to it. Set the ViewportFrame’s CurrentCamera value to the new camera and then you’re done.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.