83 lines
2.9 KiB
Plaintext
83 lines
2.9 KiB
Plaintext
|
-- @ Version: SCREEN SPACE SHADERS - UPDATE 19
|
||
|
-- @ Description: Shadows script
|
||
|
-- @ Author: https://www.moddb.com/members/ascii1457
|
||
|
-- @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
|
||
|
|
||
|
-- Shadows
|
||
|
local ssfx_shadows_quality = 0
|
||
|
local ssfx_shadows_lod_min = 0
|
||
|
local ssfx_shadows_lod_max = 0
|
||
|
|
||
|
local ssfx_shadows_volumetric_res = 0;
|
||
|
local ssfx_shadows_volumetric = false
|
||
|
local ssfx_shadows_volumetric_int = 0
|
||
|
local ssfx_shadows_volumetric_quality = 0
|
||
|
|
||
|
function apply_shadows_settings()
|
||
|
|
||
|
get_console():execute("r2_ls_depth_bias -0.00005" )
|
||
|
get_console():execute("r2_ls_squality " .. ssfx_shadows_quality )
|
||
|
get_console():execute("ssfx_shadows (" .. ssfx_shadows_lod_min .. "," .. ssfx_shadows_lod_max .. ",0)")
|
||
|
|
||
|
get_console():execute("ssfx_volumetric (" .. (ssfx_shadows_volumetric and 1 or 0) .. "," .. ssfx_shadows_volumetric_int .. "," .. ssfx_shadows_volumetric_quality .. "," .. ssfx_shadows_volumetric_res .. ")")
|
||
|
|
||
|
end
|
||
|
|
||
|
function on_option_change()
|
||
|
|
||
|
-- Get settings
|
||
|
ssfx_shadows_quality = ssfx_001_mcm.ssfx_get_setting("shadows", "lod_quality", ssfx_shadows_settings)
|
||
|
ssfx_shadows_lod_min = ssfx_001_mcm.ssfx_get_setting("shadows", "lod_min", ssfx_shadows_settings)
|
||
|
ssfx_shadows_lod_max = ssfx_001_mcm.ssfx_get_setting("shadows", "lod_max", ssfx_shadows_settings)
|
||
|
|
||
|
ssfx_shadows_volumetric_res = ssfx_001_mcm.ssfx_get_setting("shadows", "volumetric_resolution", ssfx_shadows_settings)
|
||
|
ssfx_shadows_volumetric = ssfx_001_mcm.ssfx_get_setting("shadows", "volumetric_force", ssfx_shadows_settings)
|
||
|
ssfx_shadows_volumetric_int = ssfx_001_mcm.ssfx_get_setting("shadows", "volumetric_int", ssfx_shadows_settings)
|
||
|
ssfx_shadows_volumetric_quality = ssfx_001_mcm.ssfx_get_setting("shadows", "volumetric_quality", ssfx_shadows_settings)
|
||
|
|
||
|
-- Min resolution
|
||
|
if (ssfx_shadows_lod_min == 0) then
|
||
|
ssfx_shadows_lod_min = 128
|
||
|
elseif (ssfx_shadows_lod_min == 1) then
|
||
|
ssfx_shadows_lod_min = 256
|
||
|
elseif (ssfx_shadows_lod_min == 2) then
|
||
|
ssfx_shadows_lod_min = 512
|
||
|
elseif (ssfx_shadows_lod_min == 3) then
|
||
|
ssfx_shadows_lod_min = 768
|
||
|
elseif (ssfx_shadows_lod_min == 4) then
|
||
|
ssfx_shadows_lod_min = 1536
|
||
|
else
|
||
|
ssfx_shadows_lod_min = 768 -- Vanilla value
|
||
|
end
|
||
|
|
||
|
-- Max resolution
|
||
|
if (ssfx_shadows_lod_max == 0) then
|
||
|
ssfx_shadows_lod_max = 1536
|
||
|
elseif (ssfx_shadows_lod_max == 1) then
|
||
|
ssfx_shadows_lod_max = 2048
|
||
|
elseif (ssfx_shadows_lod_max == 2) then
|
||
|
ssfx_shadows_lod_max = 2560
|
||
|
elseif (ssfx_shadows_lod_max == 3) then
|
||
|
ssfx_shadows_lod_max = 3072
|
||
|
elseif (ssfx_shadows_lod_max == 4) then
|
||
|
ssfx_shadows_lod_max = 4096
|
||
|
else
|
||
|
ssfx_shadows_lod_max = 1536 -- Vanilla value
|
||
|
end
|
||
|
|
||
|
-- Volumetric resolution
|
||
|
ssfx_shadows_volumetric_res = 100.0 / ssfx_shadows_volumetric_res
|
||
|
|
||
|
-- Apply settings
|
||
|
apply_shadows_settings()
|
||
|
|
||
|
end
|
||
|
|
||
|
function on_game_start()
|
||
|
|
||
|
-- General Functions
|
||
|
RegisterScriptCallback("on_option_change", on_option_change)
|
||
|
|
||
|
-- Read and apply settigns
|
||
|
on_option_change()
|
||
|
end
|