diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index f38f6dc0e1..7bd8af9add 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -650,6 +650,7 @@ namespace MWGui Settings::shaders().mForcePerPixelLighting.reset(); Settings::shaders().mClassicFalloff.reset(); + Settings::shaders().mMatchSunlightToSun.reset(); Settings::shaders().mLightBoundsMultiplier.reset(); Settings::shaders().mMaximumLightDistance.reset(); Settings::shaders().mLightFadeStart.reset(); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 01556d9c0c..6afbfcfe7d 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -754,13 +754,18 @@ namespace MWRender void RenderingManager::setSunDirection(const osg::Vec3f& direction) { - osg::Vec3 position = direction * -1; - // need to wrap this in a StateUpdater? - mSunLight->setPosition(osg::Vec4(position.x(), position.y(), position.z(), 0)); + osg::Vec3f position = -direction; - // The sun is not synchronized with the sunlight because sunlight origin can't reach the horizon + // The sun is not synchronized with the sunlight because reasons // This is based on exterior sun orbit and won't make sense for interiors, see WeatherManager::update position.z() = 400.f - std::abs(position.x()); + + // need to wrap this in a StateUpdater? + if (Settings::shaders().mMatchSunlightToSun) + mSunLight->setPosition(osg::Vec4f(position, 0.f)); + else + mSunLight->setPosition(osg::Vec4f(-direction, 0.f)); + mSky->setSunDirection(position); mPostProcessor->getStateUpdater()->setSunPos(osg::Vec4f(position, 0.f), mNight); diff --git a/components/settings/categories/shaders.hpp b/components/settings/categories/shaders.hpp index e6d9976e57..466c32e371 100644 --- a/components/settings/categories/shaders.hpp +++ b/components/settings/categories/shaders.hpp @@ -33,6 +33,7 @@ namespace Settings SettingValue mApplyLightingToEnvironmentMaps{ mIndex, "Shaders", "apply lighting to environment maps" }; SettingValue mLightingMethod{ mIndex, "Shaders", "lighting method" }; SettingValue mClassicFalloff{ mIndex, "Shaders", "classic falloff" }; + SettingValue mMatchSunlightToSun{ mIndex, "Shaders", "match sunlight to sun" }; SettingValue mLightBoundsMultiplier{ mIndex, "Shaders", "light bounds multiplier", makeClampSanitizerFloat(0, 5) }; SettingValue mMaximumLightDistance{ mIndex, "Shaders", "maximum light distance", diff --git a/docs/source/reference/modding/settings/shaders.rst b/docs/source/reference/modding/settings/shaders.rst index d0011df0b0..cdf6571808 100644 --- a/docs/source/reference/modding/settings/shaders.rst +++ b/docs/source/reference/modding/settings/shaders.rst @@ -210,6 +210,18 @@ Alternatively, refer to :ref:`minimum interior brightness`. 'legacy' :ref:`lighting method` behaves as if this setting were enabled. +match sunlight to sun +--------------------- + +:Type: boolean +:Range: True/False +:Default: False + +In Morrowind, the apparent sun position does not match its light direction due to mysterious reasons. +We preserve this unrealistic behavior for compatibility. + +This option makes the sun light source's position match the sun's position. + maximum light distance ---------------------- diff --git a/files/data/l10n/OMWEngine/de.yaml b/files/data/l10n/OMWEngine/de.yaml index 8543436c44..a23dbebdae 100644 --- a/files/data/l10n/OMWEngine/de.yaml +++ b/files/data/l10n/OMWEngine/de.yaml @@ -142,6 +142,12 @@ LightsMaximumDistance: "Maximale Lichtreichweite" LightsMaximumDistanceTooltip: "Standard: 8192 (1 Zelle)\nMaximale Entfernung, bis zu der Lichtquellen noch dargestellt werden (gemessen in In-Game-Einheiten).\n\nEin Wert von 0 entspricht einer unbegrenzten Reichweite." LightsMinimumInteriorBrightness: "Minimale Helligkeit in Innenräumen" LightsMinimumInteriorBrightnessTooltip: "Standard: 0,08\nMinimale Umgebungshelligkeit in Innenräumen.\n\nKann erhöht werden, falls Innenräume zu dunkel dargestellt werden.\n\nDies hat keine Auswirkung, wenn der klassische Lichtabfall verwendet wird." +MatchSunlightToSun: "Licht an Sonne ausrichten" +MatchSunlightToSunTooltip: |- + In Morrowind stimmt die sichtbare Sonnenposition aus mysteriösen Gründen nicht mit ihrer Lichtrichtung überein. + Wir bewahren dieses unrealistische Verhalten, um die Kompatibilität sicherzustellen. + + Diese Option passt die Position der Sonnenlichtquelle an die sichtbare Position der Sonne an. MaxLights: "Maximale Anzahl von Lichtquellen pro Objekt" MaxLightsTooltip: "Standard: 8\nMaximale Anzahl von Lichtquellen, die ein Objekt beleuchten können.\n\nKleine Werte können gerade an Orten mit vielen Lichtquellen zum Aufploppen und zum schnellen Wechsel von Lichtern führen, wie es aus der Original-Engine und anderen The-Elder-Scrolls-Titeln bekannt ist." MenuHelpDelay: "Verzögerung des Hilfe-Menüs" diff --git a/files/data/l10n/OMWEngine/en.yaml b/files/data/l10n/OMWEngine/en.yaml index c1e3e8b27a..8a3217a03c 100644 --- a/files/data/l10n/OMWEngine/en.yaml +++ b/files/data/l10n/OMWEngine/en.yaml @@ -142,6 +142,12 @@ 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" LightsMinimumInteriorBrightnessTooltip: "Default: 0.08\nMinimum ambient interior brightness.\n\nIncrease this if you feel interiors are too dark.\n\nThis has no effect if classic falloff is used." +MatchSunlightToSun: "Match Sunlight to Sun" +MatchSunlightToSunTooltip: |- + In Morrowind, the apparent sun position does not match its light direction due to mysterious reasons. + We preserve this unrealistic behavior for compatibility. + + This option makes the sun light source's position match the sun's position. MaxLights: "Max Lights" MaxLightsTooltip: "Default: 8\nMaximum number of lights per object.\n\nA low number near default will cause light popping similar to what you would see with legacy lighting." MenuHelpDelay: "Menu Help Delay" diff --git a/files/data/l10n/OMWEngine/fr.yaml b/files/data/l10n/OMWEngine/fr.yaml index 2ff7da5d2f..fc584d8293 100644 --- a/files/data/l10n/OMWEngine/fr.yaml +++ b/files/data/l10n/OMWEngine/fr.yaml @@ -142,6 +142,12 @@ 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" LightsMinimumInteriorBrightnessTooltip: "valeur par défaut: 0.08\nLuminosité ambiante minimum en intérieur.\n\nAugmentez cette valeur si les intérieurs vous semblent trop sombres.\n\nCela n'a aucun effet si l'atténuation classique est utilisée." +MatchSunlightToSun: "Aligner la lumière du soleil" +MatchSunlightToSunTooltip: |- + Dans Morrowind, la position apparente du soleil ne correspond pas à la direction de sa lumière pour des raisons mystérieuses. + Nous conservons ce comportement irréaliste pour maintenir la compatibilité. + + Cette option aligne la source lumineuse du soleil sur la position réelle du soleil. MaxLights: "Maximum de sources lumineuses" MaxLightsTooltip: "valeur par défaut: 8\nNombre maximum de sources lumineuses par objet.\n\nUne valeur faible mène à des apparitions tardives des sources lumineuses similaires à celles obtenues avec la méthode d'éclairage traditionnelle." MenuHelpDelay: "Délai d'affichage du menu d'aide" diff --git a/files/data/l10n/OMWEngine/ru.yaml b/files/data/l10n/OMWEngine/ru.yaml index 1dc5ccf5bf..c50fbac38e 100644 --- a/files/data/l10n/OMWEngine/ru.yaml +++ b/files/data/l10n/OMWEngine/ru.yaml @@ -142,6 +142,12 @@ LightsMaximumDistance: "Дальность отображения источни LightsMaximumDistanceTooltip: "Значение по умолчанию: 8192\nМаксимальное расстояние, на котором будут отображаться источники света (во внутриигровых единицах измерения).\n\nЕсли 0, то расстояние не ограничено." LightsMinimumInteriorBrightness: "Минимальный уровень освещения в помещениях" LightsMinimumInteriorBrightnessTooltip: "Значение по умолчанию: 0.08\nМинимальный уровень фонового освещения в помещениях.\n\nУвеличьте значение, если помещения в игре кажутся слишком темными. Эта настройка не имеет эффекта, если используется классическое угасание." +MatchSunlightToSun: "Свет солнца идет от солнца" +MatchSunlightToSunTooltip: |- + В Morrowind по загадочным причинам видимое положение солнца не соответствует направлению его света. + Мы копируем это нереалистичное поведение ради совместимости. + + Настройка делает так, чтобы направление света от солнца соответствовало его положению. MaxLights: "Макс. кол-во источников света" MaxLightsTooltip: "Значение по умолчанию: 8\nМаксимальное количество источников света для каждого объекта.\n\nНизкие числа (близкие к значению по умолчанию) приводят к резким перепадам освещения, как при устаревшем методе освещения." MenuHelpDelay: "Задержка всплывающих подсказок" diff --git a/files/data/l10n/OMWEngine/sv.yaml b/files/data/l10n/OMWEngine/sv.yaml index da5586a05d..b3bb6788ed 100644 --- a/files/data/l10n/OMWEngine/sv.yaml +++ b/files/data/l10n/OMWEngine/sv.yaml @@ -143,6 +143,12 @@ 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" LightsMinimumInteriorBrightnessTooltip: "Förvalt: 0.08\nMinsta omgivande ljusstyrka i interiörer.\n\nÖka värdet om du anser att interiörer är för mörka.\n\nDetta har ingen effekt om klassiskt ljusavtagande används." +MatchSunlightToSun: "Matcha solljus med solen" +MatchSunlightToSunTooltip: |- + I Morrowind stämmer inte solens synbara position överens med dess ljusriktning av mystiska skäl. + Vi behåller detta orealistiska beteende för att behålla kompatibilitet. + + Detta alternativ gör att solljuskällans position matchar solens synliga position. MaxLights: "Max antal ljuskällor" MaxLightsTooltip: "Förvalt: 8\nMaximalt antal ljuskällor per objekt.\n\nEtt lågt tal nära det förvalda kommer orsaka att ljuskällor poppar upp som vid ljussättningsmetoden Gammaldags." MenuHelpDelay: "Menyhjälp, fördröjning" #Unsure in what context this goes diff --git a/files/data/mygui/openmw_settings_window.layout b/files/data/mygui/openmw_settings_window.layout index 58f9ad3d75..e6f42248dd 100644 --- a/files/data/mygui/openmw_settings_window.layout +++ b/files/data/mygui/openmw_settings_window.layout @@ -1,7 +1,7 @@  - + @@ -626,15 +626,30 @@ - + + + + + + + + + + + + + + + + - + - + @@ -647,12 +662,12 @@ - + - + @@ -665,12 +680,12 @@ - + - + @@ -683,12 +698,12 @@ - + - + @@ -698,7 +713,7 @@ - + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index a5b8426f19..e5654794cc 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -484,6 +484,9 @@ lighting method = shaders compatibility # When 'lighting method' is set to 'legacy', this setting is always true. classic falloff = false +# Matches exterior sunlight to the apparent sun orbit +match sunlight to sun = false + # Sets the bounding sphere multiplier of light sources. # The bounding sphere is used to determine if an object should receive lighting. # Higher values will allow for smoother transitions of light sources,