How to create a screen filter with a viewport frame

Hello, currently, I am trying to create a screen filter using viewport frames. I have managed to create the visual effect you can see in the picture below, I did so by using tree different viewport frames covering the entire screen that have a different Zindex, color and transparency inside which I have placed the same model with a different scale factor.
My goal is to make those viewports constantly project the effect only over the player in a similar way to how a highlight could constantly be projected over the player even as they move or similarly to a filter that only affects the player and nothing else. Unfortunately even after researching how most scripts for viewport frames work I could not pull this off. If anyone happens to know if this is even possible, or how I could achieve this, the help would be greatly appreciated



image

2 Likes

Hey! It sounds like you are looking for a way to copy over the cframe data of each body part of the player’s character to a rig in a viewport frame. What I would do is copy over the character(or use and apply the appearance data) the first time they spawn. Then, using a RunService.RenderStepped loop, you can update the CFrame of each part of the model over to the character.

2 Likes

you’d probably have to make a localscript and put it in that screengui with something like

local Runservice = game:GetService("RunService")

local ScreenGui = script.Parent
local player = ScreenGui.Parent.Parent
local BlueRig = ScreenGui.Blue.Rig
local GreenRig = ScreenGui.Green.Rig

Runservice.RenderStepped:Connect(function()
BlueRig.CFrame = player.CFrame
GreenRig.CFrame = player.CFrame
end)

this doesn’t seem that that good of a solution though

2 Likes

Yes, that wouldn’t necessarily work. You would need to “update the CFrame of each part of the model”. That could be accomplished using a for loop on all the parts in the character and finding the related part that is a child under the rig in the viewport frame.

2 Likes

oh yeah, i forgot about that
then you’re also basically forget to use R15 packages instead of R30 if you want the game not to lag like crazy, right?

2 Likes

OP could replicate the entire character, depending on how they are using the effect in game they might want to copy over all of the accessories in addition to the R15 character. If Rthro is not desired due to slightly higher part counts, then restrict players from it and only allow R15/R6 characters. Fully up to OP, but CFraming on the client won’t make a huge difference.

1 Like

Thank you for your help, I think I begin get an idea of what both of you are suggesting when you say that I would have to refresh the Cframes of all body parts of the rigs in the viewports, however I also thought of something that might work as an alternative. I have managed to find videos of people displaying their character moving in smaller viewports such as this one

so perhaps I could mimic something similar to this with all tree of my viewports and swaping the camera that is stuck in place with the one bound to my character in order to avoid making my game unplayable. However, since I am still new to making scripts that work with viewports and that Idea I got might not work, could any of you please give me an example of how I would use the seemingly simpler solution that you are suggesting. Also since it might help here is the link to another post were I give an example of how I would like to use this visual effect in case it might help

1 Like

Hello again I managed to create a script that has the filter constantly displayed above my character but I don’t really know how to make it show the animations that my character is performing so it would be great if you could help out with that part or perhaps tell me were I might be able to find more information regarding animtions in viewports, still here is a picture. I haven’t made the script apply to all tree filters yet because I would like to figure out the animation part first.


local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local gui = script.Parent
local frame = gui.Blue
local uis = game:GetService(“UserInputService”)
local toggle = false

uis.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.One then
toggle = true

	char.Archivable = true

	game:GetService("RunService").RenderStepped:Connect(function()
		
	
		frame.WorldModel:ClearAllChildren()
		local camera = game.Workspace.CurrentCamera:Clone()
		frame.CurrentCamera = camera
		camera.Parent = frame.WorldModel

		local ClonedChar = char:Clone()
		ClonedChar.Parent = script.Parent.Blue.WorldModel

		frame.CurrentCamera.CameraType = Enum.CameraType.Scriptable
		task.wait()
	end)



end

end)

Hello, again I have managed to complete the scripting part of the effect here are pictures of the result

And here is the free model containing the scripts viewports and instructions

create.roblox.com

Creator Hub - Store

Discover millions of assets made by the Roblox community to accelerate any creation task.

After following the instructions, you are free to delete the part that contained them, since it is not necessary for the effect to work and is just a container. I forgot to mention that in the instructions, so I decided to write it down here. The effect is applicable to your character by default, so you will have to modify it to target anything else. Also unfortunately even tho the characters in the reference pictures appeared as id they were glowing the viewport frames which are what I used to create the effect are not able to render any light. You can change the thickness of the blue and greeen outline to your liking as well as how swolly the drag behind you, so long as you follow the instructions. Thank you for visiting the post

Also here is a link to the original post I made showing the refference pictures

1 Like

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