nah, just messing around. currently tryna get denoising to work properly before fixing other issues since the code for it was abysmally slow
(denoising the below image with the current algorithm took ~1 second. the old algorithm wouldve taken 40 minutes to denoise the same image)

i genuinely just disabled it for a while cause it was just that poorly written, it would individually add the rgb values of 4 pixels around the current one, average them out, then set each of those 4 pixels colours to each of their new corresponding colours and set the current one to all those averaged out
now it just adds all the colours at once and averages them out. somehow managed to speed it up by ~2400x
so it went from changing 5 pixels at once to 1
its like 1/3 the length too
OLD CODE:
function RAYTRACER.ColDENOISE(Fact : number, ScreenSize : Vector2, Iterations : IntValue)
local totalPixels = #PixelPool
for i = ScreenSize.X+1, totalPixels-(ScreenSize.X-1), RAYTRACER.RayTracerParameters.NumToBatch*2 do
task.spawn(function()
for j = i, math.min(i + (RAYTRACER.RayTracerParameters.NumToBatch*2) - 1, totalPixels) do
if Holder[j].BackgroundColor3 ~= Color3.new(0,0,0) then
local Pcol = Color3.new(
Holder[j].BackgroundColor3.R,
Holder[j].BackgroundColor3.G,
Holder[j].BackgroundColor3.B
)
local FadeColRt = Color3.new(
(Pcol.R + Holder[j + 1].BackgroundColor3.R)/2,
(Pcol.G + Holder[j + 1].BackgroundColor3.G)/2,
(Pcol.B + Holder[j + 1].BackgroundColor3.B)/2
)
local FadeColUp = Color3.new(
(Pcol.R + Holder[j - ScreenSize.X].BackgroundColor3.R)/2,
(Pcol.G + Holder[j - ScreenSize.X].BackgroundColor3.G)/2,
(Pcol.B + Holder[j - ScreenSize.X].BackgroundColor3.B)/2
)
local FadeColLf = Color3.new(
(Pcol.R + Holder[j - 1].BackgroundColor3.R)/2,
(Pcol.G + Holder[j - 1].BackgroundColor3.G)/2,
(Pcol.B + Holder[j - 1].BackgroundColor3.B)/2
)
local averaged = Color3.new(
(Pcol.R+FadeColRt.R+FadeColDN.R+FadeColUp.R+FadeColLf.R)/5,
(Pcol.G+FadeColRt.G+FadeColDN.G+FadeColUp.G+FadeColLf.G)/5,
(Pcol.B+FadeColRt.B+FadeColDN.B+FadeColUp.B+FadeColLf.B)/5
)
Holder[j].BackgroundColor3 = averaged
Holder[j - 1].BackgroundColor3 = FadeColLf
Holder[j + 1].BackgroundColor3 = FadeColRt
Holder[j - ScreenSize.X].BackgroundColor3 = FadeColUp
Holder[j + ScreenSize.X].BackgroundColor3 = FadeColDN
end
task.wait(1)
end
end)
end
end
NEW CODE:
function RAYTRACER.ColDENOISE(Fact : number, ScreenSize : Vector2, Iterations : IntValue)
local indexes = {}
local AveragedColours = {}
print(#PixelPool)
for i = ScreenSize.X+1, #PixelPool-ScreenSize.X do
local MyColour = PixelPool[i].BackgroundColor3
local UpColour = PixelPool[i-ScreenSize.X].BackgroundColor3
local DownColour = PixelPool[i+ScreenSize.X].BackgroundColor3
local LeftColour = PixelPool[i-1].BackgroundColor3
local RightColour = PixelPool[i+1].BackgroundColor3
local NewColour = Color3.new(
(MyColour.R + LeftColour.R + RightColour.R + UpColour.R + DownColour.R)/5,
(MyColour.G + LeftColour.G + RightColour.G + UpColour.G + DownColour.G)/5,
(MyColour.B + LeftColour.B + RightColour.B + UpColour.B + DownColour.B)/5
)
table.insert(AveragedColours, NewColour)
table.insert(indexes, i)
end
for j = 1, #indexes do
PixelPool[indexes[j]].BackgroundColor3 = AveragedColours[j]
end
table.clear(AveragedColours)
table.clear(indexes)
end
just some indexing issues to fix and itll be good
ill also need to get to commenting this 500 line monster of a module at some point which’ll be fun…