Make light attenuation fade optional

This also makes Force Per Pixel Lighting caption shorter to provide more space for the new button
pull/3236/head
Alexei Kotov 5 months ago
parent 0cb2b71301
commit 176dec45a7

@ -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();

@ -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";
@ -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);
@ -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"

@ -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",

@ -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
----------------------
@ -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
--------------------

@ -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"
@ -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.
@ -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"

@ -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"
@ -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.
@ -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"

@ -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"
@ -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.
@ -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"

@ -78,6 +78,17 @@ CameraSensitivity: "Чувствительность камеры"
CameraZoomIn: "Приблизить камеру"
CameraZoomOut: "Отдалить камеру"
ChangeRequiresRestart: "Чтобы это изменение вступило в силу, нужно перезапустить приложение."
ClassicFalloff: "Классическое угасание"
ClassicFalloffTooltip: |-
По умолчанию: выкл
Использовать традиционную формулу угасания точечных источников света, в которой полного угасания не происходит.
Изъян традиционной формулы заключается в том, что влияние света на сцену никогда не достигает нуля.
Это корректно с физической точки зрения, но приводит к швам, потому что источник света не может влиять на всю сцену сразу.
Полное угасание позволяет сильно уменьшить количество таких швов ценой того, что сцена становится темнее.
Morrowind использует традиционную формулу, поэтому вы можете решить включить эту настройку, если изменения освещенности вам не по душе.
Кроме того, вместо включения этой настройки вы также можете попробовать изменить минимальный уровень освещения в интерьерах.
ConfirmResetBindings: "Сбросить все настройки управления?"
ConfirmResolution: "Разрешение будет изменено немедленно. Продолжить?"
Controller: "Геймпад"
@ -95,7 +106,7 @@ EnableController: "Геймпад"
FieldOfView: "Поле зрения"
FieldOfViewLow: "Маленькое"
FieldOfViewHigh: "Большое"
ForcePerPixelLighting: ринудительное попиксельное освещение"
ForcePerPixelLighting: опиксельное освещение"
ForcePerPixelLightingTooltip: |-
Использовать попиксельное освещение принудительно. По умолчанию его используют только объекты, использующие карты бампа и карты нормалей.
@ -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: "Задержка всплывающих подсказок"

@ -78,6 +78,17 @@ CameraSensitivity: "Kamerakänslighet"
CameraZoomIn: "Zooma in kamera"
CameraZoomOut: "Zooma ut kamera"
ChangeRequiresRestart: "Den här ändringen kräver omstart för att ge effekt."
ClassicFalloff: "Klassiskt ljusavtagande"
ClassicFalloffTooltip: |-
Förvalt: av
Använd den traditionella formeln för dämpning av punktljus som saknar en tidig uttoning.
En nackdel med den traditionella formeln är att ljusets påverkan aldrig riktigt når noll.
Detta är fysiskt korrekt, men kan orsaka "sömmar" eftersom ljuset inte påverkar hela scenen.
Tidig uttoning minskar synligheten av dessa sömmar på bekostnad av att scenen blir mörkare.
Morrowind använder den traditionella formeln, så du kanske vill aktivera detta om du ogillar skillnaderna i ljusstyrka.
Alternativt kan du prova att justera minsta ljusstyrkan i interiörer.
ConfirmResetBindings: "Återställ alla kontroller till standard?"
ConfirmResolution: "Ny upplösning kommer ställas in omedelbart. Vill du fortsätta?"
Controller: "Handkontroll"
@ -95,7 +106,7 @@ EnableController: "Aktivera handkontroll"
FieldOfView: "Synfält"
FieldOfViewLow: "Låg"
FieldOfViewHigh: "Hög"
ForcePerPixelLighting: "Tvinga per-pixelljussättning"
ForcePerPixelLighting: "Per-pixelljussättning"
ForcePerPixelLightingTooltip: |-
Tvingar användningen av per-pixelljussättning. Som standard är det annars bara objekt med normalkartor som använder per-pixelljussättning.
@ -131,7 +142,7 @@ LightsLightingMethodTooltip: "Välj intern hantering av ljuskällor.\n\n
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."
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."
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

@ -597,19 +597,33 @@
<Property key="AddItem" value="56"/>
<Property key="AddItem" value="64"/>
</Widget>
<!-- Per-Pixel Lighting -->
<Widget type="HBox" position="0 60 340 24">
<Widget type="HBox" position="0 60 600 24">
<!-- Per-Pixel Lighting -->
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top">
<UserString key="SettingCategory" value="Shaders"/>
<UserString key="SettingName" value="force per pixel lighting"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="#{OMWEngine:ForcePerPixelLighting}"/>
<!-- Deliberate padding -->
<Property key="Caption" value="#{OMWEngine:ForcePerPixelLighting} "/>
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:ForcePerPixelLightingTooltip}"/>
</Widget>
<!-- Classic Falloff -->
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top">
<UserString key="SettingCategory" value="Shaders"/>
<UserString key="SettingName" value="classic falloff"/>
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="#{OMWEngine:ClassicFalloff}"/>
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:ClassicFalloffTooltip}"/>
</Widget>
</Widget>
<Widget type="ImageBox" skin="MW_HLine" position="0 84 360 18" align="Top HStretch"/>

@ -476,6 +476,11 @@ apply lighting to environment maps = false
# 'force per pixel lighting' is enabled.
lighting method = shaders compatibility
# Use the traditional light attenuation formula.
# This disables OpenMW's adjustment to the formula that ensures point lights can properly fade out.
# When 'lighting method' is set to 'legacy', this setting is always true.
classic falloff = 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,
@ -496,6 +501,7 @@ max lights = 8
# Sets minimum ambient brightness of interior cells. Levels below this threshold will have their
# ambient values adjusted to balance the darker interiors.
# When 'lighting method' is set to 'legacy', this setting will have no effect.
# This setting will also have no effect if 'classic falloff' is true.
minimum interior brightness = 0.08
# Convert the alpha test (cutout/punchthrough alpha) to alpha-to-coverage.

@ -66,7 +66,7 @@ void doLighting(vec3 viewPos, vec3 viewNormal, float shininess, out vec3 diffuse
float lightDistance = length(lightPos);
// cull non-FFP point lighting by radius, light is guaranteed to not fall outside this bound with our cutoff
#if !@lightingMethodFFP
#if !@classicFalloff && !@lightingMethodFFP
if (lightDistance > lcalcRadius(lightIndex) * 2.0)
continue;
#endif

@ -106,7 +106,7 @@ float lcalcRadius(int lightIndex)
float lcalcIllumination(int lightIndex, float dist)
{
float illumination = 1.0 / (lcalcConstantAttenuation(lightIndex) + lcalcLinearAttenuation(lightIndex) * dist + lcalcQuadraticAttenuation(lightIndex) * dist * dist);
#if @lightingMethodPerObjectUniform || @lightingMethodUBO
#if !@classicFalloff && !@lightingMethodFFP
// Fade illumination between the radius and the radius doubled to diminish pop-in
illumination *= 1.0 - quickstep((dist / lcalcRadius(lightIndex)) - 1.0);
#endif

Loading…
Cancel
Save