Juaniitrox's Viewport Manager

This is Juaniitrox’s Viewport Manager

This module lets you create a ScreenGui model representation of any BasePart or Model in workspace and track said properties of the model, essentially highlighting it over any world/screen effect.

If given a character model it’s going to automatically implement accessory, body color, shirts and more.
This module does not support Layered Clothing, or hasn’t been made with the intention of working with it. It also just updates BaseParts inside models or BaseParts as its own

But why use this module? Or what to use it for?

This module is an incredibly performant way of utilizing viewportframes to highlight any basepart or model, mantaining constant 550fps on average on an empty place with a medium-high end PC.

This module allows you to make a 3d spatial representation of a world model, allowing you to place stuff such as characters or distinct map models on top of any “post-processing” done by roblox, you can make effects such as these:


Which include a color correction and the tracking of a character model in order to highlight it

Getting Started

To get started with the module we must first get it, to do so you may head towards the roblox marketplace to get the asset, you can do so by clicking here

Or you can download a Demo place i’ve made to show basic concepts of the viewport manager
ViewportManagerDemoPlace.rbxl (59.7 KB)

After we’ve gotten the module we shall require it by referencing it

local ViewportManager = require(Reference to module)

The parameters to create a new Viewport Instance are the next:

ViewportManager.new({
    Object: BasePart | Model, -- Object to Track/Copy
    RenderedProperties: {string}?, -- Properties of the original object to be replicated to the copy
    Parent: (ScreenGui | Frame)?, -- Parent of the ViewportFrame, if not given, one will be made
    GetModelDescendants: boolean?, -- Loop through all the models inside the given model
    ZIndex: number?, -- The Z-Index of the ViewportFrame holding the fake model
    Framerate: number?, -- The refresh rate at which the viewport model will update it's properties
    RenderPriority: (Enum.RenderPriority | number)?,
})

A few of the utilities in this module include:

Create a viewport frame model of any model descendant of workspace:

View Code
local ViewportManager = require(game.ReplicatedStorage.ViewportManager);
local Parts = workspace:WaitForChild('FloatingParts');

Parts:WaitForChild('Main');

local Handler = ViewportManager.new({
    Object = Parts,
})

Handler:Start()

Create a viewport frame model of any basepart descendant of workspace:

View Code
local ViewportManager = require(game.ReplicatedStorage.ViewportManager);
local Parts = workspace:WaitForChild('FloatingParts');

Parts:WaitForChild('Main');

local Handler = ViewportManager.new({
    Object = Parts.Main,
})

Handler:Start()

Change Framerate of Viewport tracking any object:

View Code
local ViewportManager = require(game.ReplicatedStorage.ViewportManager);

local Player = game.Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
Character:WaitForChild('Humanoid');

local Handler = ViewportManager.new({
    Object = Character,
    Framerate = 16,
})

Handler:Start();

for _, BasePart: BasePart in Character:GetDescendants() do
    if BasePart:IsA('BasePart') then
        BasePart.Transparency = 1;
    end
end


NOTE: The example shown may not look “low framerate”, but it’s at exactly 16 frames per second, the recording software just fills some gaps and removes the look of low framerate

Can update any property, an example utilizing properties CFrame and Size, by default only property updated is CFrame

View Code
local ViewportManager = require(game.ReplicatedStorage.ViewportManager);

local Player = game.Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
Character:WaitForChild('Humanoid');

local Handler = ViewportManager.new({
    Object = Character,
    RenderedProperties = {'CFrame', 'Size'};
})

Handler:Start();

Can freeze-frame of one instance properties utilizing the method :PlayOnce(FadeOptions)

View Code
local ViewportManager = require(game.ReplicatedStorage.ViewportManager);

local Player = game.Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
Character:WaitForChild('Humanoid');

local Handler = ViewportManager.new({
    Object = Character,
    RenderedProperties = {'CFrame', 'Size'};
})

while true do
    Handler:PlayOnce({
        Time = 0.5,
    });
    
    task.wait(0.25);
end

Models inside other models will by default not be taken for rendering inside the viewportmanager, but this can be changed by setting GetModelDescendants to true, this will recursively go through all models inside of the player. NOTE: THIS DOES NOT APPLY TO FOLDERS!

Here’s a clip to show the difference between GetModelDescendants set to true vs GetModelDescendants set to false.

NOTE: The parts showcased in this last gif are welded and parented directly to the character

This is a module i’ve made and used for my current project, there’s no need to credit me anywhere for this, just don’t claim as yours.

One of my goals is to add Camera relative positions, in order to make simple shots from any side of a Model/BasePart, as well as allowing for rotation of said.

I’ll be reading all suggestions posted under this post, feel free to suggest or notify me about any bugs regarding the module, thanks for the usage if you do!

Known Issues:

  • Type check error upon calling ViewportManager.new(), i’m working on it but it’s harmless as of now.
43 Likes

Fantastic resource! Incredibly performant and convenient solution that I plan on using for all of my future projects, thank you!

2 Likes

Regarding the framerate implementation, does this take into account viewports on devices with lower settings that automatically reduce framerate in viewports?

By default the Framerate property is set to unlimited, so it’s going to update at whatever framerate the device is by default.

Version 1.02

  • Added functionality to switch Z index in live rendering, call
Object:SwitchZIndex(number)
  • Added method to get the current viewport frame the model is being rendered in, call:
Object:GetViewportFrame()

Great job! I’ll be using this on my project.

1 Like

Version 1.04

  • Fixed a bug where parts inside of a basepart wouldn’t render the correct properties
1 Like