Skip to content

Commit

Permalink
Merge branch 'ingameppl' into 'master'
Browse files Browse the repository at this point in the history
Move force per-pixel lighting setting to the in-game settings

See merge request OpenMW/openmw!4137
  • Loading branch information
psi29a committed Jun 10, 2024
2 parents f0019ca + 593d4ff commit 56183ba
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 63 deletions.
2 changes: 0 additions & 2 deletions apps/launcher/settingspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ bool Launcher::SettingsPage::loadSettings()
lightFadeMultiplierSpinBox->setValue(Settings::shaders().mLightFadeStart);
lightsBoundingSphereMultiplierSpinBox->setValue(Settings::shaders().mLightBoundsMultiplier);
lightsMinimumInteriorBrightnessSpinBox->setValue(Settings::shaders().mMinimumInteriorBrightness);
loadSettingBool(Settings::shaders().mForcePerPixelLighting, *forcePplCheckBox);

connect(lightingMethodComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this,
&SettingsPage::slotLightTypeCurrentIndexChanged);
Expand Down Expand Up @@ -479,7 +478,6 @@ void Launcher::SettingsPage::saveSettings()
Settings::shaders().mLightFadeStart.set(lightFadeMultiplierSpinBox->value());
Settings::shaders().mLightBoundsMultiplier.set(lightsBoundingSphereMultiplierSpinBox->value());
Settings::shaders().mMinimumInteriorBrightness.set(lightsMinimumInteriorBrightnessSpinBox->value());
saveSettingBool(*forcePplCheckBox, Settings::shaders().mForcePerPixelLighting);
}

// Audio
Expand Down
12 changes: 1 addition & 11 deletions apps/launcher/ui/settingspage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@
</property>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -1112,16 +1112,6 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="forcePplCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the use of per pixel lighting. By default, only bump and normal mapped objects use per-pixel lighting. Only affects objects drawn with shaders. Enabling per-pixel lighting results in visual differences to the original MW engine as certain lights in Morrowind rely on vertex lighting to look as intended. Note that groundcover shaders and particle effects ignore this setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Force Per-Pixel Lighting</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lightsMinimumInteriorBrightnessLabel">
<property name="toolTip">
Expand Down
1 change: 1 addition & 0 deletions apps/openmw/mwgui/settingswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ namespace MWGui
if (selectedButton == 1 || selectedButton == -1)
return;

Settings::shaders().mForcePerPixelLighting.reset();
Settings::shaders().mLightBoundsMultiplier.reset();
Settings::shaders().mMaximumLightDistance.reset();
Settings::shaders().mLightFadeStart.reset();
Expand Down
10 changes: 10 additions & 0 deletions apps/openmw/mwrender/renderingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,16 @@ namespace MWRender
if (MWMechanics::getPlayer().isInCell())
configureAmbient(*MWMechanics::getPlayer().getCell()->getCell());
}
else if (it->first == "Shaders" && it->second == "force per pixel lighting")
{
mViewer->stopThreading();

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

mViewer->startThreading();
}
else if (it->first == "Shaders"
&& (it->second == "light bounds multiplier" || it->second == "maximum light distance"
|| it->second == "light fade start" || it->second == "max lights"))
Expand Down
9 changes: 9 additions & 0 deletions files/data/l10n/OMWEngine/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ EnableController: "Controller aktivieren"
FieldOfView: "Sichtfeld"
FieldOfViewLow: "Niedrig"
FieldOfViewHigh: "Hoch"
ForcePerPixelLighting: "Beleuchtung pro Pixel erzwingen"
ForcePerPixelLightingTooltip: |-
Erzwingt die Verwendung der Beleuchtung pro Pixel. Standardmäßig verwenden nur Bump- und Normal-mapped-Objekte eine Beleuchtung pro Pixel.
Betrifft nur mit Shadern gezeichnete Objekte.
Die Aktivierung der Per-Pixel-Beleuchtung führt zu visuellen Unterschieden zur ursprünglichen Morrowind-Engine, da bestimmte Lichter in Morrowind auf Vertex-Beleuchtung angewiesen sind, um wie beabsichtigt auszusehen.
Beachten Sie, dass Bodendecker-Shader und Partikeleffekte diese Einstellung ignorieren.
FrameRateHint: "Hinweis: Drücken Sie F3,\num die aktuelle Bildrate anzuzeigen."
GammaCorrection: "Gamma-Korrektur"
GammaDark: "Dunkel"
Expand Down
9 changes: 9 additions & 0 deletions files/data/l10n/OMWEngine/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ EnableController: "Enable Controller"
FieldOfView: "Field of View"
FieldOfViewHigh: "High"
FieldOfViewLow: "Low"
ForcePerPixelLighting: "Force Per-Pixel Lighting"
ForcePerPixelLightingTooltip: |-
Force the use of per-pixel lighting. By default, only bump- and normal-mapped objects use per-pixel lighting.
Only affects objects drawn with shaders.
Enabling per-pixel lighting results in visual differences to the original MW engine as certain lights in Morrowind rely on vertex lighting to look as intended.
Note that groundcover shaders and particle effects ignore this setting.
FrameRateHint: "Hint: press F3 to show\nthe current frame rate."
GammaCorrection: "Gamma Correction"
GammaDark: "Dark"
Expand Down
9 changes: 9 additions & 0 deletions files/data/l10n/OMWEngine/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ EnableController: "Activer la manette"
FieldOfView: "Champ de vision"
FieldOfViewHigh: "Étendu"
FieldOfViewLow: "Restreint"
ForcePerPixelLighting: "Forcer l'é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.
Affecte uniquement les objets rendus via des shaders.
Activer l'éclairage par pixel donne des résultats visuels différents de ceux du moteur de jeu original, car certaines lumières de Morrowind furent implémentées pour un éclairage par vertex.
Les shaders de végétation au sol et les particules ignorent cette option.
FrameRateHint: "Note: Appuyez sur F3 pour afficher la fréquence d'affichage (FPS)."
GammaCorrection: "Correction Gamma"
GammaDark: "Sombre"
Expand Down
9 changes: 9 additions & 0 deletions files/data/l10n/OMWEngine/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ EnableController: "Геймпад"
FieldOfView: "Поле зрения"
FieldOfViewLow: "Маленькое"
FieldOfViewHigh: "Большое"
ForcePerPixelLighting: "Принудительное попиксельное освещение"
ForcePerPixelLightingTooltip: |-
Использовать попиксельное освещение принудительно. По умолчанию его используют только объекты, использующие карты бампа и карты нормалей.
Влияет только на объекты, отрисовываемые шейдерами.
Включение попиксельного освещения приводит к визуальным отличиям по сравнению с оригинальным движком Morrowind, так как некоторые источники света в Morrowind полагаются на повершинное освещение для того, чтобы выглядеть, как задумывалось.
Обратите внимание, что шейдеры растительности и системы частиц игнорируют эту настройку.
FrameRateHint: "Подсказка: нажмите F3, чтобы показать\nтекущую частоту смены кадров."
GammaCorrection: "Гамма-коррекция"
GammaDark: "Темно"
Expand Down
10 changes: 10 additions & 0 deletions files/data/l10n/OMWEngine/sv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ EnableController: "Aktivera handkontroll"
FieldOfView: "Synfält"
FieldOfViewLow: "Låg"
FieldOfViewHigh: "Hög"
ForcePerPixelLighting: "Tvinga 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.
Denna inställning påverkar endast objekt som ritas med shaderteknik.
Aktivering av per-pixelljussättning kommer ge visuella skillnader jämfört med hur Morrowind ser ut i ordinarie spelmotor.
Detta då visst ljus i Morrowind är beroende av vertexljussättning för att se ut som det var avsett.
Notera att shaders för marktäckare och partikeleffekter ignorerar denna inställning.
FrameRateHint: "Tips: tryck på F3 för att visa\naktuell bilduppdateringsfrekvens."
GammaCorrection: "Gammakorrigering"
GammaDark: "Mörkt"
Expand Down
36 changes: 26 additions & 10 deletions files/data/mygui/openmw_settings_window.layout
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,30 @@
<Property key="AddItem" value="56"/>
<Property key="AddItem" value="64"/>
</Widget>
<Widget type="ImageBox" skin="MW_HLine" position="0 54 360 18" align="Top HStretch"/>
<!-- Per-Pixel Lighting -->
<Widget type="HBox" position="0 60 340 24">
<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}"/>
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:ForcePerPixelLightingTooltip}"/>
</Widget>
</Widget>

<Widget type="ImageBox" skin="MW_HLine" position="0 84 360 18" align="Top HStretch"/>

