Uploaded January 2022 | Updated November 2026, 13 hours ago
this is infact raytraced! I am shooting rays from the camera for every pixel! (I'm using my own lighting and shadow calculations)
sadly the performance is absolutely awful..
heres the script if you want it:
local minscale = 20
local maxscale = 10
local scale = minscale --basically this is kind of like how low the res is, so 1 would be your screen res and 2 would be half that
local Fov = LocalPlayer():GetFOV()*0.97 --fov
local SunDir = Vector(1, 1, 1):GetNormalized()
local light = LocalPlayer():GetEyeTrace().Entity
local scrw
local scrh
local fwd = {}
local function calculateForward(scale)
scrw = ScrW() / scale - 1
scrh = ScrH() / scale - 1
for y = 0, scrh do
fwd[y] = {}
for x = 0, scrw do
local coeff = math.tan((Fov / 2) * (3.1416 / 180)) * 2.71828;
fwd[y][x] = Vector(
1,
((scrw - x) / (scrw - 1) - 0.5) * coeff,
(coeff / scrw) * (scrh - y) - 0.5 * (coeff / scrw) * (scrh - 1)
):GetNormalized()
end
end
end
calculateForward(scale)
local oldEyeAngles = Angle()
local oldEyePos = Vector()
hook.Add("HUDPaint","Paint",function()
local eyePos = EyePos()
local eyeAngles = EyeAngles()
local notmoved = (eyeAngles == oldEyeAngles and eyePos == oldEyePos)
if notmoved and scale ~= maxscale then
scale = math.max(math.floor(scale / 1.5), maxscale)
calculateForward(scale)
elseif not notmoved and scale ~= minscale then
scale = minscale
calculateForward(scale)
end
for y = 0, scrh do
for x = 0, scrw do
local dir = Vector(fwd[y][x][1], fwd[y][x][2], fwd[y][x][3])
dir:Rotate(eyeAngles)
local r = util.QuickTrace(eyePos, dir * 99999, LocalPlayer())
if r.HitSky then continue end
local shadow = util.QuickTrace(r.HitPos, SunDir * 99999).HitSky
local lightDist = light:GetPos():DistToSqr(r.HitPos)
local lightTrace = util.QuickTrace(r.HitPos, (light:GetPos() - r.HitPos) * 99999)
local addlight = lightTrace.Entity == light
local addedLight = 0
if addlight then
addedLight = 1 / (light:GetPos():DistToSqr(r.HitPos)) * 5000
end
local addedLighting = (shadow and 1 or 0.5) + (addlight and addedLight or 0)
surface.SetDrawColor(((Vector(0.5, 0.5, 0.5) + r.HitNormal * Vector(0.5, 0.5, 0.5)) * addedLighting):ToColor())
surface.DrawRect(x * scale, y * scale, scale, scale)
end
end
oldEyeAngles = eyeAngles
oldEyePos = eyePos
if input.IsKeyDown(KEY_PAD_0) then
hook.Remove("HUDPaint","Paint")
hook.Remove("CalcView", "void")
print("Removing hooks...")
end
end)
this is infact raytraced! I am shooting rays from the camera for every pixel! (I'm using my own lighting and shadow calculations)
sadly the performance is absolutely awful..
heres the script if you want it:
local minscale = 20
local maxscale = 10
local scale = minscale --basically this is kind of like how low the res is, so 1 would be your screen res and 2 would be half that
local Fov = LocalPlayer():GetFOV()*0.97 --fov
local SunDir = Vector(1, 1, 1):GetNormalized()
local light = LocalPlayer():GetEyeTrace().Entity
local scrw
local scrh
local fwd = {}
local function calculateForward(scale)
scrw = ScrW() / scale - 1
scrh = ScrH() / scale - 1
for y = 0, scrh do
fwd[y] = {}
for x = 0, scrw do
local coeff = math.tan((Fov / 2) * (3.1416 / 180)) * 2.71828;
fwd[y][x] = Vector(
1,
((scrw - x) / (scrw - 1) - 0.5) * coeff,
(coeff / scrw) * (scrh - y) - 0.5 * (coeff / scrw) * (scrh - 1)
):GetNormalized()
end
end
end
calculateForward(scale)
local oldEyeAngles = Angle()
local oldEyePos = Vector()
hook.Add("HUDPaint","Paint",function()
local eyePos = EyePos()
local eyeAngles = EyeAngles()
local notmoved = (eyeAngles == oldEyeAngles and eyePos == oldEyePos)
if notmoved and scale ~= maxscale then
scale = math.max(math.floor(scale / 1.5), maxscale)
calculateForward(scale)
elseif not notmoved and scale ~= minscale then
scale = minscale
calculateForward(scale)
end
for y = 0, scrh do
for x = 0, scrw do
local dir = Vector(fwd[y][x][1], fwd[y][x][2], fwd[y][x][3])
dir:Rotate(eyeAngles)
local r = util.QuickTrace(eyePos, dir * 99999, LocalPlayer())
if r.HitSky then continue end
local shadow = util.QuickTrace(r.HitPos, SunDir * 99999).HitSky
local lightDist = light:GetPos():DistToSqr(r.HitPos)
local lightTrace = util.QuickTrace(r.HitPos, (light:GetPos() - r.HitPos) * 99999)
local addlight = lightTrace.Entity == light
local addedLight = 0
if addlight then
addedLight = 1 / (light:GetPos():DistToSqr(r.HitPos)) * 5000
end
local addedLighting = (shadow and 1 or 0.5) + (addlight and addedLight or 0)
surface.SetDrawColor(((Vector(0.5, 0.5, 0.5) + r.HitNormal * Vector(0.5, 0.5, 0.5)) * addedLighting):ToColor())
surface.DrawRect(x * scale, y * scale, scale, scale)
end
end
oldEyeAngles = eyeAngles
oldEyePos = eyePos
if input.IsKeyDown(KEY_PAD_0) then
hook.Remove("HUDPaint","Paint")
hook.Remove("CalcView", "void")
print("Removing hooks...")
end
end)










