local O=game:GetService("\080\108\097\121\101\114\115")local w do local O,h=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)w=O and h end local h=game.Workspace.CurrentCamera local M=math.min local j=math.tan local i=math.rad local B=math.huge local C=Ray.new local function X(O)return 1-(1-O.Transparency)*(1-O.LocalTransparencyModifier)end local function m(O,w)for w=#O,w+1,-1 do O[w]=nil end end local e,I,r do local function O()local O=i(h.FieldOfView)local w=h.ViewportSize local M=w.X/w.Y r=2*j(O/2)I=M*r end;(h:GetPropertyChangedSignal("\070\105\101\108\100\079\102\086\105\101\119")):Connect(O);(h:GetPropertyChangedSignal("\086\105\101\119\112\111\114\116\083\105\122\101")):Connect(O)O()e=h.NearPlaneZ;(h:GetPropertyChangedSignal("\078\101\097\114\080\108\097\110\101\090")):Connect(function()e=h.NearPlaneZ end)end local l={}do local w={}local function h()local O=1 l={}for w,h in pairs(w)do l[O]=h O=O+1 end end local function M(O)local function M(M)w[O]=M h()end local function j()w[O]=nil h()end O.CharacterAdded:Connect(M)O.CharacterRemoving:Connect(j)if O.Character then M(O.Character)end end local function j(O)w[O]=nil h()end O.PlayerAdded:Connect(M)O.PlayerRemoving:Connect(j)for O,w in ipairs(O:GetPlayers())do M(w)end h()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 getTotalTransparency(part)
	return 1 - (1 - part.Transparency)*(1 - part.LocalTransparencyModifier)
end

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