<!-- Light Fade Start -->
<Widget type="TextBox" skin="NormalText" position="0 78 500 18" align="Left Top" name="MaxLightDistanceText">
<Widget type="TextBox" skin="NormalText" position="0 104 500 18" align="Left Top" name="MaxLightDistanceText">
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:LightsMaximumDistanceTooltip}"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HScroll" position="0 104 352 18" align="HStretch Top">
<Widget type="ScrollBar" skin="MW_HScroll" position="0 128 352 18" align="HStretch Top">
<Property key="Range" value="8193"/>
<Property key="Page" value="128"/>
<UserString key="SettingType" value="Slider"/>
Expand All @@ -617,12 +633,12 @@
<UserString key="SettingLabelCaption" value="#{OMWEngine:LightsMaximumDistance} (%s)"/>
</Widget>
<!-- Light Fade Multiplier -->
<Widget type="TextBox" skin="NormalText" position="0 128 500 18" align="Left Top" name="LightFadeMultiplierText">
<Widget type="TextBox" skin="NormalText" position="0 152 500 18" align="Left Top" name="LightFadeMultiplierText">
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:LightsFadeStartMultiplierTooltip}"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HScroll" position="0 152 352 18" align="HStretch Top">
<Widget type="ScrollBar" skin="MW_HScroll" position="0 176 352 18" align="HStretch Top">
<Property key="Range" value="10000"/>
<Property key="Page" value="100"/>
<UserString key="SettingType" value="Slider"/>
Expand All @@ -635,12 +651,12 @@
<UserString key="SettingLabelCaption" value="#{OMWEngine:LightsFadeStartMultiplier} (%s)"/>
</Widget>
<!-- Bounding Sphere Multiplier -->
<Widget type="TextBox" skin="NormalText" position="0 176 500 18" align="Left Top" name="BoundingSphereMultText">
<Widget type="TextBox" skin="NormalText" position="0 200 500 18" align="Left Top" name="BoundingSphereMultText">
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:LightsBoundingSphereMultiplierTooltip}"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HScroll" position="0 200 352 18" align="HStretch Top">
<Widget type="ScrollBar" skin="MW_HScroll" position="0 224 352 18" align="HStretch Top">
<Property key="Range" value="500000"/>
<Property key="Page" value="1000"/>
<UserString key="SettingType" value="Slider"/>
Expand All @@ -653,12 +669,12 @@
<UserString key="SettingLabelCaption" value="#{OMWEngine:LightsBoundingSphereMultiplier} (%s)"/>
</Widget>
<!-- Minimum Ambient Brightness -->
<Widget type="TextBox" skin="NormalText" position="0 224 500 18" align="Left Top" name="MinimumBrightnessText">
<Widget type="TextBox" skin="NormalText" position="0 248 500 18" align="Left Top" name="MinimumBrightnessText">
<UserString key="ToolTipType" value="Layout"/>
<UserString key="ToolTipLayout" value="TextToolTip"/>
<UserString key="Caption_Text" value="#{OMWEngine:LightsMinimumInteriorBrightnessTooltip}"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HScroll" position="0 248 352 18" align="HStretch Top">
<Widget type="ScrollBar" skin="MW_HScroll" position="0 272 352 18" align="HStretch Top">
<Property key="Range" value="10000"/>
<Property key="Page" value="100"/>
<UserString key="SettingType" value="Slider"/>
Expand All @@ -668,7 +684,7 @@
<UserString key="SettingLabelWidget" value="MinimumBrightnessText"/>
<UserString key="SettingLabelCaption" value="#{OMWEngine:LightsMinimumInteriorBrightness} (%s)"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="0 290 0 0" align="Top Left" name="LightsResetButton">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 306 0 0" align="Top Left" name="LightsResetButton">
<Property key="Caption" value="#{Interface:Reset}"/>
</Widget>
</Widget>
Expand Down
8 changes: 0 additions & 8 deletions files/lang/launcher_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,5 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
<source>Run Script After Startup:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the use of per pixel lighting. By default, only bump and normal mapped objects use per-pixel lighting. Only affects objects drawn with shaders. Enabling per-pixel lighting results in visual differences to the original MW engine as certain lights in Morrowind rely on vertex lighting to look as intended. Note that groundcover shaders and particle effects ignore this setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Force Per-Pixel Lighting</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
8 changes: 0 additions & 8 deletions files/lang/launcher_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,5 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
<source>Browse…</source>
<translation></translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the use of per pixel lighting. By default, only bump and normal mapped objects use per-pixel lighting. Only affects objects drawn with shaders. Enabling per-pixel lighting results in visual differences to the original MW engine as certain lights in Morrowind rely on vertex lighting to look as intended. Note that groundcover shaders and particle effects ignore this setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation></translation>
</message>
<message>
<source>Force Per-Pixel Lighting</source>
<translation></translation>
</message>
</context>
</TS>
8 changes: 0 additions & 8 deletions files/lang/launcher_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1474,13 +1474,5 @@ to default Morrowind fonts. Check this box if you still prefer original fonts ov
<source>Run Script After Startup:</source>
<translation>Script à lancer après démarrage :</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the use of per pixel lighting. By default, only bump and normal mapped objects use per-pixel lighting. Only affects objects drawn with shaders. Enabling per-pixel lighting results in visual differences to the original MW engine as certain lights in Morrowind rely on vertex lighting to look as intended. Note that groundcover shaders and particle effects ignore this setting.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;body&gt;&lt;p&gt;Lorsque cette option est activée, le moteur de jeu illumine séparément chaque pixel des textures (éclairage par pixel, Per Pixel Lighting) pour chaque passe de rendu.&lt;/p&gt;&lt;p&gt;Lorsque cette option est désactivée, seuls les plaquages de rugosité (bump map) et de normales (normal maps) utilisent l&apos;éclairage par pixel. Les autres passes utilisent un éclairage par vertex (sommet de chaque polygone).&lt;/p&gt;&lt;p&gt;Le rendu de l&apos;éclairage par pixel diffère de celui du moteur de jeu original du fait que certaines sources de lumière de Morrowind furent calibrées pour un éclairage par vertex.&lt;/p&gt;&lt;p&gt;Cette option affecte uniquement les objets dont le rendu est réalisé avec des shaders. Elle n&apos;affecte ni la végétation au sol ni les effets de particules.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Force Per-Pixel Lighting</source>
<translation>Forcer l&apos;éclairage par pixel</translation>
</message>
</context>
</TS>
Loading

0 comments on commit 56183ba

Please sign in to comment.