|
local UEHelpers = require("UEHelpers") |
|
|
|
local GetKismetSystemLibrary = UEHelpers.GetKismetSystemLibrary |
|
|
|
local ksl = GetKismetSystemLibrary() |
|
local engine = FindFirstOf("Engine") |
|
|
|
local canExecute = true |
|
local init = false |
|
|
|
-- mod settings, change these to your liking |
|
local HDROut = false -- Enable 10bit HDR Output |
|
local antiAliasingMode = 'tsr' -- Supports, "disabled", "fxaa" and "tsr". To use game default TAA set to nil (without the ''). 'tsr' breaks some viewports |
|
local texturesPoolMB = 6144 -- Pool for textures in mb. |
|
local sharpenTonemapper = 0.7 -- A value between 0.5 to 1.0 is recommended. 10.0 is the maximum. To use default settings set to nil (without the ''). |
|
local anisotropicFiltering = 16 -- Supports values, 0, 2, 4, 8, 16. Game default is 8. To use default settings set to nil (without the '') |
|
local lowShaderQuality = false -- Low shader quality. |
|
local disableShadows = false -- Disable all shadows, skips story to the end. |
|
local disableEyeAdaptation = false -- Disables eye adaptation/auto exposure. |
|
local disableSSAO = false -- Disables Screen Space Ambient Occlussion. |
|
local disableBloom = false -- Disables bloom. |
|
local disableSSR = false -- Disables Screen Space Reflections. |
|
local hybridReflections = false -- Uses SSR where RT is applicable. |
|
local forceRTeverywhere = true -- Enables Ray Traced Reflections on all levels. |
|
local disableFog = false -- Disables Fog. |
|
local disableDof = false -- Disables Depth of Field. |
|
local disableMotionBlur = false -- Disables Motion Blur. |
|
local disableLensFlare = false -- Disables Lens Flare. |
|
local disableStreaming = true -- Disables textures streaming. Loads all texture assets on level load to reduce CPU overhead with a cost of memory usage. |
|
local enablePSOPrecomp = true -- Enables shader permutations precompilation on game load to avoid #stutterstruggle. Will cause interruptions on level changes. |
|
|
|
-- Atlus plz fix your fuckin PC port |
|
-- We are waiting for a hotfix: 22 days |
|
-- from now on do not touch |
|
|
|
--- @param cmd string |
|
function ExecCmd(cmd) |
|
if not ksl:IsValid() then |
|
error("KismetSystemLibrary not valid\n") |
|
end |
|
|
|
ExecuteInGameThread(function() |
|
ksl:ExecuteConsoleCommand( |
|
engine, |
|
cmd, |
|
nil |
|
) |
|
end) |
|
end |
|
|
|
function Init() |
|
if init then |
|
return |
|
end |
|
|
|
init = true |
|
LoopAsync(500, function() |
|
if HDROut == true then |
|
ExecCmd("r.AllowHDR 1") |
|
ExecCmd("r.HDR.EnableHDROutput 1") |
|
ExecCmd("r.HDR.Display.OutputDevice 3") |
|
ExecCmd("r.HDR.Display.ColorGamut 4") |
|
ExecCmd("r.HDR.UI.CompositeMode 1") |
|
ExecCmd("r.HDR.UI.Level 1") |
|
end |
|
if antiAliasingMode == 'fxaa' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 1") |
|
ExecCmd("r.PostProcessAAQuality 4") |
|
elseif antiAliasingMode == 'tsr' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 2") |
|
ExecCmd("r.PostProcessAAQuality 4") |
|
ExecCmd("r.TemporalAA.Upsampling 1") |
|
ExecCmd("r.TemporalAA.Algorithm 1") |
|
elseif antiAliasingMode == 'disabled' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 0") |
|
ExecCmd("r.PostProcessAAQuality 0") |
|
end |
|
if texturesPoolMB ~= nil then |
|
local command = 'r.Streaming.PoolSize '..tostring(texturesPoolMB) |
|
ExecCmd(command) |
|
end |
|
if sharpenTonemapper ~= nil then |
|
local command = 'r.Tonemapper.Sharpen '..tostring(sharpenTonemapper) |
|
ExecCmd(command) |
|
end |
|
if anisotropicFiltering ~= nil then |
|
local command = 'r.MaxAnisotropy '..tostring(anisotropicFiltering) |
|
ExecCmd(command) |
|
end |
|
if lowShaderQuality == true then |
|
ExecCmd("r.RefractionQuality 0") |
|
ExecCmd("r.DetailMode 0") |
|
ExecCmd("r.TranslucencyVolumeBlur 0") |
|
ExecCmd("r.MaterialQualityLevel 0") |
|
end |
|
if disableEyeAdaptation == true then |
|
ExecCmd("r.EyeAdaptationQuality 0") |
|
end |
|
if disableSSAO == true then |
|
ExecCmd("r.AmbientOcclusionLevels 0") |
|
end |
|
if forceRTeverywhere == true then |
|
ExecCmd("r.RayTracing.Reflections 1") |
|
end |
|
if hybridReflections == true then |
|
ExecCmd("r.RayTracing.Reflections.Hybrid 1") |
|
end |
|
if disableBloom == true then |
|
ExecCmd("r.BloomQuality 0") |
|
end |
|
if disableSSR == true then |
|
ExecCmd("r.SSR 0") |
|
end |
|
if disableFog == true then |
|
ExecCmd("r.Fog 0") |
|
ExecCmd("r.VolumetricFog 0") |
|
end |
|
if disableDof == true then |
|
ExecCmd("r.DepthOfFieldQuality 0") |
|
end |
|
if disableMotionBlur == true then |
|
ExecCmd("r.MotionBlurQuality 0") |
|
end |
|
if disableLensFlare == true then |
|
ExecCmd("r.LensFlareQuality 0") |
|
end |
|
if disableStreaming == true then |
|
ExecCmd("r.TextureStreaming 0") |
|
end |
|
if disableShadows == true then |
|
ExecCmd("r.ShadowQuality 0") |
|
ExecCmd("r.Shadow.CSM.MaxCascades 0") |
|
ExecCmd("r.Shadow.MaxResolution 0") |
|
ExecCmd("r.Shadow.RadiusThreshold 0") |
|
ExecCmd("r.Shadow.DistanceScale 0") |
|
ExecCmd("r.Shadow.CSM.TransitionScale 0") |
|
end |
|
if enablePSOPrecomp == true then |
|
ExecCmd("r.CreateShadersOnLoad 1") |
|
ExecCmd("niagara.CreateShadersOnLoad 1") |
|
end |
|
return false |
|
end) |
|
end |
|
|
|
function ExecuteDelayedFix() |
|
if not canExecute then |
|
return |
|
end |
|
|
|
Init() |
|
|
|
canExecute = false |
|
|
|
local delay = 50 |
|
|
|
while delay < 500 do |
|
ExecuteWithDelay(delay, function() |
|
if HDROut == true then |
|
ExecCmd("r.AllowHDR 1") |
|
ExecCmd("r.HDR.EnableHDROutput 1") |
|
ExecCmd("r.HDR.Display.OutputDevice 3") |
|
ExecCmd("r.HDR.Display.ColorGamut 4") |
|
ExecCmd("r.HDR.UI.CompositeMode 1") |
|
ExecCmd("r.HDR.UI.Level 1") |
|
end |
|
if antiAliasingMode == 'fxaa' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 1") |
|
ExecCmd("r.PostProcessAAQuality 4") |
|
elseif antiAliasingMode == 'tsr' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 2") |
|
ExecCmd("r.PostProcessAAQuality 4") |
|
ExecCmd("r.TemporalAA.Upsampling 1") |
|
ExecCmd("r.TemporalAA.Algorithm 1") |
|
elseif antiAliasingMode == 'disabled' then |
|
ExecCmd("r.DefaultFeature.AntiAliasing 0") |
|
ExecCmd("r.PostProcessAAQuality 0") |
|
end |
|
if texturesPoolMB ~= nil then |
|
local command = 'r.Streaming.PoolSize '..tostring(texturesPoolMB) |
|
ExecCmd(command) |
|
end |
|
if sharpenTonemapper ~= nil then |
|
local command = 'r.Tonemapper.Sharpen '..tostring(sharpenTonemapper) |
|
ExecCmd(command) |
|
end |
|
if anisotropicFiltering ~= nil then |
|
local command = 'r.MaxAnisotropy '..tostring(anisotropicFiltering) |
|
ExecCmd(command) |
|
end |
|
if lowShaderQuality == true then |
|
ExecCmd("r.RefractionQuality 0") |
|
ExecCmd("r.DetailMode 0") |
|
ExecCmd("r.TranslucencyVolumeBlur 0") |
|
ExecCmd("r.MaterialQualityLevel 0") |
|
end |
|
if disableEyeAdaptation == true then |
|
ExecCmd("r.EyeAdaptationQuality 0") |
|
end |
|
if disableSSAO == true then |
|
ExecCmd("r.AmbientOcclusionLevels 0") |
|
end |
|
if forceRTeverywhere == true then |
|
ExecCmd("r.RayTracing.Reflections 1") |
|
end |
|
if hybridReflections == true then |
|
ExecCmd("r.RayTracing.Reflections.Hybrid 1") |
|
end |
|
if disableBloom == true then |
|
ExecCmd("r.BloomQuality 0") |
|
end |
|
if disableSSR == true then |
|
ExecCmd("r.SSR 0") |
|
end |
|
if disableFog == true then |
|
ExecCmd("r.Fog 0") |
|
ExecCmd("r.VolumetricFog 0") |
|
end |
|
if disableDof == true then |
|
ExecCmd("r.DepthOfFieldQuality 0") |
|
end |
|
if disableMotionBlur == true then |
|
ExecCmd("r.MotionBlurQuality 0") |
|
end |
|
if disableLensFlare == true then |
|
ExecCmd("r.LensFlareQuality 0") |
|
end |
|
if disableStreaming == true then |
|
ExecCmd("r.TextureStreaming 0") |
|
end |
|
if disableShadows == true then |
|
ExecCmd("r.ShadowQuality 0") |
|
ExecCmd("r.Shadow.CSM.MaxCascades 0") |
|
ExecCmd("r.Shadow.MaxResolution 0") |
|
ExecCmd("r.Shadow.RadiusThreshold 0") |
|
ExecCmd("r.Shadow.DistanceScale 0") |
|
ExecCmd("r.Shadow.CSM.TransitionScale 0") |
|
end |
|
if enablePSOPrecomp == true then |
|
ExecCmd("r.CreateShadersOnLoad 1") |
|
ExecCmd("niagara.CreateShadersOnLoad 1") |
|
end |
|
canExecute = true |
|
end) |
|
delay = delay * 2 |
|
end |
|
end |
|
|
|
NotifyOnNewObject("/Script/Engine.Level", function() |
|
ExecuteDelayedFix() |
|
end) |
thanks bro, spent a lot of time to search this solution to improve P3R performance on my overheating gaming laptop. Just added some new lines and my videocard W goes brrr: 75W -> ~40W