feat: post-effects array parameters & add gfx.posteffects.set_array & make shadows opacity depending on clouds opacity

This commit is contained in:
MihailRis
2025-06-14 20:06:05 +03:00
parent 02a91e0b72
commit 436a89b066
14 changed files with 223 additions and 78 deletions
+22 -4
View File
@@ -1,3 +1,25 @@
local function configure_SSAO()
local slot = gfx.posteffects.index("core:default")
gfx.posteffects.set_effect(slot, "ssao")
gfx.posteffects.set_intensity(slot, 1.0)
-- Generating random SSAO samples
local buffer = Bytearray(0)
for i = 0, 63 do
local x = math.random() * 2.0 - 1.0
local y = math.random() * 2.0 - 1.0
local z = math.random()
local len = math.sqrt(x * x + y * y + z * z)
if len > 0 then
x = x / len
y = y / len
z = z / len
end
Bytearray.append(buffer, byteutil.pack("fff", x, y, z))
end
gfx.posteffects.set_array(slot, "u_ssaoSamples", Bytearray_as_string(buffer))
end
function on_hud_open()
input.add_callback("player.pick", function ()
if hud.is_paused() or hud.is_inventory_open() then
@@ -55,8 +77,4 @@ function on_hud_open()
player.set_vel(pid, 0, 1, 0)
end
end)
local slot = gfx.posteffects.index("core:default")
gfx.posteffects.set_effect(slot, "ssao")
gfx.posteffects.set_intensity(slot, 1.0)
end