Decompiled source of Outward UE5 Overhaul v1.6.2
plugins/OutwardUE5Overhaul.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using OutwardUE5Overhaul.Pipeline; using OutwardUE5Overhaul.Presets; using OutwardUE5Overhaul.UI; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityStandardAssets.ImageEffects; using uNature.Core.FoliageClasses; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace OutwardUE5Overhaul { [BepInPlugin("com.argon.outward.ue5overhaul", "Outward UE5 Graphics Overhaul (2026 Edition)", "1.6.2")] public class OutwardUE5OverhaulPlugin : BaseUnityPlugin { public const string GUID = "com.argon.outward.ue5overhaul"; public const string NAME = "Outward UE5 Graphics Overhaul (2026 Edition)"; public const string VERSION = "1.6.2"; private ConfigEntry<UE5PresetType> _cfgPreset; private ConfigEntry<KeyCode> _cfgStudioHotkey; private ConfigEntry<KeyCode> _cfgABToggleHotkey; private ConfigEntry<float> _cfgExposureOffset; private ConfigEntry<float> _cfgLightRangeMult; private ConfigEntry<float> _cfgIndoorAmbientBoost; private ConfigEntry<float> _cfgShadowDistance; private ConfigEntry<float> _cfgTextureMipBias; private ConfigEntry<bool> _cfgEnableDoF; private ConfigEntry<bool> _cfgEnableMotionBlur; private ConfigEntry<bool> _cfgBorderlessAltTabProtection; private UE5PresetType _currentPresetType; private UE5PresetType _lastNonVanillaPreset; private UE5RenderProfile _activeProfile; private bool _isOverhaulEnabled = true; private Harmony _harmony; private bool _wasLoadingDone; private bool _wasInInterior; private bool _isAppFocused = true; private float _focusSafeTime; public static OutwardUE5OverhaulPlugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public LumenGIEngine LumenEngine { get; private set; } public VSMShadowAndAOEngine ShadowAOEngine { get; private set; } public UE5PostProcessEngine PostProcessEngine { get; private set; } public VolumetricSkyAndWaterEngine SkyWaterEngine { get; private set; } public NaniteAndPBRMaterialEngine NanitePBREngine { get; private set; } public UE5StudioWindow StudioUI { get; private set; } public UE5RenderProfile ActiveProfile => _activeProfile; public UE5PresetType CurrentPresetType => _currentPresetType; public bool IsOverhaulEnabled { get { if (_isOverhaulEnabled) { return _currentPresetType != UE5PresetType.Vanilla_Original; } return false; } } public bool IsD3D11FocusSafe { get { if (_isAppFocused && Application.isFocused) { return Time.unscaledTime >= _focusSafeTime; } return false; } } private void Awake() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; InitConfig(); EnsureBorderlessFullscreenSafeMode(); LumenEngine = new LumenGIEngine(); ShadowAOEngine = new VSMShadowAndAOEngine(); PostProcessEngine = new UE5PostProcessEngine(); SkyWaterEngine = new VolumetricSkyAndWaterEngine(); NanitePBREngine = new NaniteAndPBRMaterialEngine(); StudioUI = new UE5StudioWindow(); _currentPresetType = _cfgPreset.Value; if (_currentPresetType != UE5PresetType.Vanilla_Original) { _lastNonVanillaPreset = _currentPresetType; } _activeProfile = UE5VisualPresets.GetPreset(_currentPresetType); SyncConfigOverridesToProfile(); _harmony = new Harmony("com.argon.outward.ue5overhaul"); ApplyHarmonyPatches(); SceneManager.sceneLoaded += OnSceneLoaded; Log.LogInfo((object)string.Format("[{0} v{1}] Initialized! Active Preset: {2}. Press {3} for UE5 Studio UI, {4} for Instant Vanilla A/B Toggle.", "Outward UE5 Graphics Overhaul (2026 Edition)", "1.6.2", _activeProfile.Name, _cfgStudioHotkey.Value, _cfgABToggleHotkey.Value)); } private void InitConfig() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown _cfgPreset = ((BaseUnityPlugin)this).Config.Bind<UE5PresetType>("1. Preset & Controls", "VisualPreset", UE5PresetType.UE5_Lumen_Nanite_2026, "Select the overall Unreal Engine 5 (2026) visual preset."); _cfgStudioHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1. Preset & Controls", "StudioUIHotkey", (KeyCode)291, "Hotkey to open/close the in-game Unreal Engine 5 Graphics Studio live tuning window."); _cfgABToggleHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1. Preset & Controls", "InstantVanillaABToggleHotkey", (KeyCode)292, "Hotkey to instantly toggle between UE5 2026 Overhaul and Vanilla graphics mid-game."); _cfgBorderlessAltTabProtection = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Preset & Controls", "BorderlessAltTabProtection", true, "Automatically use DXGI Flip-Model Borderless Fullscreen (FullScreenWindow) instead of ExclusiveFullScreen to prevent D3D11 driver crashes when Alt-Tabbing or pressing Print Screen."); _cfgExposureOffset = ((BaseUnityPlugin)this).Config.Bind<float>("2. Quick Tuning", "PostExposureOffset", 0.15f, new ConfigDescription("ACES Filmic Post-Exposure offset (EV).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1.2f), new object[0])); _cfgLightRangeMult = ((BaseUnityPlugin)this).Config.Bind<float>("2. Quick Tuning", "PointLightRangeMultiplier", 1.65f, new ConfigDescription("Point, Lava & Spot Light Range Multiplier (Light Carry across valleys, interiors, and streets).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2.5f), new object[0])); _cfgIndoorAmbientBoost = ((BaseUnityPlugin)this).Config.Bind<float>("2. Quick Tuning", "IndoorAmbientBoost", 0.08f, new ConfigDescription("UE5 Lumen Indoor Room Ambient GI Boost.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.7f), new object[0])); _cfgShadowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("2. Quick Tuning", "ShadowDistance", 280f, new ConfigDescription("4-Cascade Directional Shadow Distance (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 450f), new object[0])); _cfgTextureMipBias = ((BaseUnityPlugin)this).Config.Bind<float>("2. Quick Tuning", "TextureMipMapBias", -0.32f, new ConfigDescription("World Texture MipMap Bias (-0.32 = 4K Neural Ray-Reconstruction Clarity, 0.0 = Vanilla).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 0f), new object[0])); _cfgEnableDoF = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Quick Tuning", "EnableDynamicAutofocusDoF", false, "Enable Dynamic Raycast Autofocus Physical Bokeh Depth of Field."); _cfgEnableMotionBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Quick Tuning", "EnableMotionBlur", false, "Enable Per-Frame Shutter Camera Motion Blur."); _cfgPreset.SettingChanged += delegate { LoadPreset(_cfgPreset.Value); }; _cfgExposureOffset.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.PostExposureOffset = _cfgExposureOffset.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; _cfgLightRangeMult.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.PointLightRangeMultiplier = _cfgLightRangeMult.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; _cfgIndoorAmbientBoost.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.IndoorAmbientBoost = _cfgIndoorAmbientBoost.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; _cfgShadowDistance.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.ShadowDistance = _cfgShadowDistance.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; _cfgTextureMipBias.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.TextureMipMapBias = _cfgTextureMipBias.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: true); } }; _cfgEnableDoF.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.EnableDynamicAutofocusDoF = _cfgEnableDoF.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; _cfgEnableMotionBlur.SettingChanged += delegate { if (_activeProfile != null) { _activeProfile.EnableMotionBlur = _cfgEnableMotionBlur.Value; ApplyAllGraphicsImmediate(includeHeavyMaterialScan: false); } }; } private void EnsureBorderlessFullscreenSafeMode() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (_cfgBorderlessAltTabProtection != null && _cfgBorderlessAltTabProtection.Value && Screen.fullScreen && (int)Screen.fullScreenMode == 0) { Screen.fullScreenMode = (FullScreenMode)1; } } private void OnApplicationFocus(bool hasFocus) { _isAppFocused = hasFocus; if (hasFocus) { _focusSafeTime = Time.unscaledTime + 0.5f; EnsureBorderlessFullscreenSafeMode(); } } private void SyncConfigOverridesToProfile() { if (_activeProfile != null && _currentPresetType != UE5PresetType.Vanilla_Original) { _activeProfile.PostExposureOffset = _cfgExposureOffset.Value; _activeProfile.PointLightRangeMultiplier = _cfgLightRangeMult.Value; _activeProfile.IndoorAmbientBoost = _cfgIndoorAmbientBoost.Value; _activeProfile.ShadowDistance = _cfgShadowDistance.Value; _activeProfile.TextureMipMapBias = _cfgTextureMipBias.Value; _activeProfile.EnableDynamicAutofocusDoF = _cfgEnableDoF.Value; _activeProfile.EnableMotionBlur = _cfgEnableMotionBlur.Value; } } public void SaveProfileToConfig() { if (_activeProfile != null) { _cfgPreset.Value = _currentPresetType; _cfgExposureOffset.Value = _activeProfile.PostExposureOffset; _cfgLightRangeMult.Value = _activeProfile.PointLightRangeMultiplier; _cfgIndoorAmbientBoost.Value = _activeProfile.IndoorAmbientBoost; _cfgShadowDistance.Value = _activeProfile.ShadowDistance; _cfgTextureMipBias.Value = _activeProfile.TextureMipMapBias; _cfgEnableDoF.Value = _activeProfile.EnableDynamicAutofocusDoF; _cfgEnableMotionBlur.Value = _activeProfile.EnableMotionBlur; ((BaseUnityPlugin)this).Config.Save(); } } public void LoadPreset(UE5PresetType preset) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) _currentPresetType = preset; if (preset != UE5PresetType.Vanilla_Original) { _lastNonVanillaPreset = preset; _isOverhaulEnabled = true; } else { _isOverhaulEnabled = false; } _activeProfile = UE5VisualPresets.GetPreset(preset); ApplyAllGraphicsImmediate(includeHeavyMaterialScan: true); if (StudioUI != null) { StudioUI.ShowToast($"UE5 Preset Loaded: {_activeProfile.Name} [{_cfgStudioHotkey.Value}: Studio UI | {_cfgABToggleHotkey.Value}: A/B Toggle]"); } } public void ToggleVanillaABComparison() { if (_currentPresetType != UE5PresetType.Vanilla_Original) { _lastNonVanillaPreset = _currentPresetType; LoadPreset(UE5PresetType.Vanilla_Original); } else { LoadPreset(_lastNonVanillaPreset); } } private void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!IsD3D11FocusSafe) { return; } if (StudioUI != null) { StudioUI.UpdateMetrics(); } if (Input.GetKeyDown(_cfgStudioHotkey.Value)) { StudioUI.ToggleWindow(); } if (Input.GetKeyDown(_cfgABToggleHotkey.Value)) { ToggleVanillaABComparison(); } if ((Object)(object)NetworkLevelLoader.Instance != (Object)null) { bool isOverallLoadingDone = NetworkLevelLoader.Instance.IsOverallLoadingDone; if (isOverallLoadingDone && !_wasLoadingDone) { _wasLoadingDone = true; ((MonoBehaviour)this).StartCoroutine(DelayedFullSceneOverhaulRoutine(0.6f)); } else if (!isOverallLoadingDone) { _wasLoadingDone = false; } } Camera activeGameplayCamera = LumenGIEngine.GetActiveGameplayCamera(); if ((Object)(object)activeGameplayCamera != (Object)null && _activeProfile != null) { bool flag = LumenGIEngine.IsCameraInInterior(activeGameplayCamera); if (flag != _wasInInterior) { _wasInInterior = flag; LumenEngine.ApplyAtmosphereGI(_activeProfile); RefreshAllActiveCameras(_activeProfile); } } if (_activeProfile != null && _activeProfile.EnableDynamicAutofocusDoF) { PostProcessEngine.UpdateDynamicAutofocus(_activeProfile); } } private void OnGUI() { if (IsD3D11FocusSafe && StudioUI != null) { StudioUI.OnGUI(this); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { EnsureBorderlessFullscreenSafeMode(); ((MonoBehaviour)this).StartCoroutine(DelayedFullSceneOverhaulRoutine(0.5f)); ((MonoBehaviour)this).StartCoroutine(DelayedFullSceneOverhaulRoutine(2f)); } private IEnumerator DelayedFullSceneOverhaulRoutine(float delaySeconds) { yield return (object)new WaitForSecondsRealtime(delaySeconds); while (!IsD3D11FocusSafe) { yield return null; } ApplyAllGraphicsImmediate(includeHeavyMaterialScan: true); } public void ApplyAllGraphicsImmediate(bool includeHeavyMaterialScan) { if (_activeProfile == null || !IsD3D11FocusSafe) { return; } try { EnsureBorderlessFullscreenSafeMode(); ShadowAOEngine.ApplyGlobalShadowSettings(_activeProfile); SkyWaterEngine.ApplySkyAndAtmosphere(_activeProfile); LumenEngine.ApplyAtmosphereGI(_activeProfile); LumenEngine.ApplySceneLightsOverhaul(_activeProfile); NanitePBREngine.ApplyNaniteWorldAndFoliage(_activeProfile); SkyWaterEngine.ApplyWaterOverhaul(_activeProfile); RefreshAllActiveCameras(_activeProfile); if (includeHeavyMaterialScan) { NanitePBREngine.ApplyPBRMaterialsAndTextures(_activeProfile); } } catch (Exception ex) { Log.LogWarning((object)("[OutwardUE5Overhaul] ApplyAllGraphicsImmediate warning: " + ex.Message)); } } public void RefreshAllActiveCameras(UE5RenderProfile profile) { if (profile == null || !IsD3D11FocusSafe) { return; } CameraQuality[] array = Object.FindObjectsOfType<CameraQuality>(); if (array == null) { return; } foreach (CameraQuality val in array) { if (!((Object)(object)val == (Object)null)) { ApplySingleCameraOverhaul(val, profile); } } } public void ApplySingleCameraOverhaul(CameraQuality cq, UE5RenderProfile profile) { if (!((Object)(object)cq == (Object)null) && profile != null && IsD3D11FocusSafe) { ShadowAOEngine.ApplyCameraShadowAndAO(cq, profile); PostProcessEngine.ApplyCameraPostProcessing(cq, profile); SkyWaterEngine.ApplyCameraVolumetricsAndSSR(cq, profile); } } private void ApplyHarmonyPatches() { try { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; Type typeFromHandle = typeof(CameraQuality); PatchMethod(typeFromHandle.GetMethod("Start", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_CameraQuality_Refresh", bindingAttr)); PatchMethod(typeFromHandle.GetMethod("RefreshQuality", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_CameraQuality_Refresh", bindingAttr)); PatchMethod(typeFromHandle.GetMethod("RefreshBrightness", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_CameraQuality_Refresh", bindingAttr)); PatchMethod(typeFromHandle.GetMethod("DelayedEnabledSSShadows", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_CameraQuality_Refresh", bindingAttr)); Type typeFromHandle2 = typeof(EnvironmentConditions); PatchMethod(typeFromHandle2.GetMethod("UpdateAtmosphere", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_EnvironmentConditions_UpdateAtmosphere", bindingAttr)); PatchMethod(typeof(LightQuality).GetMethod("Start", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_LightQuality_InitLightSettings", bindingAttr)); PatchMethod(typeof(LightQuality).GetMethod("InitLightSettings", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_LightQuality_InitLightSettings", bindingAttr)); PatchMethod(typeof(TerrainQualityManager).GetMethod("ProcessQuality", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_TerrainQuality_ProcessQuality", bindingAttr)); PatchMethod(typeof(TerrainMeshQualityManager).GetMethod("ProcessQuality", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_TerrainQuality_ProcessQuality", bindingAttr)); PatchMethod(typeof(WaterQuality).GetMethod("ProcessQuality", bindingAttr), null, typeof(OutwardUE5OverhaulPlugin).GetMethod("Postfix_WaterQuality_ProcessQuality", bindingAttr)); } catch (Exception ex) { Log.LogError((object)("[OutwardUE5Overhaul] Failed applying Harmony patches: " + ex)); } } private void PatchMethod(MethodInfo target, MethodInfo prefix, MethodInfo postfix) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!(target == null)) { HarmonyMethod val = ((!(prefix != null)) ? ((HarmonyMethod)null) : new HarmonyMethod(prefix)); HarmonyMethod val2 = ((!(postfix != null)) ? ((HarmonyMethod)null) : new HarmonyMethod(postfix)); _harmony.Patch((MethodBase)target, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void Postfix_CameraQuality_Refresh(CameraQuality __instance) { if (!((Object)(object)Instance == (Object)null) && Instance.IsD3D11FocusSafe && Instance.ActiveProfile != null && !((Object)(object)__instance == (Object)null)) { Instance.ApplySingleCameraOverhaul(__instance, Instance.ActiveProfile); } } private static void Postfix_EnvironmentConditions_UpdateAtmosphere() { if (!((Object)(object)Instance == (Object)null) && Instance.IsD3D11FocusSafe && Instance.ActiveProfile != null) { Instance.LumenEngine.ApplyAtmosphereGI(Instance.ActiveProfile); } } private static void Postfix_LightQuality_InitLightSettings(LightQuality __instance) { if (!((Object)(object)Instance == (Object)null) && Instance.IsD3D11FocusSafe && Instance.ActiveProfile != null && !((Object)(object)__instance == (Object)null)) { Instance.LumenEngine.ProcessLightQualityInstance(__instance, Instance.ActiveProfile); } } private static void Postfix_TerrainQuality_ProcessQuality() { if (!((Object)(object)Instance == (Object)null) && Instance.IsD3D11FocusSafe && Instance.ActiveProfile != null) { Instance.NanitePBREngine.ApplyNaniteWorldAndFoliage(Instance.ActiveProfile); } } private static void Postfix_WaterQuality_ProcessQuality() { if (!((Object)(object)Instance == (Object)null) && Instance.IsD3D11FocusSafe && Instance.ActiveProfile != null) { Instance.SkyWaterEngine.ApplyWaterOverhaul(Instance.ActiveProfile); } } } } namespace OutwardUE5Overhaul.Pipeline { public class LumenGIEngine { private struct CachedLightQualityProps { public Vector2 EnabledDistances; } private readonly Dictionary<int, float> _cachedLightRanges = new Dictionary<int, float>(); private readonly Dictionary<int, CachedLightQualityProps> _cachedLightQualities = new Dictionary<int, CachedLightQualityProps>(); private readonly FieldInfo _fiLQLight; private readonly FieldInfo _fiLQEnabledDistSqr; private bool _hasTrueVanillaAmbient; private Color _trueVanillaAmbientLight = new Color(0.25f, 0.25f, 0.28f, 1f); private Color _lastAppliedSkyColor = new Color(-1f, -1f, -1f, -1f); public LumenGIEngine() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; _fiLQLight = typeof(LightQuality).GetField("m_light", bindingAttr); _fiLQEnabledDistSqr = typeof(LightQuality).GetField("m_enabledDistancesSqr", bindingAttr); } public static bool IsCameraInInterior(Camera cam) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cam == (Object)null) { cam = GetActiveGameplayCamera(); } if ((Object)(object)cam == (Object)null) { return false; } Vector3 position = ((Component)cam).transform.position; if (position.y < -150f) { return true; } try { if ((Object)(object)InteriorArea.GetInterior(position) != (Object)null) { return true; } } catch { } return false; } public void RecordVanillaAmbientIfChanged() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Color ambientLight = RenderSettings.ambientLight; if ((!_hasTrueVanillaAmbient || !ColorsApproxEqual(ambientLight, _lastAppliedSkyColor)) && (((Color)(ref ambientLight)).maxColorComponent > 0.005f || !_hasTrueVanillaAmbient)) { _trueVanillaAmbientLight = ambientLight; _hasTrueVanillaAmbient = true; } } public void ApplyAtmosphereGI(UE5RenderProfile profile) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) if (profile == null) { return; } RecordVanillaAmbientIfChanged(); if (!profile.EnableLumenGI) { RenderSettings.ambientMode = (AmbientMode)3; if (_hasTrueVanillaAmbient) { RenderSettings.ambientLight = _trueVanillaAmbientLight; } RenderSettings.reflectionIntensity = 1f; return; } Camera activeGameplayCamera = GetActiveGameplayCamera(); bool flag = IsCameraInInterior(activeGameplayCamera); Color trueVanillaAmbientLight = _trueVanillaAmbientLight; Color fogColor = RenderSettings.fogColor; float num = 0f; float num2 = 0f; if ((Object)(object)EnvironmentConditions.Instance != (Object)null) { num = Mathf.Clamp01(EnvironmentConditions.Instance.SnowQuantity); num2 = Mathf.Clamp01(EnvironmentConditions.Instance.AutumnLerp); } if (flag) { float num3 = 1f + Mathf.Clamp(profile.IndoorAmbientBoost, 0f, 0.5f); Color val = ClampHDRColor(trueVanillaAmbientLight * num3, 0.85f); Color ambientEquatorColor = ClampHDRColor(trueVanillaAmbientLight * (num3 * 0.96f), 0.85f); Color ambientGroundColor = ClampHDRColor(trueVanillaAmbientLight * (num3 * 0.88f), 0.75f); RenderSettings.ambientMode = (AmbientMode)1; RenderSettings.ambientSkyColor = val; RenderSettings.ambientEquatorColor = ambientEquatorColor; RenderSettings.ambientGroundColor = ambientGroundColor; RenderSettings.reflectionIntensity = 0.3f; _lastAppliedSkyColor = val; } else { Color c = trueVanillaAmbientLight * profile.SkyBounceIntensity; Color val2 = Color.Lerp(trueVanillaAmbientLight, (((Color)(ref fogColor)).maxColorComponent > 0.05f) ? fogColor : trueVanillaAmbientLight, 0.15f); Color c2 = val2 * profile.EquatorBounceIntensity; Color val3 = Color.Lerp(new Color(0.96f, 0.92f, 0.86f, 1f), new Color(0.98f, 0.9f, 0.82f, 1f), num2); Color val4 = default(Color); ((Color)(ref val4))..ctor(0.98f, 0.99f, 1.02f, 1f); Color val5 = Color.Lerp(val3, val4, num); Color c3 = trueVanillaAmbientLight * val5 * profile.GroundBounceIntensity; Color val6 = ClampHDRColor(c, 1.35f); RenderSettings.ambientMode = (AmbientMode)1; RenderSettings.ambientSkyColor = val6; RenderSettings.ambientEquatorColor = ClampHDRColor(c2, 1.3f); RenderSettings.ambientGroundColor = ClampHDRColor(c3, 1.15f); RenderSettings.reflectionIntensity = Mathf.Clamp(profile.ReflectionSpecularityBoost, 0.5f, 1.25f); _lastAppliedSkyColor = val6; } } public void ApplySceneLightsOverhaul(UE5RenderProfile profile) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 if (profile == null) { return; } QualitySettings.pixelLightCount = (profile.EnableLumenGI ? 32 : 4); LightQuality[] array = Object.FindObjectsOfType<LightQuality>(); if (array != null) { foreach (LightQuality val in array) { if ((Object)(object)val != (Object)null) { ProcessLightQualityInstance(val, profile); } } } Light[] array2 = Object.FindObjectsOfType<Light>(); if (array2 == null) { return; } foreach (Light val2 in array2) { if (!((Object)(object)val2 == (Object)null) && (int)val2.type != 1) { UpgradePointOrSpotLightRangeOnly(val2, profile); } } } public void ProcessLightQualityInstance(LightQuality lq, UE5RenderProfile profile) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Invalid comparison between Unknown and I4 if (!((Object)(object)lq == (Object)null) && profile != null) { int instanceID = ((Object)lq).GetInstanceID(); if (!_cachedLightQualities.TryGetValue(instanceID, out var value)) { value = new CachedLightQualityProps { EnabledDistances = lq.EnabledDistances }; _cachedLightQualities[instanceID] = value; } float num = (profile.EnableLumenGI ? Mathf.Max(2.2f, profile.PointLightRangeMultiplier * 1.5f) : 1f); float x = value.EnabledDistances.x; float y = value.EnabledDistances.y; float num2 = ((!(x > 0f)) ? x : (profile.EnableLumenGI ? Mathf.Max(45f, x * num) : x)); float num3 = ((!(y > 0f)) ? y : (profile.EnableLumenGI ? Mathf.Max(30f, y * num) : y)); float num4 = ((num2 > 0f) ? (num2 * num2) : (-1f)); float num5 = ((num3 > 0f) ? (num3 * num3) : (-1f)); if (_fiLQEnabledDistSqr != null) { _fiLQEnabledDistSqr.SetValue(lq, (object)new Vector2(num4, num5)); } Light val = (Light)((_fiLQLight != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)lq).GetComponent<Light>())); if ((Object)(object)val != (Object)null && (int)val.type != 1) { UpgradePointOrSpotLightRangeOnly(val, profile); } } } private void UpgradePointOrSpotLightRangeOnly(Light light, UE5RenderProfile profile) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (!((Object)(object)light == (Object)null) && (int)light.type != 1) { int instanceID = ((Object)light).GetInstanceID(); if (!_cachedLightRanges.TryGetValue(instanceID, out var value)) { value = light.range; _cachedLightRanges[instanceID] = value; } if (!profile.EnableLumenGI) { light.range = value; return; } float num = Mathf.Clamp(profile.PointLightRangeMultiplier, 1f, 2.5f); light.range = Mathf.Max(value, Mathf.Clamp(value * num, 1f, 2500f)); } } public static Camera GetActiveGameplayCamera() { if (CharacterCamera.CharCamList != null && CharacterCamera.CharCamList.Count > 0) { CharacterCamera val = CharacterCamera.CharCamList[0]; if ((Object)(object)val != (Object)null && (Object)(object)val.CameraScript != (Object)null) { return val.CameraScript; } } return Camera.main; } private static bool ColorsApproxEqual(Color a, Color b) { if (Mathf.Abs(a.r - b.r) < 0.002f && Mathf.Abs(a.g - b.g) < 0.002f) { return Mathf.Abs(a.b - b.b) < 0.002f; } return false; } private static Color ClampHDRColor(Color c, float maxChannel) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) c.r = Mathf.Clamp(c.r, 0f, maxChannel); c.g = Mathf.Clamp(c.g, 0f, maxChannel); c.b = Mathf.Clamp(c.b, 0f, maxChannel); c.a = 1f; return c; } } public class NaniteAndPBRMaterialEngine { private struct CachedMaterialProps { public bool HasBumpScale; public float BumpScale; public bool HasDetailBumpScale; public float DetailBumpScale; public bool HasGlossiness; public float Glossiness; public bool HasGlossMapScale; public float GlossMapScale; public bool HasSmoothness; public float Smoothness; public bool HasOcclusionStrength; public float OcclusionStrength; } private struct CachedTextureProps { public float MipMapBias; public int AnisoLevel; } private readonly Dictionary<int, CachedMaterialProps> _cachedMaterials = new Dictionary<int, CachedMaterialProps>(); private readonly Dictionary<int, CachedTextureProps> _cachedTextures = new Dictionary<int, CachedTextureProps>(); private readonly FieldInfo _fiTMQMLodDistances; private readonly FieldInfo _fiTMQMBaseLodDistances; private static readonly string[] TexturePropNames = new string[16] { "_MainTex", "_BumpMap", "_DetailAlbedoMap", "_DetailNormalMap", "_MetallicGlossMap", "_SpecGlossMap", "_OcclusionMap", "_ParallaxMap", "_Splat0", "_Splat1", "_Splat2", "_Splat3", "_Normal0", "_Normal1", "_Normal2", "_Normal3" }; public NaniteAndPBRMaterialEngine() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; _fiTMQMLodDistances = typeof(TerrainMeshQualityManager).GetField("m_sqrLodDistances", bindingAttr); _fiTMQMBaseLodDistances = typeof(TerrainMeshQualityManager).GetField("BASE_LOD_DISTANCES", bindingAttr); } public void ApplyNaniteWorldAndFoliage(UE5RenderProfile profile) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (profile == null) { return; } QualitySettings.masterTextureLimit = 0; QualitySettings.anisotropicFiltering = (AnisotropicFiltering)2; QualitySettings.lodBias = Mathf.Clamp(profile.MeshLODBias, 0.8f, 4.5f); QualitySettings.maximumLODLevel = 0; QualitySettings.skinWeights = (SkinWeights)4; QualitySettings.softParticles = true; Shader.globalMaximumLOD = 1000; Terrain[] array = Object.FindObjectsOfType<Terrain>(); if (array != null) { foreach (Terrain val in array) { if (!((Object)(object)val == (Object)null)) { val.heightmapPixelError = Mathf.Clamp(profile.TerrainPixelError, 1f, 20f); val.basemapDistance = (profile.EnablePBRMaterialOverhaul ? 2500f : 1500f); val.detailObjectDistance = Mathf.Clamp(profile.GrassDrawDistance, 80f, 300f); val.detailObjectDensity = Mathf.Clamp01(profile.GrassDensityMultiplier); } } } if ((Object)(object)TerrainMeshQualityManager.Instance != (Object)null) { TerrainMeshQualityManager instance = TerrainMeshQualityManager.Instance; instance.Lod0Shadows = (ShadowCastingMode)1; instance.Lod1Shadows = (ShadowCastingMode)1; if (_fiTMQMLodDistances != null && _fiTMQMBaseLodDistances != null && _fiTMQMBaseLodDistances.GetValue(instance) is float[] array2 && array2.Length > 0) { float num = (profile.EnablePBRMaterialOverhaul ? 1.65f : 1f); float[] array3 = new float[array2.Length]; for (int j = 0; j < array2.Length; j++) { array3[j] = array2[j] * num; } _fiTMQMLodDistances.SetValue(instance, array3); } } if ((Object)(object)FoliageCore_MainManager.instance != (Object)null) { FoliageCore_MainManager instance2 = FoliageCore_MainManager.instance; instance2.density = Mathf.Clamp01(profile.GrassDensityMultiplier); instance2.globalFadeDistance = Mathf.RoundToInt(Mathf.Clamp(profile.GrassDrawDistance, 100f, 280f)); } } public void ApplyPBRMaterialsAndTextures(UE5RenderProfile profile) { if (profile == null) { return; } UBER_DeferredTranslucencyParams[] array = Object.FindObjectsOfType<UBER_DeferredTranslucencyParams>(); if (array != null) { foreach (UBER_DeferredTranslucencyParams val in array) { if (!((Object)(object)val == (Object)null)) { val.Strength = Mathf.Clamp(profile.SubsurfaceTranslucencyStrength, 1f, 8f); } } } Renderer[] array2 = Object.FindObjectsOfType<Renderer>(); if (array2 == null) { return; } HashSet<int> hashSet = new HashSet<int>(); HashSet<int> visitedTexs = new HashSet<int>(); int num = 5; foreach (Renderer val2 in array2) { if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null || ((Component)val2).gameObject.layer == num || val2 is ParticleSystemRenderer || val2 is SpriteRenderer) { continue; } Material[] sharedMaterials = val2.sharedMaterials; if (sharedMaterials == null) { continue; } foreach (Material val3 in sharedMaterials) { if ((Object)(object)val3 == (Object)null || (Object)(object)val3.shader == (Object)null) { continue; } int instanceID = ((Object)val3).GetInstanceID(); if (!hashSet.Contains(instanceID)) { hashSet.Add(instanceID); string text = ((Object)val3.shader).name ?? string.Empty; if (!text.StartsWith("UI/") && !text.StartsWith("Sprites/") && !text.Contains("TextMesh") && !text.Contains("Particles")) { UpgradeMaterialPBR(val3, instanceID, profile, visitedTexs); } } } } Terrain[] array3 = Object.FindObjectsOfType<Terrain>(); if (array3 == null) { return; } foreach (Terrain val4 in array3) { if ((Object)(object)val4 == (Object)null) { continue; } if ((Object)(object)val4.materialTemplate != (Object)null) { int instanceID2 = ((Object)val4.materialTemplate).GetInstanceID(); if (!hashSet.Contains(instanceID2)) { hashSet.Add(instanceID2); UpgradeMaterialPBR(val4.materialTemplate, instanceID2, profile, visitedTexs); } } if (!((Object)(object)val4.terrainData != (Object)null) || val4.terrainData.terrainLayers == null) { continue; } TerrainLayer[] terrainLayers = val4.terrainData.terrainLayers; foreach (TerrainLayer val5 in terrainLayers) { if (!((Object)(object)val5 == (Object)null)) { if ((Object)(object)val5.diffuseTexture != (Object)null) { UpgradeTextureSharpness((Texture)(object)val5.diffuseTexture, profile, visitedTexs); } if ((Object)(object)val5.normalMapTexture != (Object)null) { UpgradeTextureSharpness((Texture)(object)val5.normalMapTexture, profile, visitedTexs); } } } } } private void UpgradeMaterialPBR(Material mat, int matId, UE5RenderProfile profile, HashSet<int> visitedTexs) { if (!_cachedMaterials.TryGetValue(matId, out var value)) { value = new CachedMaterialProps { HasBumpScale = mat.HasProperty("_BumpScale"), BumpScale = (mat.HasProperty("_BumpScale") ? mat.GetFloat("_BumpScale") : 1f), HasDetailBumpScale = mat.HasProperty("_DetailNormalMapScale"), DetailBumpScale = (mat.HasProperty("_DetailNormalMapScale") ? mat.GetFloat("_DetailNormalMapScale") : 1f), HasGlossiness = mat.HasProperty("_Glossiness"), Glossiness = (mat.HasProperty("_Glossiness") ? mat.GetFloat("_Glossiness") : 0.5f), HasGlossMapScale = mat.HasProperty("_GlossMapScale"), GlossMapScale = (mat.HasProperty("_GlossMapScale") ? mat.GetFloat("_GlossMapScale") : 1f), HasSmoothness = mat.HasProperty("_Smoothness"), Smoothness = (mat.HasProperty("_Smoothness") ? mat.GetFloat("_Smoothness") : 0.5f), HasOcclusionStrength = mat.HasProperty("_OcclusionStrength"), OcclusionStrength = (mat.HasProperty("_OcclusionStrength") ? mat.GetFloat("_OcclusionStrength") : 1f) }; _cachedMaterials[matId] = value; } if (value.HasOcclusionStrength) { mat.SetFloat("_OcclusionStrength", value.OcclusionStrength); } if (!profile.EnablePBRMaterialOverhaul) { if (value.HasBumpScale) { mat.SetFloat("_BumpScale", value.BumpScale); } if (value.HasDetailBumpScale) { mat.SetFloat("_DetailNormalMapScale", value.DetailBumpScale); } if (value.HasGlossiness) { mat.SetFloat("_Glossiness", value.Glossiness); } if (value.HasGlossMapScale) { mat.SetFloat("_GlossMapScale", value.GlossMapScale); } if (value.HasSmoothness) { mat.SetFloat("_Smoothness", value.Smoothness); } } else { float num = Mathf.Clamp(profile.NormalMapReliefBoost, 0.5f, 2f); float num2 = Mathf.Clamp(profile.PBRMicroSmoothnessBoost, 0.5f, 1.5f); if (value.HasBumpScale && value.BumpScale > 0.01f) { mat.SetFloat("_BumpScale", Mathf.Clamp(value.BumpScale * num, 0.1f, 2f)); } if (value.HasDetailBumpScale && value.DetailBumpScale > 0.01f) { mat.SetFloat("_DetailNormalMapScale", Mathf.Clamp(value.DetailBumpScale * num, 0.1f, 2f)); } if (value.HasGlossiness && value.Glossiness > 0.02f && value.Glossiness < 0.85f) { mat.SetFloat("_Glossiness", Mathf.Clamp(value.Glossiness * num2, 0.05f, 0.88f)); } if (value.HasGlossMapScale && value.GlossMapScale > 0.02f && value.GlossMapScale < 0.85f) { mat.SetFloat("_GlossMapScale", Mathf.Clamp(value.GlossMapScale * num2, 0.05f, 0.88f)); } if (value.HasSmoothness && value.Smoothness > 0.02f && value.Smoothness < 0.85f) { mat.SetFloat("_Smoothness", Mathf.Clamp(value.Smoothness * num2, 0.05f, 0.88f)); } } for (int i = 0; i < TexturePropNames.Length; i++) { string text = TexturePropNames[i]; if (mat.HasProperty(text)) { Texture texture = mat.GetTexture(text); if ((Object)(object)texture != (Object)null) { UpgradeTextureSharpness(texture, profile, visitedTexs); } } } } private void UpgradeTextureSharpness(Texture tex, UE5RenderProfile profile, HashSet<int> visitedTexs) { int instanceID = ((Object)tex).GetInstanceID(); if (!visitedTexs.Contains(instanceID)) { visitedTexs.Add(instanceID); if (!_cachedTextures.TryGetValue(instanceID, out var value)) { value = new CachedTextureProps { MipMapBias = tex.mipMapBias, AnisoLevel = tex.anisoLevel }; _cachedTextures[instanceID] = value; } if (!profile.EnablePBRMaterialOverhaul) { tex.mipMapBias = value.MipMapBias; tex.anisoLevel = value.AnisoLevel; } else { tex.anisoLevel = 16; tex.mipMapBias = Mathf.Clamp(profile.TextureMipMapBias, -1.2f, 0.5f); } } } } public class UE5PostProcessEngine { private readonly FieldInfo _fiCQCamera; private readonly FieldInfo _fiCQProfile; private readonly FieldInfo _fiCQBloom; private float _currentFocusDistance = 6.5f; private bool _hasCachedVanillaGrading; private GradingMode _vanillaGradingMode = (GradingMode)1; private Tonemapper _vanillaTonemapper = (Tonemapper)2; private float _vanillaContrast; private float _vanillaSaturation; private float _vanillaTemp; private float _vanillaTint; private Vector4 _vanillaLift = new Vector4(1f, 1f, 1f, 0f); private Vector4 _vanillaGamma = new Vector4(1f, 1f, 1f, 0f); private Vector4 _vanillaGain = new Vector4(1f, 1f, 1f, 0f); private bool _hasCachedVanillaBloom; private float _vanillaBloomIntensity = 0.8f; private float _vanillaBloomThreshold = 1.1f; private float _vanillaBloomSoftKnee = 0.5f; private float _vanillaBloomDiffusion = 7f; public UE5PostProcessEngine() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type typeFromHandle = typeof(CameraQuality); _fiCQCamera = typeFromHandle.GetField("m_camera", bindingAttr); _fiCQProfile = typeFromHandle.GetField("m_profile", bindingAttr); _fiCQBloom = typeFromHandle.GetField("m_bloom", bindingAttr); } public void ApplyCameraPostProcessing(CameraQuality cq, UE5RenderProfile profile) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cq == (Object)null || profile == null) { return; } Camera val = (Camera)((_fiCQCamera != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<Camera>())); PostProcessProfile val2 = (PostProcessProfile)((_fiCQProfile != null) ? /*isinst with value type is only supported in some contexts*/: null); bool isInterior = LumenGIEngine.IsCameraInInterior(val); if ((Object)(object)val != (Object)null) { val.allowHDR = true; val.allowMSAA = false; if (!profile.EnableTemporalAA && !profile.EnableScreenSpaceReflections && !profile.EnableMotionBlur) { val.depthTextureMode = (DepthTextureMode)(val.depthTextureMode & -5); } PostProcessLayer component = ((Component)val).GetComponent<PostProcessLayer>(); if ((Object)(object)component != (Object)null) { ConfigurePostProcessLayer(component, profile); } } SENaturalBloomAndDirtyLens val3 = (SENaturalBloomAndDirtyLens)((_fiCQBloom != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<SENaturalBloomAndDirtyLens>())); if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = false; } if (!((Object)(object)val2 == (Object)null)) { AutoExposure val4 = default(AutoExposure); if (val2.TryGetSettings<AutoExposure>(ref val4) && (Object)(object)val4 != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(false); } ConfigureColorGrading(val2, profile, isInterior); ConfigureBloom(val2, profile); ConfigureDepthOfField(val2, profile); ConfigureLensAndFilmEffects(val2, profile); } } private void ConfigurePostProcessLayer(PostProcessLayer ppLayer, UE5RenderProfile profile) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) ppLayer.stopNaNPropagation = true; if (profile.EnableTemporalAA) { ppLayer.antialiasingMode = (Antialiasing)3; if (ppLayer.temporalAntialiasing != null) { ppLayer.temporalAntialiasing.jitterSpread = Mathf.Clamp(profile.TAAJitterSpread, 0.1f, 0.32f); ppLayer.temporalAntialiasing.stationaryBlending = Mathf.Clamp(profile.TAAStationaryBlending, 0.88f, 0.98f); ppLayer.temporalAntialiasing.motionBlending = Mathf.Clamp(profile.TAAMotionBlending, 0.75f, 0.95f); ppLayer.temporalAntialiasing.sharpness = Mathf.Clamp(profile.TAASharpness, 0f, 1.2f); } } else if (profile.EnableACESFilmicGrading || profile.EnablePBRMaterialOverhaul) { ppLayer.antialiasingMode = (Antialiasing)2; if (ppLayer.subpixelMorphologicalAntialiasing != null) { ppLayer.subpixelMorphologicalAntialiasing.quality = (Quality)2; } } else { int num = ((!((Object)(object)OptionManager.Instance != (Object)null) || OptionManager.Instance.CurrentGraphicSettings == null) ? 1 : OptionManager.Instance.CurrentGraphicSettings.AntiAliasingQuality); ppLayer.antialiasingMode = (Antialiasing)((num > 0) ? 2 : 0); } } private void ConfigureColorGrading(PostProcessProfile ppProfile, UE5RenderProfile profile, bool isInterior) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) ColorGrading val = default(ColorGrading); if (ppProfile.TryGetSettings<ColorGrading>(ref val) && !((Object)(object)val == (Object)null)) { if (!_hasCachedVanillaGrading) { _vanillaGradingMode = ((ParameterOverride<GradingMode>)(object)val.gradingMode).value; _vanillaTonemapper = ((ParameterOverride<Tonemapper>)(object)val.tonemapper).value; _vanillaContrast = ((ParameterOverride<float>)(object)val.contrast).value; _vanillaSaturation = ((ParameterOverride<float>)(object)val.saturation).value; _vanillaTemp = ((ParameterOverride<float>)(object)val.temperature).value; _vanillaTint = ((ParameterOverride<float>)(object)val.tint).value; _vanillaLift = ((ParameterOverride<Vector4>)(object)val.lift).value; _vanillaGamma = ((ParameterOverride<Vector4>)(object)val.gamma).value; _vanillaGain = ((ParameterOverride<Vector4>)(object)val.gain).value; _hasCachedVanillaGrading = true; } float num = 0f; if ((Object)(object)OptionManager.Instance != (Object)null && OptionManager.Instance.CurrentGraphicSettings != null) { num = OptionManager.Instance.CurrentGraphicSettings.Brightness; } GradingMode val2; Tonemapper val3; float num2; float num3; float num4; float num5; float num6; Vector4 val4; Vector4 val5; Vector4 val6; if (!profile.EnableACESFilmicGrading) { val2 = _vanillaGradingMode; val3 = _vanillaTonemapper; num2 = num; num3 = _vanillaContrast; num4 = _vanillaSaturation; num5 = _vanillaTemp; num6 = _vanillaTint; val4 = _vanillaLift; val5 = _vanillaGamma; val6 = _vanillaGain; } else { float num7 = (isInterior ? profile.IndoorExposureBoost : 0f); float contrast = profile.Contrast; val4 = profile.Lift; val5 = profile.Gamma; val6 = profile.Gain; val2 = (GradingMode)1; val3 = (Tonemapper)2; num2 = num + profile.PostExposureOffset + num7; num3 = Mathf.Clamp(_vanillaContrast + contrast, -40f, 60f); num4 = Mathf.Clamp(_vanillaSaturation + profile.Saturation, -40f, 60f); num5 = Mathf.Clamp(_vanillaTemp + profile.Temperature, -40f, 40f); num6 = Mathf.Clamp(_vanillaTint + profile.Tint, -40f, 40f); } if (!((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).value) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(true); } if (((ParameterOverride<GradingMode>)(object)val.gradingMode).value != val2) { ((ParameterOverride<GradingMode>)(object)val.gradingMode).Override(val2); } if (((ParameterOverride<Tonemapper>)(object)val.tonemapper).value != val3) { ((ParameterOverride<Tonemapper>)(object)val.tonemapper).Override(val3); } if (Mathf.Abs(((ParameterOverride<float>)(object)val.postExposure).value - num2) > 0.001f) { ((ParameterOverride<float>)(object)val.postExposure).Override(num2); } if (Mathf.Abs(((ParameterOverride<float>)(object)val.contrast).value - num3) > 0.01f) { ((ParameterOverride<float>)(object)val.contrast).Override(num3); } if (Mathf.Abs(((ParameterOverride<float>)(object)val.saturation).value - num4) > 0.01f) { ((ParameterOverride<float>)(object)val.saturation).Override(num4); } if (Mathf.Abs(((ParameterOverride<float>)(object)val.temperature).value - num5) > 0.01f) { ((ParameterOverride<float>)(object)val.temperature).Override(num5); } if (Mathf.Abs(((ParameterOverride<float>)(object)val.tint).value - num6) > 0.01f) { ((ParameterOverride<float>)(object)val.tint).Override(num6); } Vector4 val7 = ((ParameterOverride<Vector4>)(object)val.lift).value - val4; if (((Vector4)(ref val7)).sqrMagnitude > 1E-05f) { ((ParameterOverride<Vector4>)(object)val.lift).Override(val4); } Vector4 val8 = ((ParameterOverride<Vector4>)(object)val.gamma).value - val5; if (((Vector4)(ref val8)).sqrMagnitude > 1E-05f) { ((ParameterOverride<Vector4>)(object)val.gamma).Override(val5); } Vector4 val9 = ((ParameterOverride<Vector4>)(object)val.gain).value - val6; if (((Vector4)(ref val9)).sqrMagnitude > 1E-05f) { ((ParameterOverride<Vector4>)(object)val.gain).Override(val6); } } } private void ConfigureBloom(PostProcessProfile ppProfile, UE5RenderProfile profile) { Bloom val = default(Bloom); if (ppProfile.TryGetSettings<Bloom>(ref val) && !((Object)(object)val == (Object)null)) { if (!_hasCachedVanillaBloom) { _vanillaBloomIntensity = ((ParameterOverride<float>)(object)val.intensity).value; _vanillaBloomThreshold = ((ParameterOverride<float>)(object)val.threshold).value; _vanillaBloomSoftKnee = ((ParameterOverride<float>)(object)val.softKnee).value; _vanillaBloomDiffusion = ((ParameterOverride<float>)(object)val.diffusion).value; _hasCachedVanillaBloom = true; } if (!profile.EnablePhysicalBloom) { bool flag = !((Object)(object)OptionManager.Instance != (Object)null) || OptionManager.Instance.CurrentGraphicSettings == null || OptionManager.Instance.CurrentGraphicSettings.Bloom > 0; ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(flag); ((ParameterOverride<float>)(object)val.intensity).Override(_vanillaBloomIntensity); ((ParameterOverride<float>)(object)val.threshold).Override(_vanillaBloomThreshold); ((ParameterOverride<float>)(object)val.softKnee).Override(_vanillaBloomSoftKnee); ((ParameterOverride<float>)(object)val.diffusion).Override(_vanillaBloomDiffusion); } else { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(true); ((ParameterOverride<float>)(object)val.intensity).Override(Mathf.Clamp(profile.BloomIntensity, 0f, 2.5f)); ((ParameterOverride<float>)(object)val.threshold).Override(Mathf.Clamp(profile.BloomThreshold, 0.8f, 2.5f)); ((ParameterOverride<float>)(object)val.softKnee).Override(Mathf.Clamp01(profile.BloomSoftKnee)); ((ParameterOverride<float>)(object)val.diffusion).Override(Mathf.Clamp(profile.BloomDiffusion, 1f, 9.5f)); ((ParameterOverride<float>)(object)val.clamp).Override(16f); } } } private void ConfigureDepthOfField(PostProcessProfile ppProfile, UE5RenderProfile profile) { DepthOfField val = default(DepthOfField); if (ppProfile.TryGetSettings<DepthOfField>(ref val) && !((Object)(object)val == (Object)null)) { if (!profile.EnableDynamicAutofocusDoF) { bool flag = (Object)(object)OptionManager.Instance != (Object)null && OptionManager.Instance.CurrentGraphicSettings != null && OptionManager.Instance.CurrentGraphicSettings.DepthOfField > 0; ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(flag); return; } ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(true); ((ParameterOverride<float>)(object)val.focusDistance).Override(_currentFocusDistance); ((ParameterOverride<float>)(object)val.aperture).Override(Mathf.Clamp(profile.DoFAperture, 1.8f, 16f)); ((ParameterOverride<float>)(object)val.focalLength).Override(Mathf.Clamp(profile.DoFFocalLength, 15f, 90f)); ((ParameterOverride<KernelSize>)(object)val.kernelSize).Override((KernelSize)2); } } private void ConfigureLensAndFilmEffects(PostProcessProfile ppProfile, UE5RenderProfile profile) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) MotionBlur val = default(MotionBlur); if (ppProfile.TryGetSettings<MotionBlur>(ref val) && (Object)(object)val != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(profile.EnableMotionBlur && profile.MotionBlurShutterAngle > 1f); ((ParameterOverride<float>)(object)val.shutterAngle).Override(Mathf.Clamp(profile.MotionBlurShutterAngle, 0f, 360f)); ((ParameterOverride<int>)(object)val.sampleCount).Override(10); } Vignette val2 = default(Vignette); if (!ppProfile.TryGetSettings<Vignette>(ref val2)) { val2 = ppProfile.AddSettings<Vignette>(); } if ((Object)(object)val2 != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val2).enabled).Override(profile.VignetteIntensity > 0.005f); ((ParameterOverride<VignetteMode>)(object)val2.mode).Override((VignetteMode)0); ((ParameterOverride<float>)(object)val2.intensity).Override(Mathf.Clamp01(profile.VignetteIntensity)); ((ParameterOverride<float>)(object)val2.smoothness).Override(0.45f); ((ParameterOverride<float>)(object)val2.roundness).Override(1f); ((ParameterOverride<bool>)(object)val2.rounded).Override(false); ((ParameterOverride<Color>)(object)val2.color).Override(new Color(0.02f, 0.02f, 0.03f, 1f)); } ChromaticAberration val3 = default(ChromaticAberration); if (!ppProfile.TryGetSettings<ChromaticAberration>(ref val3)) { val3 = ppProfile.AddSettings<ChromaticAberration>(); } if ((Object)(object)val3 != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val3).enabled).Override(profile.ChromaticAberrationIntensity > 0.005f); ((ParameterOverride<float>)(object)val3.intensity).Override(Mathf.Clamp01(profile.ChromaticAberrationIntensity)); ((ParameterOverride<bool>)(object)val3.fastMode).Override(true); } Grain val4 = default(Grain); if (!ppProfile.TryGetSettings<Grain>(ref val4)) { val4 = ppProfile.AddSettings<Grain>(); } if ((Object)(object)val4 != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(profile.FilmGrainIntensity > 0.005f); ((ParameterOverride<bool>)(object)val4.colored).Override(false); ((ParameterOverride<float>)(object)val4.intensity).Override(Mathf.Clamp01(profile.FilmGrainIntensity)); ((ParameterOverride<float>)(object)val4.size).Override(0.8f); ((ParameterOverride<float>)(object)val4.lumContrib).Override(0.75f); } } public void UpdateDynamicAutofocus(UE5RenderProfile profile) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (profile == null || !profile.EnableDynamicAutofocusDoF || CharacterCamera.CharCamList == null || CharacterCamera.CharCamList.Count == 0) { return; } DepthOfField val3 = default(DepthOfField); RaycastHit val5 = default(RaycastHit); for (int i = 0; i < CharacterCamera.CharCamList.Count; i++) { CharacterCamera val = CharacterCamera.CharCamList[i]; if ((Object)(object)val == (Object)null || (Object)(object)val.CameraScript == (Object)null) { continue; } Camera cameraScript = val.CameraScript; CameraQuality component = ((Component)cameraScript).GetComponent<CameraQuality>(); if ((Object)(object)component == (Object)null) { continue; } PostProcessProfile val2 = (PostProcessProfile)((_fiCQProfile != null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val2 == (Object)null) && val2.TryGetSettings<DepthOfField>(ref val3) && !((Object)(object)val3 == (Object)null)) { float num = 4.5f; if ((Object)(object)val.TargetCharacter != (Object)null) { num = Vector3.Distance(((Component)cameraScript).transform.position, val.TargetCharacter.CenterPosition); } float num2 = num + 2.5f; int num3 = -33; Vector3 val4 = ((Component)cameraScript).transform.position + ((Component)cameraScript).transform.forward * (num * 0.85f); if (Physics.SphereCast(val4, 0.3f, ((Component)cameraScript).transform.forward, ref val5, 120f, num3, (QueryTriggerInteraction)1)) { float num4 = num * 0.85f + ((RaycastHit)(ref val5)).distance; num2 = Mathf.Max(num, num4); } else { num2 = 25f; } float num5 = Mathf.Lerp(_currentFocusDistance, num2, Time.unscaledDeltaTime * 7.5f); if (Mathf.Abs(num5 - _currentFocusDistance) > 0.05f) { _currentFocusDistance = num5; ((ParameterOverride<float>)(object)val3.focusDistance).Override(_currentFocusDistance); } } } } } public class VolumetricSkyAndWaterEngine { private struct CachedGlobalFogProps { public bool DistanceFog; public bool HeightFog; public float StartDistance; } private readonly FieldInfo _fiCQRays; private readonly FieldInfo _fiCQScattering; private readonly FieldInfo _fiCQProfile; private readonly FieldInfo _fiCQCamera; private bool _hasCachedSky; private float _origRayleigh = 1f; private float _origMie = 1f; private float _origDirectionality = 0.7f; private float _origContrast = 1f; private float _origCloudSharpness = 1f; private float _origCloudScattering = 1f; private float _origCloudAttenuation = 1f; private readonly Dictionary<int, CachedGlobalFogProps> _origGlobalFog = new Dictionary<int, CachedGlobalFogProps>(); public VolumetricSkyAndWaterEngine() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type typeFromHandle = typeof(CameraQuality); _fiCQRays = typeFromHandle.GetField("m_rays", bindingAttr); _fiCQScattering = typeFromHandle.GetField("m_scattering", bindingAttr); _fiCQProfile = typeFromHandle.GetField("m_profile", bindingAttr); _fiCQCamera = typeFromHandle.GetField("m_camera", bindingAttr); } public void ApplySkyAndAtmosphere(UE5RenderProfile profile) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) if (profile == null) { return; } TOD_Sky instance = TOD_Sky.Instance; if ((Object)(object)instance == (Object)null) { return; } if (!_hasCachedSky && instance.Atmosphere != null && instance.Clouds != null) { _origRayleigh = instance.Atmosphere.RayleighMultiplier; _origMie = instance.Atmosphere.MieMultiplier; _origDirectionality = instance.Atmosphere.Directionality; _origContrast = instance.Atmosphere.Contrast; _origCloudSharpness = instance.Clouds.Sharpness; _origCloudScattering = instance.Clouds.Scattering; _origCloudAttenuation = instance.Clouds.Attenuation; _hasCachedSky = true; } if (!profile.EnableVolumetricSkyOverhaul) { if (_hasCachedSky && instance.Atmosphere != null && instance.Clouds != null) { instance.Atmosphere.RayleighMultiplier = _origRayleigh; instance.Atmosphere.MieMultiplier = _origMie; instance.Atmosphere.Directionality = _origDirectionality; instance.Atmosphere.Contrast = _origContrast; instance.Clouds.Sharpness = _origCloudSharpness; instance.Clouds.Scattering = _origCloudScattering; instance.Clouds.Attenuation = _origCloudAttenuation; } return; } instance.SkyQuality = (TOD_SkyQualityType)1; instance.CloudQuality = (TOD_CloudQualityType)2; instance.MeshQuality = (TOD_MeshQualityType)2; instance.StarQuality = (TOD_StarQualityType)2; instance.ColorRange = (TOD_ColorRangeType)1; instance.ColorOutput = (TOD_ColorOutputType)1; if (instance.Atmosphere != null) { instance.Atmosphere.RayleighMultiplier = _origRayleigh * Mathf.Clamp(profile.RayleighScatteringBoost, 0.7f, 1.6f); instance.Atmosphere.MieMultiplier = _origMie * Mathf.Clamp(profile.MieScatteringBoost, 0.7f, 1.6f); instance.Atmosphere.Directionality = Mathf.Clamp(profile.SunDirectionality, 0.5f, 0.9f); instance.Atmosphere.Contrast = _origContrast * 1.04f; } if (instance.Clouds != null) { instance.Clouds.Sharpness = _origCloudSharpness * Mathf.Clamp(profile.CloudSharpness, 0.5f, 2f); instance.Clouds.Scattering = _origCloudScattering * Mathf.Clamp(profile.CloudScattering, 0.5f, 2f); } } public void ApplyCameraVolumetricsAndSSR(CameraQuality cq, UE5RenderProfile profile) { //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cq == (Object)null || profile == null) { return; } Camera val = (Camera)((_fiCQCamera != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<Camera>())); PostProcessProfile val2 = (PostProcessProfile)((_fiCQProfile != null) ? /*isinst with value type is only supported in some contexts*/: null); bool flag = LumenGIEngine.IsCameraInInterior(val); if ((Object)(object)val != (Object)null) { GlobalFog component = ((Component)val).GetComponent<GlobalFog>(); if ((Object)(object)component != (Object)null) { int instanceID = ((Object)component).GetInstanceID(); if (!_origGlobalFog.TryGetValue(instanceID, out var value)) { value = new CachedGlobalFogProps { DistanceFog = component.distanceFog, HeightFog = component.heightFog, StartDistance = component.startDistance }; _origGlobalFog[instanceID] = value; } component.heightFog = value.HeightFog; component.distanceFog = value.DistanceFog; if (profile.EnableLumenGI && flag) { component.startDistance = Mathf.Max(value.StartDistance, 65f); } else { component.startDistance = value.StartDistance; } } } TOD_Rays val3 = (TOD_Rays)((_fiCQRays != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<TOD_Rays>())); if ((Object)(object)val3 != (Object)null) { bool flag2 = !((Object)(object)OptionManager.Instance != (Object)null) || OptionManager.Instance.CurrentGraphicSettings == null || OptionManager.Instance.CurrentGraphicSettings.RayQuality > 0; if (profile.EnableVolumetricSkyOverhaul && profile.GodRayIntensity > 0.01f && flag2 && !flag) { ((Behaviour)val3).enabled = true; val3.Resolution = (ResolutionType)2; val3.UseDepthTexture = true; val3.BlurIterations = 3; val3.BlurRadius = 2.2f; val3.Intensity = Mathf.Clamp(profile.GodRayIntensity, 0f, 1.2f); } else { ((Behaviour)val3).enabled = flag2 && !flag; val3.Resolution = (ResolutionType)1; val3.BlurIterations = 2; val3.Intensity = 0.4f; } } ScreenSpaceReflections val4 = default(ScreenSpaceReflections); if ((Object)(object)val2 != (Object)null && val2.TryGetSettings<ScreenSpaceReflections>(ref val4) && (Object)(object)val4 != (Object)null) { if ((Object)(object)OptionManager.Instance != (Object)null && OptionManager.Instance.CurrentGraphicSettings != null) { _ = OptionManager.Instance.CurrentGraphicSettings.SSR; } if (!profile.EnableScreenSpaceReflections) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(false); return; } ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(true); ((ParameterOverride<ScreenSpaceReflectionPreset>)(object)val4.preset).Override((ScreenSpaceReflectionPreset)3); ((ParameterOverride<ScreenSpaceReflectionResolution>)(object)val4.resolution).Override((ScreenSpaceReflectionResolution)0); ((ParameterOverride<float>)(object)val4.maximumMarchDistance).Override(Mathf.Clamp(profile.SSRMaxMarchDistance, 40f, 180f)); ((ParameterOverride<float>)(object)val4.distanceFade).Override(0.25f); ((ParameterOverride<float>)(object)val4.vignette).Override(0.2f); } } public void ApplyWaterOverhaul(UE5RenderProfile profile) { if (profile == null) { return; } int num = (profile.EnableVolumetricSkyOverhaul ? Mathf.Clamp(profile.PlanarWaterResolution, 256, 1024) : 256); WaterRender[] array = Object.FindObjectsOfType<WaterRender>(); if (array == null) { return; } foreach (WaterRender val in array) { if (!((Object)(object)val == (Object)null) && !((Object)((Component)val).gameObject).name.Contains("DEPTH")) { val.ReflectionTexSize = num; val.RefractionTexSize = num; } } } } public class VSMShadowAndAOEngine { private readonly FieldInfo _fiCQCamera; private readonly FieldInfo _fiCQSSAO; private readonly FieldInfo _fiCQSSShadows; private readonly FieldInfo _fiCQProfile; public VSMShadowAndAOEngine() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type typeFromHandle = typeof(CameraQuality); _fiCQCamera = typeFromHandle.GetField("m_camera", bindingAttr); _fiCQSSAO = typeFromHandle.GetField("m_ssao", bindingAttr); _fiCQSSShadows = typeFromHandle.GetField("m_ssShadows", bindingAttr); _fiCQProfile = typeFromHandle.GetField("m_profile", bindingAttr); } public void ApplyGlobalShadowSettings(UE5RenderProfile profile) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (profile == null) { return; } QualitySettings.shadows = (ShadowQuality)2; QualitySettings.shadowResolution = (ShadowResolution)3; QualitySettings.shadowProjection = (ShadowProjection)1; QualitySettings.shadowCascades = 4; QualitySettings.shadowDistance = Mathf.Clamp(profile.ShadowDistance, 80f, 450f); QualitySettings.shadowCascade4Split = new Vector3(Mathf.Clamp(profile.CascadeSplit0, 0.015f, 0.15f), Mathf.Clamp(profile.CascadeSplit1, 0.05f, 0.3f), Mathf.Clamp(profile.CascadeSplit2, 0.15f, 0.6f)); if ((Object)(object)EnvironmentConditions.Instance != (Object)null) { float shadowDistance = QualitySettings.shadowDistance; float num = (profile.UncapEnvironmentShadowCulling ? 1f : 0.5f); float[] array = new float[32]; array[0] = shadowDistance; array[11] = shadowDistance * num; Light sunLight = EnvironmentConditions.Instance.SunLight; if ((Object)(object)sunLight != (Object)null) { sunLight.layerShadowCullDistances = array; } Light moonLight = EnvironmentConditions.Instance.MoonLight; if ((Object)(object)moonLight != (Object)null) { moonLight.layerShadowCullDistances = array; } } } public void ApplyCameraShadowAndAO(CameraQuality cq, UE5RenderProfile profile) { //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Invalid comparison between Unknown and I4 if ((Object)(object)cq == (Object)null || profile == null) { return; } Camera val = (Camera)((_fiCQCamera != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<Camera>())); bool flag = LumenGIEngine.IsCameraInInterior(val); if (profile.UncapEnvironmentShadowCulling) { cq.DefaultLayerShadowDistMult = 1f; cq.EnvironmentLayerShadowDistMult = 1f; cq.EnvironmentMaxDist = Mathf.Max(200f, profile.CameraEnvironmentCullDistance); } else { cq.DefaultLayerShadowDistMult = 1f; cq.EnvironmentLayerShadowDistMult = 0.5f; cq.EnvironmentMaxDist = 200f; } if ((Object)(object)val != (Object)null) { float[] array = new float[32]; array[2] = 200f; array[11] = (profile.UncapEnvironmentShadowCulling ? Mathf.Max(200f, profile.CameraEnvironmentCullDistance) : 200f); val.layerCullDistances = array; } SEScreenSpaceShadows val2 = (SEScreenSpaceShadows)((_fiCQSSShadows != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<SEScreenSpaceShadows>())); if ((Object)(object)val2 != (Object)null) { ConfigureContactShadows(val2, profile, flag); } PostProcessProfile val3 = (PostProcessProfile)((_fiCQProfile != null) ? /*isinst with value type is only supported in some contexts*/: null); AmbientOcclusion val4 = default(AmbientOcclusion); if ((Object)(object)val3 != (Object)null && val3.TryGetSettings<AmbientOcclusion>(ref val4) && (Object)(object)val4 != (Object)null) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val4).enabled).Override(true); ((ParameterOverride<AmbientOcclusionMode>)(object)val4.mode).Override((AmbientOcclusionMode)0); ((ParameterOverride<AmbientOcclusionQuality>)(object)val4.quality).Override((AmbientOcclusionQuality)3); float num = (profile.EnableEnhancedAO ? Mathf.Clamp(profile.AOIntensity, 0.2f, 2f) : 0.8f); if (flag && profile.EnableEnhancedAO) { num *= 0.8f; } ((ParameterOverride<float>)(object)val4.intensity).Override(num); ((ParameterOverride<float>)(object)val4.radius).Override(profile.EnableEnhancedAO ? Mathf.Clamp(profile.AORadius, 0.1f, 1f) : 0.3f); bool flag2 = (Object)(object)val != (Object)null && (int)val.actualRenderingPath == 3; ((ParameterOverride<bool>)(object)val4.ambientOnly).Override(flag2); } SSAOPro val5 = (SSAOPro)((_fiCQSSAO != null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)((Component)cq).GetComponent<SSAOPro>())); if ((Object)(object)val5 != (Object)null) { ((Behaviour)val5).enabled = false; } } public void ConfigureContactShadows(SEScreenSpaceShadows sss, UE5RenderProfile profile, bool isInterior) { if (!((Object)(object)sss == (Object)null) && profile != null) { bool enabled = !((Object)(object)OptionManager.Instance != (Object)null) || OptionManager.Instance.CurrentGraphicSettings == null || OptionManager.Instance.CurrentGraphicSettings.SSShadows == 1; if (!profile.EnableVSMContactShadows) { ((Behaviour)sss).enabled = enabled; sss.samples = 32; sss.range = 0.7f; sss.zThickness = 0.1f; sss.blendStrength = 1f; return; } sss.samples = Mathf.Clamp(profile.ContactShadowSamples, 16, 48); sss.nearSampleQuality = 1.25f; sss.range = (isInterior ? Mathf.Min(0.45f, profile.ContactShadowRange) : Mathf.Clamp(profile.ContactShadowRange, 0.3f, 2.5f)); sss.zThickness = Mathf.Clamp(profile.ContactShadowZThickness, 0.04f, 0.3f); sss.traceBias = 0.02f; sss.blendStrength = (isInterior ? Mathf.Clamp01(profile.ContactShadowBlendStrength * 0.55f) : Mathf.Clamp01(profile.ContactShadowBlendStrength)); sss.accumulation = 0.9f; sss.lengthFade = 0.7f; sss.stochasticSampling = false; sss.leverageTemporalAA = false; sss.bilateralBlur = true; sss.blurPasses = 2; sss.blurDepthTolerance = 0.1f; } } } } namespace OutwardUE5Overhaul.Presets { public enum UE5PresetType { UE5_Lumen_Nanite_2026, UE5_Dark_Fantasy_Grim, UE5_Photorealistic_Natural, UE5_High_FPS_Gameplay, Vanilla_Original } [Serializable] public class UE5RenderProfile { public string Name; public string Subtitle; public string Description; public bool EnableLumenGI; public float SkyBounceIntensity; public float EquatorBounceIntensity; public float GroundBounceIntensity; public float IndirectSolarBounceIntensity; public float ReflectionSpecularityBoost; public float PointLightRangeMultiplier; public float IndoorAmbientBoost; public float IndoorExposureBoost; public float ShadowDistance; public float CascadeSplit0; public float CascadeSplit1; public float CascadeSplit2; public bool UncapEnvironmentShadowCulling; public bool EnableVSMContactShadows; public int ContactShadowSamples; public float ContactShadowRange; public float ContactShadowZThickness; public float ContactShadowBlendStrength; public bool EnableEnhancedAO; public float AOIntensity; public float AORadius; public bool EnableACESFilmicGrading; public float PostExposureOffset; public float Contrast; public float Saturation; public float Temperature; public float Tint; public Vector4 Lift; public Vector4 Gamma; public Vector4 Gain; public bool EnablePhysicalBloom; public float BloomIntensity; public float BloomThreshold; public float BloomSoftKnee; public float BloomDiffusion; public bool EnableDynamicAutofocusDoF; public float DoFAperture; public float DoFFocalLength; public bool EnableMotionBlur; public float MotionBlurShutterAngle; public float VignetteIntensity; public float ChromaticAberrationIntensity; public float FilmGrainIntensity; public bool EnableTemporalAA; public float TAAJitterSpread; public float TAAStationaryBlending; public float TAAMotionBlending; public float TAASharpness; public bool EnableVolumetricSkyOverhaul; public float RayleighScatteringBoost; public float MieScatteringBoost; public float SunDirectionality; public float CloudSharpness; public float CloudScattering; public float GodRayIntensity; public bool EnableScreenSpaceReflections; public float SSRMaxMarchDistance; public int PlanarWaterResolution; public float MeshLODBias; public float CameraEnvironmentCullDistance; public float TerrainPixelError; public float GrassDensityMultiplier; public float GrassDrawDistance; public bool EnablePBRMaterialOverhaul; public float TextureMipMapBias; public float NormalMapReliefBoost; public float PBRMicroSmoothnessBoost; public float SubsurfaceTranslucencyStrength; public UE5RenderProfile Clone() { return (UE5RenderProfile)MemberwiseClone(); } } public static class UE5VisualPresets { public static UE5RenderProfile GetPreset(UE5PresetType preset) { return preset switch { UE5PresetType.UE5_Lumen_Nanite_2026 => CreateLumenNanite2026(), UE5PresetType.UE5_Dark_Fantasy_Grim => CreateDarkFantasyGrim(), UE5PresetType.UE5_Photorealistic_Natural => CreatePhotorealisticNatural(), UE5PresetType.UE5_High_FPS_Gameplay => CreateHighFPSGameplay(), _ => CreateVanillaOriginal(), }; } public static UE5RenderProfile CreateLumenNanite2026() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) UE5RenderProfile uE5RenderProfile = new UE5RenderProfile(); uE5RenderProfile.Name = "UE5 Lumen & Neural Ray-Reconstruction 2026"; uE5RenderProfile.Subtitle = "Path-Traced Emissive/Lava Light Carry, Chromatic GI & 4K PBR"; uE5RenderProfile.Description = "Unclamped 1.65x light carry (volcano lava, fire, lanterns), real-time chromatic local GI bounce, 32 pixel lights, and 4K optical micro-detail."; uE5RenderProfile.EnableLumenGI = true; uE5RenderProfile.SkyBounceIntensity = 1.15f; uE5RenderProfile.EquatorBounceIntensity = 1.18f; uE5RenderProfile.GroundBounceIntensity = 1.05f; uE5RenderProfile.IndirectSolarBounceIntensity = 0.18f; uE5RenderProfile.ReflectionSpecularityBoost = 1f; uE5RenderProfile.PointLightRangeMultiplier = 1.65f; uE5RenderProfile.IndoorAmbientBoost = 0.08f; uE5RenderProfile.IndoorExposureBoost = 0.06f; uE5RenderProfile.ShadowDistance = 280f; uE5RenderProfile.CascadeSplit0 = 0.035f; uE5RenderProfile.CascadeSplit1 = 0.11f; uE5RenderProfile.CascadeSplit2 = 0.28f; uE5RenderProfile.UncapEnvironmentShadowCulling = true; uE5RenderProfile.EnableVSMContactShadows = true; uE5RenderProfile.ContactShadowSamples = 36; uE5RenderProfile.ContactShadowRange = 1.05f; uE5RenderProfile.ContactShadowZThickness = 0.1f; uE5RenderProfile.ContactShadowBlendStrength = 0.72f; uE5RenderProfile.EnableEnhancedAO = true; uE5RenderProfile.AOIntensity = 1.02f; uE5RenderProfile.AORadius = 0.32f; uE5RenderProfile.EnableACESFilmicGrading = true; uE5RenderProfile.PostExposureOffset = 0.15f; uE5RenderProfile.Contrast = 5f; uE5RenderProfile.Saturation = -5f; uE5RenderProfile.Temperature = 0f; uE5RenderProfile.Tint = 0f; uE5RenderProfile.Lift = new Vector4(1f, 1f, 1f, 0.002f); uE5RenderProfile.Gamma = new Vector4(1f, 1f, 1f, 0.02f); uE5RenderProfile.Gain = new Vector4(1f, 1f, 1f, 0f); uE5RenderProfile.EnablePhysicalBloom = true; uE5RenderProfile.BloomIntensity = 0.42f; uE5RenderProfile.BloomThreshold = 1.32f; uE5RenderProfile.BloomSoftKnee = 0.68f; uE5RenderProfile.BloomDiffusion = 8.2f; uE5RenderProfile.EnableDynamicAutofocusDoF = false; uE5RenderProfile.DoFAperture = 5.6f; uE5RenderProfile.DoFFocalLength = 38f; uE5RenderProfile.EnableMotionBlur = false; uE5RenderProfile.MotionBlurShutterAngle = 90f; uE5RenderProfile.VignetteIntensity = 0.06f; uE5RenderProfile.ChromaticAberrationIntensity = 0f; uE5RenderProfile.FilmGrainIntensity = 0f; uE5RenderProfile.EnableTemporalAA = false; uE5RenderProfile.TAAJitterSpread = 0.18f; uE5RenderProfile.TAAStationaryBlending = 0.95f; uE5RenderProfile.TAAMotionBlending = 0.88f; uE5RenderProfile.TAASharpness = 0.25f; uE5RenderProfile.EnableVolumetricSkyOverhaul = true; uE5RenderProfile.RayleighScatteringBoost = 1.05f; uE5RenderProfile.MieScatteringBoost = 1.12f; uE5RenderProfile.SunDirectionality = 0.76f; uE5RenderProfile.CloudSharpness = 1.18f; uE5RenderProfile.CloudScattering = 1.15f; uE5RenderProfile.GodRayIntensity = 0.45f; uE5RenderProfile.EnableScreenSpaceReflections = false; uE5RenderProfile.SSRMaxMarchDistance = 100f; uE5RenderProfile.PlanarWaterResolution = 512; uE5RenderProfile.MeshLODBias = 2.8f; uE5RenderProfile.CameraEnvironmentCullDistance = 950f; uE5RenderProfile.TerrainPixelError = 2f; uE5RenderProfile.GrassDensityMultiplier = 1.15f; uE5RenderProfile.GrassDrawDistance = 230f; uE5RenderProfile.EnablePBRMaterialOverhaul = true; uE5RenderProfile.TextureMipMapBias = -0.32f; uE5RenderProfile.NormalMapReliefBoost = 1.1f; uE5RenderProfile.PBRMicroSmoothnessBoost = 1f; uE5RenderProfile.SubsurfaceTranslucencyStrength = 4.2f; return uE5RenderProfile; } public static UE5RenderProfile CreateDarkFantasyGrim() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) UE5RenderProfile uE5RenderProfile = CreateLumenNanite2026(); uE5RenderProfile.Name = "UE5 Dark Fantasy (Cinematic & Grounded)"; uE5RenderProfile.Subtitle = "Elden Ring / Witchfire Natural Dark Aesthetic"; uE5RenderProfile.Description = "Moody desaturated earth tones, deep contact occlusion, and long-range 1.75x lava/torch/lantern light carry."; uE5RenderProfile.SkyBounceIntensity = 1.08f; uE5RenderProfile.EquatorBounceIntensity = 1.12f; uE5RenderProfile.GroundBounceIntensity = 1f; uE5RenderProfile.IndirectSolarBounceIntensity = 0.16f; uE5RenderProfile.PointLightRangeMultiplier = 1.75f; uE5RenderProfile.IndoorAmbientBoost = 0.04f; uE5RenderProfile.IndoorExposureBoost = 0.03f; uE5RenderProfile.AOIntensity = 1.12f; uE5RenderProfile.ContactShadowBlendStrength = 0.78f; uE5RenderProfile.PostExposureOffset = 0.12f; uE5RenderProfile.Contrast = 6.5f; uE5RenderProfile.Saturation = -10f; uE5RenderProfile.Temperature = -1f; uE5RenderProfile.Tint = 0f; uE5RenderProfile.Lift = new Vector4(0.99f, 1f, 1.01f, 0f); uE5RenderProfile.Gamma = new Vector4(1f, 1f, 1f, 0.01f); uE5RenderProfile.Gain = new Vector4(1f, 1f, 0.99f, 0f); uE5RenderProfile.VignetteIntensity = 0.1f; return uE5RenderProfile; } public static UE5RenderProfile CreatePhotorealisticNatural() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) UE5RenderProfile uE5RenderProfile = CreateLumenNanite2026(); uE5RenderProfile.Name = "UE5 Photorealistic Natural (Real-Life 4K Photo)"; uE5RenderProfile.Subtitle = "ARRI / Sony Full-Frame D65 + Neural Light Reconstruction"; uE5RenderProfile.Description = "Maximum real-life photographic realism: extended 1.75x lava/point light carry, natural indoor shadow response, D65 daylight, and crisp 4K micro-detail."; uE5RenderProfile.SkyBounceIntensity = 1.18f; uE5RenderProfile.EquatorBounceIntensity = 1.2f; uE5RenderProfile.GroundBounceIntensity = 1.08f; uE5RenderProfile.IndirectSolarBounceIntensity = 0.2f; uE5RenderProfile.ReflectionSpecularityBoost = 1f; uE5RenderProfile.PointLightRangeMultiplier = 1.75f; uE5RenderProfile.IndoorAmbientBoost = 0.1f; uE5RenderProfile.IndoorExposureBoost = 0.08f; uE5RenderProfile.AOIntensity = 0.95f; uE5RenderProfile.ContactShadowBlendStrength = 0.65f; uE5RenderProfile.PostExposureOffset = 0.16f; uE5RenderProfile.Contrast = 4.5f; uE5RenderProfile.Saturation = -6f; uE5RenderProfile.Temperature = 0f; uE5RenderProfile.Tint = 0f; uE5RenderProfile.Lift = new Vector4(1f, 1f, 1f, 0.003f); uE5RenderProfile.Gamma = new Vector4(1f, 1f, 1f, 0.02f); uE5RenderProfile.Gain = new Vector4(1f, 1f, 1f, 0f); uE5RenderProfile.BloomIntensity = 0.36f; uE5RenderProfile.BloomThreshold = 1.35f; uE5RenderProfile.VignetteIntensity = 0.04f; uE5RenderProfile.TextureMipMapBias = -0.3f; uE5RenderProfile.NormalMapReliefBoost = 1.08f; uE5RenderProfile.PBRMicroSmoothnessBoost = 1f; return uE5RenderProfile; } public static UE5RenderProfile CreateHighFPSGameplay() { UE5RenderProfile uE5RenderProfile = CreateLumenNanite2026(); uE5RenderProfile.Name = "UE5 High-FPS Gameplay (140+ FPS Optimized)"; uE5RenderProfile.Subtitle = "Photorealistic Visuals Tuned for High-Refresh Monitors"; uE5RenderProfile.Description = "Retains 4K photographic color science, 1.65x unclamped light carry, and Lumen GI with lightweight shadow & LOD distances."; uE5RenderProfile.ShadowDistance = 200f; uE5RenderProfile.ContactShadowSamples = 28; uE5RenderProfile.PlanarWaterResolution = 512; uE5RenderProfile.MeshLODBias = 2.2f; uE5RenderProfile.CameraEnvironmentCullDistance = 600f; uE5RenderProfile.TerrainPixelError = 3f; uE5RenderProfile.GrassDensityMultiplier = 1f; uE5RenderProfile.GrassDrawDistance = 190f; return uE5RenderProfile; } public static UE5RenderProfile CreateVanillaOriginal() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) UE5RenderProfile uE5RenderProfile = new UE5RenderProfile(); uE5RenderProfile.Name = "Vanilla (Original Outward)"; uE5RenderProfile.Subtitle = "Unmodified Unity 2020.3 Visuals"; uE5RenderProfile.Description = "Restores 100% of original Outward Definitive Edition lighting, post-processing, shadow culling, and material settings."; uE5RenderProfile.EnableLumenGI = false; uE5RenderProfile.SkyBounceIntensity = 1f; uE5RenderProfile.EquatorBounceIntensity = 1f; uE5RenderProfile.GroundBounceIntensity = 1f; uE5RenderProfile.IndirectSolarBounceIntensity = 0f; uE5RenderProfile.ReflectionSpecularityBoost = 1f; uE5RenderProfile.PointLightRangeMultiplier = 1f; uE5RenderProfile.IndoorAmbientBoost = 0f; uE5RenderProfile.IndoorExposureBoost = 0f; uE5RenderProfile.ShadowDistance = 150f; uE5RenderProfile.CascadeSplit0 = 0.02f; uE5RenderProfile.CascadeSplit1 = 0.05f; uE5RenderProfile.CascadeSplit2 = 0.2f; uE5RenderProfile.UncapEnvironmentShadowCulling = false; uE5RenderProfile.EnableVSMContactShadows = true; uE5RenderProfile.ContactShadowSamples = 32; uE5RenderProfile.ContactShadowRange = 0.7f; uE5RenderProfile.ContactShadowZThickness = 0.1f; uE5RenderProfile.ContactShadowBlendStrength = 1f; uE5RenderProfile.EnableEnhancedAO = false; uE5RenderProfile.AOIntensity = 0.8f; uE5RenderProfile.AORadius = 0.3f; uE5RenderProfile.EnableACESFilmicGrading = false; uE5RenderProfile.PostExposureOffset = 0f; uE5RenderProfile.Contrast = 0f; uE5RenderProfile.Saturation = 0f; uE5RenderProfile.Temperature = 0f; uE5RenderProfile.Tint = 0f; uE5RenderProfile.Lift = new Vector4(1f, 1f, 1f, 0f); uE5RenderProfile.Gamma = new Vector4(1f, 1f, 1f, 0f); uE5RenderProfile.Gain = new Vector4(1f, 1f, 1f, 0f); uE5RenderProfile.EnablePhysicalBloom = false; uE5RenderProfile.BloomIntensity = 0.8f; uE5RenderProfile.BloomThreshold = 1.1f; uE5RenderProfile.BloomSoftKnee = 0.5f; uE5RenderProfile.BloomDiffusion = 7f; uE5RenderProfile.EnableDynamicAutofocusDoF = false; uE5RenderProfile.DoFAperture = 5.6f; uE5RenderProfile.DoFFocalLength = 50f; uE5RenderProfile.EnableMotionBlur = false; uE5RenderProfile.MotionBlurShutterAngle = 90f; uE5RenderProfile.VignetteIntensity = 0f; uE5RenderProfile.ChromaticAberrationIntensity = 0f; uE5RenderProfile.FilmGrainIntensity = 0f; uE5RenderProfile.EnableTemporalAA = false; uE5RenderProfile.TAAJitterSpread = 0.75f; uE5RenderProfile.TAAStationaryBlending = 0.95f; uE5RenderProfile.TAAMotionBlending = 0.85f; uE5RenderProfile.TAASharpness = 0.25f; uE5RenderProfile.EnableVolumetricSkyOverhaul = false; uE5RenderProfile.RayleighScatteringBoost = 1f; uE5RenderProfile.MieScatteringBoost = 1f; uE5RenderProfile.SunDirectionality = 0.7f; uE5RenderProfile.CloudSharpness = 1f; uE5RenderProfile.CloudScattering = 1f; uE5RenderProfile.GodRayIntensity = 0.4f; uE5RenderProfile.EnableScreenSpaceReflections = false; uE5RenderProfile.SSRMaxMarchDistance = 100f; uE5RenderProfile.PlanarWaterResolution = 256; uE5RenderProfile.MeshLODBias = 1.5f; uE5RenderProfile.CameraEnvironmentCullDistance = 200f; uE5RenderProfile.TerrainPixelError = 5f; uE5RenderProfile.GrassDensityMultiplier = 1f; uE5RenderProfile.GrassDrawDistance = 170f; uE5RenderProfile.EnablePBRMaterialOverhaul = false; uE5RenderProfile.TextureMipMapBias = 0f; uE5RenderProfile.NormalMapReliefBoost = 1f; uE5RenderProfile.PBRMicroSmoothnessBoost = 1f; uE5RenderProfile.SubsurfaceTranslucencyStrength = 4f; return uE5RenderProfile; } } } namespace OutwardUE5Overhaul.UI { public class UE5StudioWindow { private bool _isOpen; private Rect _windowRect = new Rect(40f, 40f, 680f, 600f); private int _selectedTab; private Vector2 _scrollPos = Vector2.zero; private string _toastMessage = string.Empty; private float _toastExpireTime = -1f; private GUIStyle _windowStyle; private GUIStyle _headerStyle; private GUIStyle _subHeaderStyle; private GUIStyle _sectionStyle; private GUIStyle _labelStyle; private GUIStyle _valueStyle; private GUIStyle _buttonStyle; private GUIStyle _activeButtonStyle; private GUIStyle _toastStyle; private bool _stylesInitialized; private Texture2D _texBg; private Texture2D _texPanel; private Texture2D _texBtn; private Texture2D _texBtnActive; private Texture2D _texToast; private float _smoothedDeltaTime = 0.016f; private bool _pendingSliderApply; private float _nextSliderApplyTime; private static readonly string[] TabNames = new string[5] { "1. Lumen GI", "2. VSM & AO", "3. ACES & Lens", "4. Sky & Water", "5. Nanite & PBR" }; public bool IsOpen { get { return _isOpen; } set { _isOpen = value; } } public void ToggleWindow() { _isOpen = !_isOpen; } public void ShowToast(string message, float duration = 3.5f) { _toastMessage = message; _toastExpireTime = Time.unscaledTime + duration; } public void UpdateMetrics() { float unscaledDeltaTime = Time.unscaledDeltaTime; if (unscaledDeltaTime > 0.0001f && unscaledDeltaTime < 1f) { _smoothedDeltaTime = Mathf.Lerp(_smoothedDeltaTime, unscaledDeltaTime, 0.08f); } } private void InitStyles() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing referenc