Skip to content

Commit

Permalink
Merge branch 'optionallightfadeout' into 'master'
Browse files Browse the repository at this point in the history
Make light attenuation fade optional

See merge request OpenMW/openmw!4267
  • Loading branch information
psi29a committed Sep 5, 2024
2 parents e1875d4 + 176dec4 commit 4c28731
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 22 deletions.
1 change: 1 addition & 0 deletions apps/openmw/mwgui/settingswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ namespace MWGui
return;

Settings::shaders().mForcePerPixelLighting.reset();
Settings::shaders().mClassicFalloff.reset();
Settings::shaders().mLightBoundsMultiplier.reset();
Settings::shaders().mMaximumLightDistance.reset();
Settings::shaders().mLightFadeStart.reset();
Expand Down
10 changes: 8 additions & 2 deletions apps/openmw/mwrender/renderingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ namespace MWRender
globalDefines["forcePPL"] = Settings::shaders().mForcePerPixelLighting ? "1" : "0";
globalDefines["clamp"] = Settings::shaders().mClampLighting ? "1" : "0";
globalDefines["preLightEnv"] = Settings::shaders().mApplyLightingToEnvironmentMaps ? "1" : "0";
globalDefines["classicFalloff"] = Settings::shaders().mClassicFalloff ? "1" : "0";
const bool exponentialFog = Settings::fog().mExponentialFog;
globalDefines["radialFog"] = (exponentialFog || Settings::fog().mRadialFog) ? "1" : "0";
globalDefines["exponentialFog"] = exponentialFog ? "1" : "0";
Expand Down Expand Up @@ -710,7 +711,7 @@ namespace MWRender
bool isInterior = !cell.isExterior() && !cell.isQuasiExterior();
bool needsAdjusting = false;
if (mResourceSystem->getSceneManager()->getLightingMethod() != SceneUtil::LightingMethod::FFP)
needsAdjusting = isInterior;
needsAdjusting = isInterior && !Settings::shaders().mClassicFalloff;

osg::Vec4f ambient = SceneUtil::colourFromRGB(cell.getMood().mAmbiantColor);

