mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
Merge branch 'near_far_mode_in_launcher' into 'master'
add ability to set the type of near far method to be used See merge request OpenMW/openmw!190
This commit is contained in:
commit
5110b5a0bf
6 changed files with 147 additions and 106 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include "graphicspage.hpp"
|
#include "graphicspage.hpp"
|
||||||
|
|
||||||
#include <csignal>
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -145,6 +144,10 @@ bool Launcher::GraphicsPage::loadSettings()
|
||||||
if (mEngineSettings.getBool("enable indoor shadows", "Shadows"))
|
if (mEngineSettings.getBool("enable indoor shadows", "Shadows"))
|
||||||
indoorShadowsCheckBox->setCheckState(Qt::Checked);
|
indoorShadowsCheckBox->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
|
shadowComputeSceneBoundsComboBox->setCurrentIndex(
|
||||||
|
shadowComputeSceneBoundsComboBox->findText(
|
||||||
|
QString(tr(mEngineSettings.getString("compute scene bounds", "Shadows").c_str()))));
|
||||||
|
|
||||||
int shadowDistLimit = mEngineSettings.getInt("maximum shadow map distance", "Shadows");
|
int shadowDistLimit = mEngineSettings.getInt("maximum shadow map distance", "Shadows");
|
||||||
if (shadowDistLimit > 0)
|
if (shadowDistLimit > 0)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +234,7 @@ void Launcher::GraphicsPage::saveSettings()
|
||||||
bool cPlayerShadows = playerShadowsCheckBox->checkState();
|
bool cPlayerShadows = playerShadowsCheckBox->checkState();
|
||||||
if (cActorShadows || cObjectShadows || cTerrainShadows || cPlayerShadows)
|
if (cActorShadows || cObjectShadows || cTerrainShadows || cPlayerShadows)
|
||||||
{
|
{
|
||||||
if (mEngineSettings.getBool("enable shadows", "Shadows") != true)
|
if (!mEngineSettings.getBool("enable shadows", "Shadows"))
|
||||||
mEngineSettings.setBool("enable shadows", "Shadows", true);
|
mEngineSettings.setBool("enable shadows", "Shadows", true);
|
||||||
if (mEngineSettings.getBool("actor shadows", "Shadows") != cActorShadows)
|
if (mEngineSettings.getBool("actor shadows", "Shadows") != cActorShadows)
|
||||||
mEngineSettings.setBool("actor shadows", "Shadows", cActorShadows);
|
mEngineSettings.setBool("actor shadows", "Shadows", cActorShadows);
|
||||||
|
@ -263,6 +266,10 @@ void Launcher::GraphicsPage::saveSettings()
|
||||||
int cShadowRes = shadowResolutionComboBox->currentText().toInt();
|
int cShadowRes = shadowResolutionComboBox->currentText().toInt();
|
||||||
if (cShadowRes != mEngineSettings.getInt("shadow map resolution", "Shadows"))
|
if (cShadowRes != mEngineSettings.getInt("shadow map resolution", "Shadows"))
|
||||||
mEngineSettings.setInt("shadow map resolution", "Shadows", cShadowRes);
|
mEngineSettings.setInt("shadow map resolution", "Shadows", cShadowRes);
|
||||||
|
|
||||||
|
auto cComputeSceneBounds = shadowComputeSceneBoundsComboBox->currentText().toStdString();
|
||||||
|
if (cComputeSceneBounds != mEngineSettings.getString("compute scene bounds", "Shadows"))
|
||||||
|
mEngineSettings.setString("compute scene bounds", "Shadows", cComputeSceneBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace Launcher
|
||||||
Files::ConfigurationManager &mCfgMgr;
|
Files::ConfigurationManager &mCfgMgr;
|
||||||
Settings::Manager &mEngineSettings;
|
Settings::Manager &mEngineSettings;
|
||||||
|
|
||||||
QStringList getAvailableResolutions(int screen);
|
static QStringList getAvailableResolutions(int screen);
|
||||||
QRect getMaximumResolution();
|
static QRect getMaximumResolution();
|
||||||
|
|
||||||
bool setupSDL();
|
bool setupSDL();
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <osgShadow/ShadowedScene>
|
#include <osgShadow/ShadowedScene>
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
|
@ -38,9 +39,11 @@ namespace SceneUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
mShadowSettings->setMinimumShadowMapNearFarRatio(Settings::Manager::getFloat("minimum lispsm near far ratio", "Shadows"));
|
mShadowSettings->setMinimumShadowMapNearFarRatio(Settings::Manager::getFloat("minimum lispsm near far ratio", "Shadows"));
|
||||||
if (Settings::Manager::getBool("compute tight scene bounds", "Shadows"))
|
|
||||||
|
std::string computeSceneBounds = Settings::Manager::getString("compute scene bounds", "Shadows");
|
||||||
|
if (Misc::StringUtils::lowerCase(computeSceneBounds) == "primitives")
|
||||||
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
||||||
else
|
else if (Misc::StringUtils::lowerCase(computeSceneBounds) == "bounds")
|
||||||
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
|
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
|
||||||
|
|
||||||
int mapres = Settings::Manager::getInt("shadow map resolution", "Shadows");
|
int mapres = Settings::Manager::getInt("shadow map resolution", "Shadows");
|
||||||
|
|
|
@ -71,7 +71,7 @@ Enable or disable the debug hud to see what the shadow map(s) contain.
|
||||||
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
|
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
|
||||||
|
|
||||||
enable debug overlay
|
enable debug overlay
|
||||||
----------------
|
--------------------
|
||||||
|
|
||||||
:Type: boolean
|
:Type: boolean
|
||||||
:Range: True/False
|
:Range: True/False
|
||||||
|
@ -80,15 +80,15 @@ enable debug overlay
|
||||||
Enable or disable the debug overlay to see the area covered by each shadow map.
|
Enable or disable the debug overlay to see the area covered by each shadow map.
|
||||||
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
|
This setting is only recommended for developers, bug reporting and advanced users performing fine-tuning of shadow settings.
|
||||||
|
|
||||||
compute tight scene bounds
|
compute scene bounds
|
||||||
--------------------------
|
--------------------
|
||||||
|
|
||||||
:Type: boolean
|
:Type: string
|
||||||
:Range: True/False
|
:Range: primitives|bounds|none
|
||||||
:Default: True
|
:Default: bounding volumes
|
||||||
|
|
||||||
With this setting enabled, attempt to better use the shadow map(s) by making them cover a smaller area.
|
Two different ways to make better use of shadow map(s) by making them cover a smaller area.
|
||||||
May have a minor to major performance impact.
|
While primitives give better shadows at expense of more CPU, bounds gives better performance overall but with lower quality shadows. There is also the ability to disable this computation with none.
|
||||||
|
|
||||||
shadow map resolution
|
shadow map resolution
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -829,8 +829,8 @@ enable debug hud = false
|
||||||
# Enable the debug overlay to see where each shadow map affects.
|
# Enable the debug overlay to see where each shadow map affects.
|
||||||
enable debug overlay = false
|
enable debug overlay = false
|
||||||
|
|
||||||
# Attempt to better use the shadow map by making them cover a smaller area. May have a major performance impact.
|
# Used to set the type of tight scene bound calculation method to be used by the shadow map that covers a smaller area. "bounds" (default) is less precise shadows but better performance or "primitives" for more precise shadows at expense of CPU.
|
||||||
compute tight scene bounds = false
|
compute scene bounds = bounds
|
||||||
|
|
||||||
# How large to make the shadow map(s). Higher values increase GPU load, but can produce better-looking results. Power-of-two values may turn out to be faster on some GPU/driver combinations.
|
# How large to make the shadow map(s). Higher values increase GPU load, but can produce better-looking results. Power-of-two values may turn out to be faster on some GPU/driver combinations.
|
||||||
shadow map resolution = 1024
|
shadow map resolution = 1024
|
||||||
|
|
|
@ -201,49 +201,97 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="shadowsLayout" columnstretch="0,0">
|
<layout class="QGridLayout" name="shadowsLayout" columnstretch="0,0">
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QCheckBox" name="shadowDistanceCheckBox">
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="playerShadowsCheckBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The distance from the camera at which shadows completely disappear.</p></body></html></string>
|
<string><html><head/><body><p>Enable shadows exclusively for the player character. May have a very minor performance impact.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Shadow Distance Limit:</string>
|
<string>Enable Player Shadows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="actorShadowsCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Enable shadows for NPCs and creatures besides the player character. May have a minor performance impact.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Actor Shadows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="objectShadowsCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Enable shadows for primarily inanimate objects. May have a significant performance impact.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Object Shadows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QCheckBox" name="terrainShadowsCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Enable shadows for the terrain including distant terrain. May have a significant performance and shadow quality impact.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Terrain Shadows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QCheckBox" name="indoorShadowsCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Due to limitations with Morrowind's data, only actors can cast shadows indoors, which some might feel is distracting.</p><p>Has no effect if actor/player shadows are not enabled.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Indoor Shadows</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="shadowComputeSceneBoundsLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Type of "compute scene bounds" computation method to be used. Bounds (default) for good balance between performance and shadow quality, primitives for better looking shadows or none for no computation.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shadow Near Far Computation Method:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">compute scene bounds
|
||||||
|
<widget class="QComboBox" name="shadowComputeSceneBoundsComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>bounds</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>primitives</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>none</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="shadowResolutionLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>The resolution of each individual shadow map. Increasing it significantly improves shadow quality but may have a minor performance impact.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shadow Map Resolution:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QSpinBox" name="shadowDistanceSpinBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>64 game units is 1 real life yard or about 0.9 m</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> unit(s)</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>512</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>81920</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>8192</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="fadeStartLabel">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>The fraction of the limit above at which shadows begin to gradually fade away.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Fade Start Multiplier:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QComboBox" name="shadowResolutionComboBox">
|
<widget class="QComboBox" name="shadowResolutionComboBox">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -267,27 +315,49 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="actorShadowsCheckBox">
|
<widget class="QCheckBox" name="shadowDistanceCheckBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Enable shadows for NPCs and creatures besides the player character. May have a minor performance impact.</p></body></html></string>
|
<string><html><head/><body><p>The distance from the camera at which shadows completely disappear.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable Actor Shadows</string>
|
<string>Shadow Distance Limit:</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" alignment="Qt::AlignLeft">
|
|
||||||
<widget class="QCheckBox" name="terrainShadowsCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Enable shadows for the terrain including distant terrain. May have a significant performance and shadow quality impact.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable Terrain Shadows</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
|
<widget class="QSpinBox" name="shadowDistanceSpinBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>64 game units is 1 real life yard or about 0.9 m</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> unit(s)</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>512</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>81920</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>8192</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="fadeStartLabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>The fraction of the limit above at which shadows begin to gradually fade away.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fade Start Multiplier:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="fadeStartSpinBox">
|
<widget class="QDoubleSpinBox" name="fadeStartSpinBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -306,46 +376,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="playerShadowsCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Enable shadows exclusively for the player character. May have a very minor performance impact.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable Player Shadows</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" alignment="Qt::AlignLeft">
|
|
||||||
<widget class="QLabel" name="shadowResolutionLabel">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>The resolution of each individual shadow map. Increasing it significantly improves shadow quality but may have a minor performance impact.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Shadow Map Resolution:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QCheckBox" name="objectShadowsCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Enable shadows for primarily inanimate objects. May have a significant performance impact.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable Object Shadows</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QCheckBox" name="indoorShadowsCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Due to limitations with Morrowind's data, only actors can cast shadows indoors, which some might feel is distracting.</p><p>Has no effect if actor/player shadows are not enabled.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable Indoor Shadows</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue