Last active
August 13, 2025 02:45
-
-
Save Finchasaurus/cde9a1072b72c048c98cfd7c0465c967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local Players = game:GetService("Players") | |
| local RunService = game:GetService("RunService") | |
| local client = Players.LocalPlayer | |
| local camera = workspace.CurrentCamera | |
| local frame_size = UDim2.fromScale(0.025, 0.025) | |
| local screen_gui = Instance.new("ScreenGui") | |
| screen_gui.IgnoreGuiInset = true | |
| screen_gui.Parent = client.PlayerGui | |
| local cols = math.ceil(1 / frame_size.X.Scale) | |
| local rows = math.ceil(1 / frame_size.Y.Scale) | |
| local ascii_chars = { | |
| " ", ".", "`", "'", ",", ":", ";", "\"", "-", "_", | |
| "~", "^", "+", "=", "<", ">", "i", "!", "l", "I", | |
| "?", "/", "|", "\\", "(", ")", "1", "t", "f", "j", | |
| "r", "x", "n", "u", "v", "c", "z", "X", "Y", "U", | |
| "J", "C", "L", "Q", "0", "O", "Z", "m", "w", "q", | |
| "p", "d", "b", "k", "h", "a", "o", "*", "#", "M", | |
| "W", "&", "8", "%", "B", "@" | |
| } | |
| local frames = {} | |
| for row = 0, rows - 1 do | |
| frames[row] = {} | |
| for col = 0, cols - 1 do | |
| local label = Instance.new("TextLabel") | |
| label.Size = frame_size | |
| label.Position = UDim2.fromScale(col * frame_size.X.Scale, row * frame_size.Y.Scale) | |
| label.BackgroundColor3 = Color3.new(0,0,0) | |
| label.Text = "" | |
| label.TextColor3 = Color3.new(1,1,1) | |
| label.Font = Enum.Font.Code | |
| label.TextScaled = true | |
| label.Parent = screen_gui | |
| frames[row][col] = label | |
| end | |
| end | |
| local function color_to_brightness(color) | |
| return (0.2126 * color.R) + (0.7152 * color.G) + (0.0722 * color.B) | |
| end | |
| local function map_to_ascii(value) | |
| value = math.clamp(value, 0, 1) | |
| local idx = math.floor(value * (#ascii_chars - 1)) + 1 | |
| return ascii_chars[idx] | |
| end | |
| RunService.RenderStepped:Connect(function() | |
| local cam_cf = camera.CFrame | |
| local fov = math.rad(camera.FieldOfView) | |
| local aspect_ratio = cols / rows | |
| for row = 0, rows - 1 do | |
| for col = 0, cols - 1 do | |
| local x = (col / (cols - 1)) * 2 - 1 | |
| local y = (row / (rows - 1)) * 2 - 1 | |
| y = -y | |
| local dir = (cam_cf.LookVector + | |
| cam_cf.RightVector * x * math.tan(fov / 2) * aspect_ratio + | |
| cam_cf.UpVector * y * math.tan(fov / 2)).Unit | |
| local result = Workspace:Raycast(cam_cf.Position, dir * 500) | |
| local char = " " | |
| local color = Color3.new(1, 1, 1) | |
| if result then | |
| local mat_color = result.Instance.Color | |
| local color_brightness = color_to_brightness(mat_color) | |
| local dist_norm = math.clamp(result.Distance / 500, 0, 1) | |
| local dist_brightness = 1 - dist_norm | |
| local combined_brightness = color_brightness * dist_brightness | |
| char = map_to_ascii(combined_brightness) | |
| color = mat_color | |
| end | |
| frames[row][col].Text = char | |
| frames[row][col].TextColor3 = color | |
| end | |
| end | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment