From a340b49cbc51455ff38910f3a941a3ca2d5f4fb6 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 16 Jan 2024 10:23:13 +0400 Subject: [PATCH] Enhance light settings tweaking --- apps/launcher/settingspage.cpp | 54 +++++-- apps/launcher/settingspage.hpp | 1 + apps/launcher/ui/settingspage.ui | 138 +++++++++++++++++- apps/openmw/mwgui/settingswindow.cpp | 2 +- files/data/l10n/OMWEngine/de.yaml | 4 + files/data/l10n/OMWEngine/en.yaml | 4 + files/data/l10n/OMWEngine/fr.yaml | 4 + files/data/l10n/OMWEngine/ru.yaml | 4 + files/data/l10n/OMWEngine/sv.yaml | 4 + .../data/mygui/openmw_settings_window.layout | 9 +- 10 files changed, 200 insertions(+), 24 deletions(-) diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp index 9492326cb0..c274b75f79 100644 --- a/apps/launcher/settingspage.cpp +++ b/apps/launcher/settingspage.cpp @@ -213,21 +213,6 @@ bool Launcher::SettingsPage::loadSettings() loadSettingBool(Settings::fog().mSkyBlending, *skyBlendingCheckBox); skyBlendingStartComboBox->setValue(Settings::fog().mSkyBlendingStart); - int lightingMethod = 1; - switch (Settings::shaders().mLightingMethod) - { - case SceneUtil::LightingMethod::FFP: - lightingMethod = 0; - break; - case SceneUtil::LightingMethod::PerObjectUniform: - lightingMethod = 1; - break; - case SceneUtil::LightingMethod::SingleUBO: - lightingMethod = 2; - break; - } - lightingMethodComboBox->setCurrentIndex(lightingMethod); - loadSettingBool(Settings::shadows().mActorShadows, *actorShadowsCheckBox); loadSettingBool(Settings::shadows().mPlayerShadows, *playerShadowsCheckBox); loadSettingBool(Settings::shadows().mTerrainShadows, *terrainShadowsCheckBox); @@ -261,6 +246,31 @@ bool Launcher::SettingsPage::loadSettings() shadowResolutionComboBox->setCurrentIndex(shadowResIndex); connect(shadowDistanceCheckBox, &QCheckBox::toggled, this, &SettingsPage::slotShadowDistLimitToggled); + + lightsMaxLightsSpinBox->setValue(Settings::shaders().mMaxLights); + lightsMaximumDistanceSpinBox->setValue(Settings::shaders().mMaximumLightDistance); + lightFadeMultiplierSpinBox->setValue(Settings::shaders().mLightFadeStart); + lightsBoundingSphereMultiplierSpinBox->setValue(Settings::shaders().mLightBoundsMultiplier); + lightsMinimumInteriorBrightnessSpinBox->setValue(Settings::shaders().mMinimumInteriorBrightness); + + connect(lightingMethodComboBox, qOverload(&QComboBox::currentIndexChanged), this, + &SettingsPage::slotLightTypeCurrentIndexChanged); + + int lightingMethod = 1; + switch (Settings::shaders().mLightingMethod) + { + case SceneUtil::LightingMethod::FFP: + lightingMethod = 0; + break; + case SceneUtil::LightingMethod::PerObjectUniform: + lightingMethod = 1; + break; + case SceneUtil::LightingMethod::SingleUBO: + lightingMethod = 2; + break; + } + lightingMethodComboBox->setCurrentIndex(lightingMethod); + slotLightTypeCurrentIndexChanged(lightingMethod); } // Audio @@ -454,6 +464,12 @@ void Launcher::SettingsPage::saveSettings() Settings::shadows().mComputeSceneBounds.set("primitives"); else Settings::shadows().mComputeSceneBounds.set("none"); + + Settings::shaders().mMaxLights.set(lightsMaxLightsSpinBox->value()); + Settings::shaders().mMaximumLightDistance.set(lightsMaximumDistanceSpinBox->value()); + Settings::shaders().mLightFadeStart.set(lightFadeMultiplierSpinBox->value()); + Settings::shaders().mLightBoundsMultiplier.set(lightsBoundingSphereMultiplierSpinBox->value()); + Settings::shaders().mMinimumInteriorBrightness.set(lightsMinimumInteriorBrightnessSpinBox->value()); } // Audio @@ -562,3 +578,11 @@ void Launcher::SettingsPage::slotShadowDistLimitToggled(bool checked) shadowDistanceSpinBox->setEnabled(checked); fadeStartSpinBox->setEnabled(checked); } + +void Launcher::SettingsPage::slotLightTypeCurrentIndexChanged(int index) +{ + lightsMaximumDistanceSpinBox->setEnabled(index != 0); + lightsMaxLightsSpinBox->setEnabled(index != 0); + lightsBoundingSphereMultiplierSpinBox->setEnabled(index != 0); + lightsMinimumInteriorBrightnessSpinBox->setEnabled(index != 0); +} diff --git a/apps/launcher/settingspage.hpp b/apps/launcher/settingspage.hpp index a8a6b7c26d..ea675857ea 100644 --- a/apps/launcher/settingspage.hpp +++ b/apps/launcher/settingspage.hpp @@ -33,6 +33,7 @@ namespace Launcher void slotPostProcessToggled(bool checked); void slotSkyBlendingToggled(bool checked); void slotShadowDistLimitToggled(bool checked); + void slotLightTypeCurrentIndexChanged(int index); private: Config::GameSettings& mGameSettings; diff --git a/apps/launcher/ui/settingspage.ui b/apps/launcher/ui/settingspage.ui index cf8215ef30..7006238e71 100644 --- a/apps/launcher/ui/settingspage.ui +++ b/apps/launcher/ui/settingspage.ui @@ -1018,7 +1018,17 @@ - + + + + <html><head/><body><p>Maximum distance at which lights will appear (measured in units).</p><p>Set this to 0 to use an unlimited distance.</p></body></html> + + + Lights maximum distance + + + + Qt::Vertical @@ -1031,29 +1041,143 @@ + + + + <html><head/><body><p>Maximum number of lights per object.</p><p>A low number near default will cause light popping similar to what you would see with legacy lighting.</p></body></html> + + + Max light sources + + + + + + + <html><head/><body><p>Fraction of maximum distance at which lights will start to fade.</p><p>Set this to a low value for slower transitions or a high value for quicker transitions.</p></body></html> + + + Lights fade multiplier + + + + + + + <html><head/><body><p>Set the internal handling of light sources.</p> +<p> "Legacy" always uses 8 lights per object and provides a lighting closest to an original game.</p> +<p>"Shaders (compatibility)" removes the 8 light limit. This mode also enables lighting on groundcover and a configurable light fade. It is recommended to use this with older hardware and a light limit closer to 8.</p> +<p> "Shaders" carries all of the benefits that "Shaders (compatibility)" does, but uses a modern approach that allows for a higher max lights count with little to no performance penalties on modern hardware.</p></body></html> + + + Lighting method + + + - legacy + Legacy - shaders compatibility + Shaders (compatibility) - shaders + Shaders - - + + + + <html><head/><body><p>Multipler for bounding sphere of lights.</p><p>Higher numbers allows for smooth falloff but require an increase in number of max lights.</p><p>Does not effect the illumination or strength of lights.</p></body></html> + - Lighting method + Lights bounding sphere multiplier + + + + + + + <html><head/><body><p>Minimum ambient interior brightness.</p><p>Increase this if you feel interiors are too dark.</p></body></html> + + + Lights minimum interior brightness + + + + + + + 5.000000000000000 + + + 0.050000000000000 + + + 1.650000000000000 + + + + + + + 1.000000000000000 + + + 0.010000000000000 + + + 0.850000000000000 + + + + + + + 1.000000000000000 + + + 0.010000000000000 + + + 0.080000000000000 + + + + + + + unit(s) + + + 8192 + + + 128 + + + 8192 + + + + + + + 2 + + + 64 + + + 2 diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index fbd54586df..6a1cfaefe2 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -131,7 +131,7 @@ namespace void updateMaxLightsComboBox(MyGUI::ComboBox* box) { constexpr int min = 8; - constexpr int max = 32; + constexpr int max = 64; constexpr int increment = 8; const int maxLights = Settings::shaders().mMaxLights; // show increments of 8 in dropdown diff --git a/files/data/l10n/OMWEngine/de.yaml b/files/data/l10n/OMWEngine/de.yaml index 0f729d0077..2874001309 100644 --- a/files/data/l10n/OMWEngine/de.yaml +++ b/files/data/l10n/OMWEngine/de.yaml @@ -87,6 +87,10 @@ LightsBoundingSphereMultiplier: "Bounding-Sphere-Multiplikator" LightsBoundingSphereMultiplierTooltip: "Standard: 1.65\nMultiplikator für Begrenzungskugel.\nHöhere Zahlen ermöglichen einen sanften Abfall, erfordern jedoch eine Erhöhung der Anzahl der maximalen Lichter.\n\nBeeinflusst nicht die Beleuchtung oder Lichtstärke." LightsFadeStartMultiplier: "Licht Verblassungs-Start-Multiplikator" LightsFadeStartMultiplierTooltip: "Standard: 0.85\nBruchteil der maximalen Entfernung, bei der die Lichter zu verblassen beginnen.\n\nStellen Sie hier einen niedrigen Wert für langsamere Übergänge oder einen hohen Wert für schnellere Übergänge ein." +#LightsLightingMethodTooltip: "Set the internal handling of light sources.\n\n +# \"Legacy\" always uses 8 lights per object and provides a lighting closest to an original game.\n\n +# \"Shaders (compatibility)\" removes the 8 light limit. This mode also enables lighting on groundcover and a configurable light fade. It is recommended to use this with older hardware and a light limit closer to 8.\n\n +# \"Shaders\" carries all of the benefits that \"Shaders (compatibility)\" does, but uses a modern approach that allows for a higher max lights count with little to no performance penalties on modern hardware." LightsMaximumDistance: "Maximale Lichtreichweite" LightsMaximumDistanceTooltip: "Standard: 8192\nMaximale Entfernung, bei der Lichter erscheinen (gemessen in Einheiten).\n\nSetzen Sie dies auf 0, um eine unbegrenzte Entfernung zu verwenden." LightsMinimumInteriorBrightness: "Minimale Innenhelligkeit" diff --git a/files/data/l10n/OMWEngine/en.yaml b/files/data/l10n/OMWEngine/en.yaml index 09db2b496d..0455d11e07 100644 --- a/files/data/l10n/OMWEngine/en.yaml +++ b/files/data/l10n/OMWEngine/en.yaml @@ -107,6 +107,10 @@ LightsBoundingSphereMultiplier: "Bounding Sphere Multiplier" LightsBoundingSphereMultiplierTooltip: "Default: 1.65\nMultipler for bounding sphere of lights.\nHigher numbers allows for smooth falloff but require an increase in number of max lights.\n\nDoes not effect the illumination or strength of lights." LightsFadeStartMultiplier: "Fade Start Multiplier" LightsFadeStartMultiplierTooltip: "Default: 0.85\nFraction of maximum distance at which lights will start to fade.\n\nSet this to a low value for slower transitions or a high value for quicker transitions." +LightsLightingMethodTooltip: "Set the internal handling of light sources.\n\n + \"Legacy\" always uses 8 lights per object and provides a lighting closest to an original game.\n\n + \"Shaders (compatibility)\" removes the 8 light limit. This mode also enables lighting on groundcover and a configurable light fade. It is recommended to use this with older hardware and a light limit closer to 8.\n\n + \"Shaders\" carries all of the benefits that \"Shaders (compatibility)\" does, but uses a modern approach that allows for a higher max lights count with little to no performance penalties on modern hardware." LightsMaximumDistance: "Maximum Light Distance" LightsMaximumDistanceTooltip: "Default: 8192\nMaximum distance at which lights will appear (measured in units).\n\nSet this to 0 to use an unlimited distance." LightsMinimumInteriorBrightness: "Minimum Interior Brightness" diff --git a/files/data/l10n/OMWEngine/fr.yaml b/files/data/l10n/OMWEngine/fr.yaml index f2772b017e..85bac08612 100644 --- a/files/data/l10n/OMWEngine/fr.yaml +++ b/files/data/l10n/OMWEngine/fr.yaml @@ -107,6 +107,10 @@ LightsBoundingSphereMultiplier: "Multiplicateur de sphère englobante" LightsBoundingSphereMultiplierTooltip: "valeur par défaut: 1.65\nMultiplicateur pour le rayon de la sphère incluant les sources lumineuses.\nUn multiplicateur plus élevé permet une extinction plus douce, mais applique un plus grand nombre de sources lumineuses sur chaque objet.\n\nCe paramètre ne modifie ni l'intensité ni la luminance des lumières." LightsFadeStartMultiplier: "Seuil de perte d'éclat lumineux" LightsFadeStartMultiplierTooltip: "valeur par défaut: 0.85\nFraction de la distance maximale d'une source à partir de laquelle l'intensité lumineuse commence à décroître.\n\nSélectionnez une valeur basse pour une transition douce ou une valeur plus élevée pour une transition plus abrupte." +#LightsLightingMethodTooltip: "Set the internal handling of light sources.\n\n +# \"Legacy\" always uses 8 lights per object and provides a lighting closest to an original game.\n\n +# \"Shaders (compatibility)\" removes the 8 light limit. This mode also enables lighting on groundcover and a configurable light fade. It is recommended to use this with older hardware and a light limit closer to 8.\n\n +# \"Shaders\" carries all of the benefits that \"Shaders (compatibility)\" does, but uses a modern approach that allows for a higher max lights count with little to no performance penalties on modern hardware." LightsMaximumDistance: "Distance maximale des sources lumineuses" LightsMaximumDistanceTooltip: "valeur par défaut: 8192\nDistance maximale d'affichage des sources lumineuses (en unité de distance).\n\nMettez cette valeur à 0 pour une distance d'affichage infinie." LightsMinimumInteriorBrightness: "Luminosité intérieure minimale" diff --git a/files/data/l10n/OMWEngine/ru.yaml b/files/data/l10n/OMWEngine/ru.yaml index 2bcb76a442..8d221fe33c 100644 --- a/files/data/l10n/OMWEngine/ru.yaml +++ b/files/data/l10n/OMWEngine/ru.yaml @@ -107,6 +107,10 @@ LightsBoundingSphereMultiplier: "Множитель размера ограни LightsBoundingSphereMultiplierTooltip: "Значение по умолчанию: 1.65\nМножитель размера ограничивающей сферы источников света.\nВысокие значения делают затухание света плавнее, но требуют более высокого максимального количества источников света.\n\nНастройка не влияет на уровень освещения или мощность источников света." LightsFadeStartMultiplier: "Множитель начала затухания" LightsFadeStartMultiplierTooltip: "Значение по умолчанию: 0.85\nДоля расстояния (относительно дальности отображения источников света), на которой свет начинает затухать.\n\nНизкие значения ведут к плавному затуханию, высокие - к резкому." +LightsLightingMethodTooltip: "Задает способ обработки источников света.\n\n + \"Устаревший\" всегда использует 8 источников света на объект и выдает освещение, наиболее близкое к таковому в оригинальной игре.\n\n + \"Шейдеры (режим совместимости)\" убирает ограничение в 8 источников света. Этот режим также позволяет освещению влиять на анимированную траву и позволяет настроить угасание света на расстоянии. Рекомендуется использовать этот режим на устаревшем аппаратном обеспечении и с количеством источников света на объект около 8.\n\n + \"Шейдеры\" работает аналогично режиму \"Шейдеры (режим совместимости)\", но использует более современный подход, позволяющий использовать большее количество источников света с минимальным влиянием на производительность на современном аппаратном обеспечении." LightsMaximumDistance: "Дальность отображения источников света" LightsMaximumDistanceTooltip: "Значение по умолчанию: 8192\nМаксимальное расстояние, на котором будут отображаться источники света (во внутриигровых единицах измерения).\n\nЕсли 0, то расстояние не ограничено." LightsMinimumInteriorBrightness: "Минимальный уровень освещения в помещениях" diff --git a/files/data/l10n/OMWEngine/sv.yaml b/files/data/l10n/OMWEngine/sv.yaml index dc65726fdd..134fab0e95 100644 --- a/files/data/l10n/OMWEngine/sv.yaml +++ b/files/data/l10n/OMWEngine/sv.yaml @@ -107,6 +107,10 @@ LightsBoundingSphereMultiplier: "Gränssfärsmultiplikator" LightsBoundingSphereMultiplierTooltip: "Förvalt: 1.65\nMultiplikator för ljusens gränssfär.\nHögre värden ger mjukare minskning av gränssfären, men kräver högre värde i Max antal ljuskällor.\n\nPåverkar inte ljusstyrkan." LightsFadeStartMultiplier: "Blekningsstartmultiplikator" LightsFadeStartMultiplierTooltip: "Förvalt: 0.85\nFraktion av det maximala avståndet från vilket ljuskällor börjar blekna.\n\nVälj lågt värde för långsammare övergång eller högre värde för snabbare övergång." +#LightsLightingMethodTooltip: "Set the internal handling of light sources.\n\n +# \"Legacy\" always uses 8 lights per object and provides a lighting closest to an original game.\n\n +# \"Shaders (compatibility)\" removes the 8 light limit. This mode also enables lighting on groundcover and a configurable light fade. It is recommended to use this with older hardware and a light limit closer to 8.\n\n +# \"Shaders\" carries all of the benefits that \"Shaders (compatibility)\" does, but uses a modern approach that allows for a higher max lights count with little to no performance penalties on modern hardware." LightsMaximumDistance: "Maximalt ljusavstånd" LightsMaximumDistanceTooltip: "Förvalt: 8192\nMaximala avståndet där ljuskällor syns (mätt i enheter).\n\nVärdet 0 ger oändligt avstånd." LightsMinimumInteriorBrightness: "Minsta ljusstyrka i interiörer" diff --git a/files/data/mygui/openmw_settings_window.layout b/files/data/mygui/openmw_settings_window.layout index e912ababfd..27298b9756 100644 --- a/files/data/mygui/openmw_settings_window.layout +++ b/files/data/mygui/openmw_settings_window.layout @@ -536,6 +536,9 @@ + + + @@ -561,6 +564,10 @@ + + + + @@ -570,7 +577,7 @@ - +