Fullscreen BillboardGui without flickering/lagging

Hello! Following my previous post, there’s an issue with approach I decied to follow.
When I update BillboardGui’s position like this:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local ScreenGui = Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
local BillboardGui = script.Parent

RunService.PreRender:Connect(function()
	local camera = workspace.CurrentCamera
	local adornee = BillboardGui.Adornee :: BasePart
	BillboardGui.Size = UDim2.fromOffset(ScreenGui.AbsoluteSize.X, ScreenGui.AbsoluteSize.Y)
	adornee.Position = camera.CFrame:PointToWorldSpace(Vector3.new(0, 0, -64))
end)

It flickers and doesn’t always cover up the entire screen (because for some reason it takes some time for Roblox to move the adornee). How can I fix this or are there any workarounds?

But why do you insist on displaying a white screen like that? If it’s not necessary, why not just display it with PlayerGui?

I’m trying to recreate the effect shown here: How To Outline Objects [New Method] + Outlines Through Walls

How about using Highlight instead?

It has 31 instance limit, that sadly isn’t enough for me

If 31 Highlight instances are not enough, why not make it more efficient by adding objects on the client and deleting them after a certain distance?

Maybe that could work, but still there can be more than 31 parts on the screen

Okay, I got it. Then I will focus on how to solve current issue.

Then how about using RenderStepped function instead of PreRender function?

I tried all functions that are available, but sadly this lag is still present more or less. I’m thinking about using SurfaceGuis instead and manually aligning the required parts.

Hi.

This is likely due to how Roblox’s engine defers processes.
BillboardGui instances are also fairly expensive and thus could take more time to process depending on the complexity, so I suspect that these two facts combined are the likely cause for your delay.

I recently implemented a custom chat system in which I built my own bubbles using BillboardGui instances as well, which came with similar challenges.

I’m not sure what alternative or fix I can suggest for you, but I’d like to emphasize again that rendering BillboardGui instances is not cheap. If you’re deadset on using them, do it in moderation or be smart on when and how many are displayed on screen at a time. Surpassing the 31 number you mentioned is already starting to become quite a lot.

1 Like

Instead of moving the adornee part manually every frame, don’t use an adornee at all. Parent the BillboardGui directly to Camera.

Wow, I didn’t know you could do that, thanks!

1 Like

Thanks for your response! Are SurfaceGuis faster than BillboardGuis? What if I use them instead to align the objects as I need?

I wouldn’t say that. Both are rendering 2D UI in 3D space and they’re not the same as decals or textures because again, they’re UI.
As I haven’t ran into scenarios so far where they’re necessary, I don’t know all that much about them.
I can imagine UIs are constantly being (re)processed in real-time whereas textures are largely memory based?
I would personally only use SurfaceGui instances if the graphics needed to be interactable with the player, because that’s what they’re for.

1 Like

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