local W=game:GetService("\080\108\097\121\101\114\115")local T do local W,X=pcall(function()return(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\080\111\112\112\101\114\099\097\109\076\111\111\115\101\079\112\097\099\105\116\121\084\104\114\101\115\104\111\108\100")end)T=W and X end local X=game.Workspace.CurrentCamera local Q=math.min local t=math.tan local G=math.rad local J=math.huge local d=Ray.new local function E(W,T)for T=#W,T+1,-1 do W[T]=nil end end local K,I,R do local function W()local W=G(X.FieldOfView)local T=X.ViewportSize local Q=T.X/T.Y R=2*t(W/2)I=Q*R end;(X:GetPropertyChangedSignal("\070\105\101\108\100\079\102\086\105\101\119")):Connect(W);(X:GetPropertyChangedSignal("\086\105\101\119\112\111\114\116\083\105\122\101")):Connect(W)W()K=X.NearPlaneZ;(X:GetPropertyChangedSignal("\078\101\097\114\080\108\097\110\101\090")):Connect(function()K=X.NearPlaneZ end)end local g={}do local T={}local function X()local W=1 g={}for T,X in pairs(T)do g[W]=X W=W+1 end end local function Q(W)local function Q(Q)T[W]=Q X()end local function t()T[W]=nil X()end W.CharacterAdded:Connect(Q)W.CharacterRemoving:Connect(t)if W.Character then Q(W.Character)end end local function t(W)T[W]=nil X()end W.PlayerAdded:Connect(Q)W.PlayerRemoving:Connect(t)for W,T in ipairs(W:GetPlayers())do Q(T)end X()end


local Players = game:GetService('Players')

local FFlagUserPoppercamLooseOpacityThreshold do
	local success, enabled = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserPoppercamLooseOpacityThreshold")
	end)
	FFlagUserPoppercamLooseOpacityThreshold = success and enabled
end

local camera = game.Workspace.CurrentCamera

local min = math.min
local tan = math.tan
local rad = math.rad
local inf = math.huge
local ray = Ray.new

local function eraseFromEnd(t, toSize)
	for i = #t, toSize + 1, -1 do
		t[i] = nil
	end
end

local nearPlaneZ, projX, projY do
	local function updateProjection()
		local fov = rad(camera.FieldOfView)
		local view = camera.ViewportSize
		local ar = view.X/view.Y

		projY = 2*tan(fov/2)
		projX = ar*projY
	end

	camera:GetPropertyChangedSignal('FieldOfView'):Connect(updateProjection)
	camera:GetPropertyChangedSignal('ViewportSize'):Connect(updateProjection)

	updateProjection()

	nearPlaneZ = camera.NearPlaneZ
	camera:GetPropertyChangedSignal('NearPlaneZ'):Connect(function()
		nearPlaneZ = camera.NearPlaneZ
	end)
end

local blacklist = {} do
	local charMap = {}

	local function refreshIgnoreList()
		local n = 1
		blacklist = {}
		for _, character in pairs(charMap) do
			blacklist[n] = character
			n = n + 1
		end
	end

	local function playerAdded(player)
		local function characterAdded(character)
			charMap[player] = character
			refreshIgnoreList()
		end
		local function characterRemoving()
			charMap[player] = nil
			refreshIgnoreList()
		end

		player.CharacterAdded:Connect(characterAdded)
		player.CharacterRemoving:Connect(characterRemoving)
		if player.Character then
			characterAdded(player.Character)
		end
	end

	local function playerRemoving(player)
		charMap[player] = nil
		refreshIgnoreList()
	end

	Players.PlayerAdded:Connect(playerAdded)
	Players.PlayerRemoving:Connect(playerRemoving)

	for _, player in ipairs(Players:GetPlayers()) do
		playerAdded(player)
	end
	refreshIgnoreList()
end