Expand Down Expand Up @@ -1547,14 +1548,19 @@ namespace MWRender
if (MWMechanics::getPlayer().isInCell())
configureAmbient(*MWMechanics::getPlayer().getCell()->getCell());
}
else if (it->first == "Shaders" && it->second == "force per pixel lighting")
else if (it->first == "Shaders"
&& (it->second == "force per pixel lighting" || it->second == "classic falloff"))
{
mViewer->stopThreading();

auto defines = mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines();
defines["forcePPL"] = Settings::shaders().mForcePerPixelLighting ? "1" : "0";
defines["classicFalloff"] = Settings::shaders().mClassicFalloff ? "1" : "0";
mResourceSystem->getSceneManager()->getShaderManager().setGlobalDefines(defines);

if (MWMechanics::getPlayer().isInCell() && it->second == "classic falloff")
configureAmbient(*MWMechanics::getPlayer().getCell()->getCell());

mViewer->startThreading();
}
else if (it->first == "Shaders"
Expand Down
1 change: 1 addition & 0 deletions components/settings/categories/shaders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace Settings
SettingValue<std::string> mTerrainSpecularMapPattern{ mIndex, "Shaders", "terrain specular map pattern" };
SettingValue<bool> mApplyLightingToEnvironmentMaps{ mIndex, "Shaders", "apply lighting to environment maps" };
SettingValue<SceneUtil::LightingMethod> mLightingMethod{ mIndex, "Shaders", "lighting method" };
SettingValue<bool> mClassicFalloff{ mIndex, "Shaders", "classic falloff" };
SettingValue<float> mLightBoundsMultiplier{ mIndex, "Shaders", "light bounds multiplier",
makeClampSanitizerFloat(0, 5) };
SettingValue<float> mMaximumLightDistance{ mIndex, "Shaders", "maximum light distance",
Expand Down
31 changes: 26 additions & 5 deletions docs/source/reference/modding/settings/shaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,25 @@ torches and lanterns.

In Morrowind, this multiplier is non-existent, i.e. it is always 1.0.

classic falloff
---------------

:Type: boolean
:Range: True/False
:Default: False

Use the traditional point light attenuation formula which lacks an early fade out.

A flaw of the traditional formula is that light influence never quite reaches zero.
This is physically accurate, but because lights don't have infinite radius (see :ref:`light bounds multiplier`),
this can cause lighting seams between objects that got the relevant point light assigned and objects that didn't.
Early fade out helps diminish these seams at the cost of darkening the scene.

Morrowind uses the traditional formula, so you may want to enable this if you dislike the brightness differences.
Alternatively, refer to :ref:`minimum interior brightness`.

'legacy' :ref:`lighting method` behaves as if this setting were enabled.

maximum light distance
----------------------

Expand Down Expand Up @@ -237,17 +256,19 @@ minimum interior brightness
:Range: 0.0-1.0
:Default: 0.08

Sets the minimum interior ambient brightness for interior cells when
:ref:`lighting method` is not 'legacy'. A consequence of the new lighting system
is that interiors will sometimes be darker since light sources now have sensible
fall-offs. A couple solutions are to either add more lights or increase their
Sets the minimum interior ambient brightness for interior cells.

A consequence of the new lighting system is that interiors will sometimes be darker
since light sources now have sensible fall-offs.
A couple solutions are to either add more lights or increase their
radii to compensate, but these require content changes. For best results it is
recommended to set this to 0.0 to retain the colors that level designers
intended. If brighter interiors are wanted, however, this setting should be
increased. Note, it is advised to keep this number small (< 0.1) to avoid the
aforementioned changes in visuals.

This setting has no effect if :ref:`lighting method` is 'legacy'.
This setting has no effect if :ref:`lighting method` is 'legacy'
or if :ref:`classic falloff` is enabled.

antialias alpha test
--------------------
Expand Down
15 changes: 13 additions & 2 deletions files/data/l10n/OMWEngine/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ CameraSensitivity: "Kameraempfindlichkeit"
CameraZoomIn: "Kamera hineinzoomen"
CameraZoomOut: "Kamera herauszoomen"
ChangeRequiresRestart: "Diese Änderung erfordert einen Neustart, um wirksam zu werden."
ClassicFalloff: "Klassischer Lichtabfall"
ClassicFalloffTooltip: |-
Standard: aus
Verwendet die traditionelle Formel für die Abschwächung von Punktlichtquellen, die kein frühzeitiges Ausblenden aufweist.
Ein Nachteil der traditionellen Formel ist, dass der Lichteinfluss nie ganz Null erreicht.
Dies ist physikalisch korrekt, kann aber zu Beleuchtungsnähten führen, da Lichter nicht die gesamte Szene beeinflussen.
Frühzeitiges Ausblenden hilft, diese Nähte zu verringern, allerdings auf Kosten einer dunkleren Szene.
Morrowind verwendet die traditionelle Formel, daher möchten Sie dies möglicherweise aktivieren, wenn Ihnen die Helligkeitsunterschiede nicht gefallen.
Alternativ können Sie versuchen, die minimale Innenraumhelligkeit zu ändern.
ConfirmResetBindings: "Alle Tastenbelegungen zurücksetzen?"
ConfirmResolution: "Neue Auflösung wird sofort angewendet. Fortsetzen?"
Controller: "Controller"
Expand All @@ -95,7 +106,7 @@ EnableController: "Controller aktivieren"
FieldOfView: "Sichtfeld"
FieldOfViewLow: "Niedrig"
FieldOfViewHigh: "Hoch"
ForcePerPixelLighting: "Beleuchtung pro Pixel erzwingen"
ForcePerPixelLighting: "Beleuchtung pro Pixel"
ForcePerPixelLightingTooltip: |-
Erzwingt die Verwendung der Beleuchtung pro Pixel. Standardmäßig verwenden nur Bump- und Normal-mapped-Objekte eine Beleuchtung pro Pixel.
Expand Down Expand Up @@ -130,7 +141,7 @@ LightsLightingMethodTooltip: "Legt die interne Behandlung von Lichtquellen fest.
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 (v.a. bei Shader-Beleuchtungsmethoden) zu dunkel dargestellt werden."
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."
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"
Expand Down
15 changes: 13 additions & 2 deletions files/data/l10n/OMWEngine/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ CameraSensitivity: "Camera Sensitivity"
CameraZoomIn: "Zoom Camera In"
CameraZoomOut: "Zoom Camera Out"
ChangeRequiresRestart: "This change requires a restart to take effect."
ClassicFalloff: "Classic Falloff"
ClassicFalloffTooltip: |-
Default: off
Use the traditional point light attenuation formula which lacks an early fade out.
A flaw of the traditional formula is that light influence never quite reaches zero.
This is physically accurate, but can cause lighting seams because lights do not affect the entire scene.
Early fade out helps diminish these seams at the cost of darkening the scene.
Morrowind uses the traditional formula, so you may want to enable this if you dislike the brightness differences.
Alternatively, try changing the minimum interior brightness.
ConfirmResetBindings: "Reset all controls to the default?"
ConfirmResolution: "New resolution will be applied immediately. Do you want to continue?"
Controller: "Controller"
Expand All @@ -95,7 +106,7 @@ EnableController: "Enable Controller"
FieldOfView: "Field of View"
FieldOfViewHigh: "High"
FieldOfViewLow: "Low"
ForcePerPixelLighting: "Force Per-Pixel Lighting"
ForcePerPixelLighting: "Per-Pixel Lighting"
ForcePerPixelLightingTooltip: |-
Force the use of per-pixel lighting. By default, only bump- and normal-mapped objects use per-pixel lighting.
Expand Down Expand Up @@ -130,7 +141,7 @@ LightsLightingMethodTooltip: "Set the internal handling of light sources.\n\n
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."
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."
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"
Expand Down
15 changes: 13 additions & 2 deletions files/data/l10n/OMWEngine/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ CameraSensitivity: "Sensibilité de la caméra"
CameraZoomIn: "Zoom avant de la caméra"
CameraZoomOut: "Zoom arrière de la caméra"
ChangeRequiresRestart: "Ce changement requiert un redémarrage de l'application pour prendre effet."
ClassicFalloff: "Atténuation classique"
ClassicFalloffTooltip: |-
valeur par défaut: inactif
Utilise la formule traditionnelle d'atténuation de la lumière ponctuelle qui n'a pas de diminution précoce.
Un défaut de la formule traditionnelle est que l'influence de la lumière n'atteint jamais tout à fait zéro.
C'est physiquement précis, mais peut causer des coutures d'éclairage car les lumières n'affectent pas toute la scène.
La diminution précoce aide à atténuer ces coutures au prix d'un assombrissement de la scène.
Morrowind utilise la formule traditionnelle, vous pourriez donc vouloir activer ceci si vous n'aimez pas les différences de luminosité.
Alternativement, essayez de modifier la luminosité minimale intérieure.
ConfirmResetBindings: "Réinitialiser tous les contrôles à leurs valeurs par défaut ?"
ConfirmResolution: "La nouvelle résolution d'affichage sera appliquée instantanément. Voulez-vous continuer ?"
Controller: "Manette"
Expand All @@ -95,7 +106,7 @@ EnableController: "Activer la manette"
FieldOfView: "Champ de vision"
FieldOfViewHigh: "Étendu"
FieldOfViewLow: "Restreint"
ForcePerPixelLighting: "Forcer l'éclairage par pixel"
ForcePerPixelLighting: "Éclairage par pixel"
ForcePerPixelLightingTooltip: |-
Force l'usage de l'éclairage par pixel. Par défaut, seuls les objets avec des "bump" et "normal" maps utilisent l'éclairage par pixel.
Expand Down Expand Up @@ -130,7 +141,7 @@ LightsLightingMethodTooltip: "Définit la gestion des sources lumineuses :\n\n
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."
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."
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"
Expand Down
15 changes: 13 additions & 2 deletions files/data/l10n/OMWEngine/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ CameraSensitivity: "Чувствительность камеры"
CameraZoomIn: "Приблизить камеру"
CameraZoomOut: "Отдалить камеру"
ChangeRequiresRestart: "Чтобы это изменение вступило в силу, нужно перезапустить приложение."
ClassicFalloff: "Классическое угасание"
ClassicFalloffTooltip: |-
По умолчанию: выкл
Использовать традиционную формулу угасания точечных источников света, в которой полного угасания не происходит.
Изъян традиционной формулы заключается в том, что влияние света на сцену никогда не достигает нуля.
Это корректно с физической точки зрения, но приводит к швам, потому что источник света не может влиять на всю сцену сразу.
Полное угасание позволяет сильно уменьшить количество таких швов ценой того, что сцена становится темнее.
Morrowind использует традиционную формулу, поэтому вы можете решить включить эту настройку, если изменения освещенности вам не по душе.
Кроме того, вместо включения этой настройки вы также можете попробовать изменить минимальный уровень освещения в интерьерах.
ConfirmResetBindings: "Сбросить все настройки управления?"
ConfirmResolution: "Разрешение будет изменено немедленно. Продолжить?"
Controller: "Геймпад"
Expand All @@ -95,7 +106,7 @@ EnableController: "Геймпад"
FieldOfView: "Поле зрения"
FieldOfViewLow: "Маленькое"
FieldOfViewHigh: "Большое"
ForcePerPixelLighting: "Принудительное попиксельное освещение"
ForcePerPixelLighting: "Попиксельное освещение"
ForcePerPixelLightingTooltip: |-
Использовать попиксельное освещение принудительно. По умолчанию его используют только объекты, использующие карты бампа и карты нормалей.
Expand Down Expand Up @@ -130,7 +141,7 @@ LightsLightingMethodTooltip: "Задает способ обработки ис
LightsMaximumDistance: "Дальность отображения источников света"
LightsMaximumDistanceTooltip: "Значение по умолчанию: 8192\nМаксимальное расстояние, на котором будут отображаться источники света (во внутриигровых единицах измерения).\n\nЕсли 0, то расстояние не ограничено."
LightsMinimumInteriorBrightness: "Минимальный уровень освещения в помещениях"
LightsMinimumInteriorBrightnessTooltip: "Значение по умолчанию: 0.08\nМинимальный уровень фонового освещения в помещениях.\n\nУвеличьте значение, если помещения в игре кажутся слишком темными."
LightsMinimumInteriorBrightnessTooltip: "Значение по умолчанию: 0.08\nМинимальный уровень фонового освещения в помещениях.\n\nУвеличьте значение, если помещения в игре кажутся слишком темными. Эта настройка не имеет эффекта, если используется классическое угасание."
MaxLights: "Макс. кол-во источников света"
MaxLightsTooltip: "Значение по умолчанию: 8\nМаксимальное количество источников света для каждого объекта.\n\nНизкие числа (близкие к значению по умолчанию) приводят к резким перепадам освещения, как при устаревшем методе освещения."
MenuHelpDelay: "Задержка всплывающих подсказок"
Expand Down
Loading

0 comments on commit 4c28731

Please sign in to comment.