mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-27 23:09:45 +00:00
add ability to set the type of near far method to be used in shadow calculation; default to bounding volumes; cleaned up code while there and re-ordered items
This commit is contained in:
parent
476a74c2d3
commit
ae729a1ac7
6 changed files with 131 additions and 94 deletions
|
@ -1,6 +1,5 @@
|
|||
#include "graphicspage.hpp"
|
||||
|
||||
#include <csignal>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
@ -145,6 +144,10 @@ bool Launcher::GraphicsPage::loadSettings()
|
|||
if (mEngineSettings.getBool("enable indoor shadows", "Shadows"))
|
||||
indoorShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
|
||||
shadowNearFarComputationComboBox->setCurrentIndex(
|
||||
shadowNearFarComputationComboBox->findText(
|
||||
QString(tr(mEngineSettings.getString("near far computation", "Shadows").c_str()))));
|
||||
|
||||
int shadowDistLimit = mEngineSettings.getInt("maximum shadow map distance", "Shadows");
|
||||
if (shadowDistLimit > 0)
|
||||
{
|
||||
|
@ -231,7 +234,7 @@ void Launcher::GraphicsPage::saveSettings()
|
|||
bool cPlayerShadows = playerShadowsCheckBox->checkState();
|
||||
if (cActorShadows || cObjectShadows || cTerrainShadows || cPlayerShadows)
|
||||
{
|
||||
if (mEngineSettings.getBool("enable shadows", "Shadows") != true)
|
||||
if (!mEngineSettings.getBool("enable shadows", "Shadows"))
|
||||
mEngineSettings.setBool("enable shadows", "Shadows", true);
|
||||
if (mEngineSettings.getBool("actor shadows", "Shadows") != cActorShadows)
|
||||
mEngineSettings.setBool("actor shadows", "Shadows", cActorShadows);
|
||||
|
@ -263,6 +266,10 @@ void Launcher::GraphicsPage::saveSettings()
|
|||
int cShadowRes = shadowResolutionComboBox->currentText().toInt();
|
||||
if (cShadowRes != mEngineSettings.getInt("shadow map resolution", "Shadows"))
|
||||
mEngineSettings.setInt("shadow map resolution", "Shadows", cShadowRes);
|
||||
|
||||
auto cShadowNearFarMode = shadowNearFarComputationComboBox->currentText().toStdString();
|
||||
if (cShadowNearFarMode != mEngineSettings.getString("near far computation", "Shadows"))
|
||||
mEngineSettings.setString("near far computation", "Shadows", cShadowNearFarMode);
|
||||
}
|
||||
|
||||
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace Launcher
|
|||
Files::ConfigurationManager &mCfgMgr;
|
||||
Settings::Manager &mEngineSettings;
|
||||
|
||||
QStringList getAvailableResolutions(int screen);
|
||||
QRect getMaximumResolution();
|
||||
static QStringList getAvailableResolutions(int screen);
|
||||
static QRect getMaximumResolution();
|
||||
|
||||
bool setupSDL();
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <osgShadow/ShadowedScene>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace SceneUtil
|
||||
|
@ -38,11 +39,14 @@ namespace SceneUtil
|
|||
}
|
||||
|
||||
mShadowSettings->setMinimumShadowMapNearFarRatio(Settings::Manager::getFloat("minimum lispsm near far ratio", "Shadows"));
|
||||
if (Settings::Manager::getBool("compute tight scene bounds", "Shadows"))
|
||||
|
||||
std::string computeNearFarMode = Settings::Manager::getString("near far computation", "Shadows");
|
||||
if (Misc::StringUtils::lowerCase(computeNearFarMode) == "primitives")
|
||||
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
||||
else
|
||||
else if (Misc::StringUtils::lowerCase(computeNearFarMode) == "bounding volumes")
|
||||
mShadowSettings->setComputeNearFarModeOverride(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
|
||||
|
||||
|
||||
int mapres = Settings::Manager::getInt("shadow map resolution", "Shadows");
|
||||
mShadowSettings->setTextureSize(osg::Vec2s(mapres, mapres));
|
||||
|
||||
|
|
|
@ -80,15 +80,15 @@ enable debug overlay
|
|||
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.
|
||||
|
||||
compute tight scene bounds
|
||||
--------------------------
|
||||
near far computation
|
||||
--------------------
|
||||
|
||||
:Type: boolean
|
||||
:Range: True/False
|
||||
:Default: True
|
||||
:Type: string
|
||||
:Range: bounding volumes|primitives
|
||||
:Default: bounding volumes
|
||||
|
||||
With this setting enabled, attempt to better use the shadow map(s) by making them cover a smaller area.
|
||||
May have a minor to major performance impact.
|
||||
Two different ways to make better use of shadow map(s) by making them cover a smaller area.
|
||||
While primitives give better results at expense of more CPU, bounding volumes gives better performance overall but with lower quality shadows.
|
||||
|
||||
shadow map resolution
|
||||
---------------------
|
||||
|
|
|
@ -805,8 +805,8 @@ enable debug hud = false
|
|||
# Enable the debug overlay to see where each shadow map affects.
|
||||
enable debug overlay = false
|
||||
|
||||
# Attempt to better use the shadow map by making them cover a smaller area. May have a minor to major performance impact.
|
||||
compute tight scene bounds = true
|
||||
# Used to set type of tight scene bound calculation that makes use the shadow map by making them cover a smaller area. "bounding volumes" (default) is less precise shadows but lower CPU cost or "primitives" for more precise shadows at expense of CPU.
|
||||
near far computation = bounding volumes
|
||||
|
||||
# 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
|
||||
|
|
|
@ -201,49 +201,92 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<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">
|
||||
<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 name="text">
|
||||
<string>Shadow Distance Limit:</string>
|
||||
<string>Enable Player Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="shadowDistanceSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="actorShadowsCheckBox">
|
||||
<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>
|
||||
<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="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 name="text">
|
||||
<string>Enable Actor Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="fadeStartLabel">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="objectShadowsCheckBox">
|
||||
<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>
|
||||
<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>Fade Start Multiplier:</string>
|
||||
<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="shadowNearFarComputationLabel">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Type of "near far plane" computation method to be used. Bounding Volumes (default) for better performance, Primitives for better looking shadows or none.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shadow Near Far Computation Method:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="shadowNearFarComputationComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bounding volumes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>primitives</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="shadowResolutionComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -267,27 +310,49 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="actorShadowsCheckBox">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="shadowDistanceCheckBox">
|
||||
<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 name="text">
|
||||
<string>Enable Actor Shadows</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>
|
||||
<string>Shadow Distance Limit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -306,46 +371,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue