Allow opting out of water culling (#7318)

pull/3236/head
Alexei Kotov 2 months ago
parent 34b6a9d402
commit 4f521a94d7

@ -238,6 +238,7 @@
Feature #7194: Ori to show texture paths
Feature #7214: Searching in the in-game console
Feature #7248: Searching in the console with regex and toggleable case-sensitivity
Feature #7318: Ability to disable water culling
Feature #7468: Factions API for Lua
Feature #7477: NegativeLight Magic Effect flag
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field

@ -1495,6 +1495,7 @@ namespace MWRender
newChunkMgr.mTerrain->setTargetFrameRate(Settings::cells().mTargetFramerate);
float distanceMult = std::cos(osg::DegreesToRadians(std::min(mFieldOfView, 140.f)) / 2.f);
newChunkMgr.mTerrain->setViewDistance(mViewDistance * (distanceMult ? 1.f / distanceMult : 1.f));
newChunkMgr.mTerrain->enableHeightCullCallback(Settings::terrain().mWaterCulling);
return mWorldspaceChunks.emplace(worldspace, std::move(newChunkMgr)).first->second;
}

@ -37,6 +37,7 @@ namespace Settings
makeMaxStrictSanitizerFloat(0) };
SettingValue<float> mObjectPagingMinSizeCostMultiplier{ mIndex, "Terrain",
"object paging min size cost multiplier", makeMaxStrictSanitizerFloat(0) };
SettingValue<bool> mWaterCulling{ mIndex, "Terrain", "water culling" };
};
}

@ -23,7 +23,6 @@ namespace Terrain
, mParent(parent)
, mResourceSystem(resourceSystem)
, mBorderVisible(false)
, mHeightCullCallback(new HeightCullCallback)
, mWorldspace(worldspace)
{
mTerrainRoot = new osg::Group;
@ -67,7 +66,6 @@ namespace Terrain
, mChunkManager(nullptr)
, mCellBorder(nullptr)
, mBorderVisible(false)
, mHeightCullCallback(nullptr)
, mWorldspace(worldspace)
{
mTerrainRoot = new osg::Group;
@ -143,6 +141,14 @@ namespace Terrain
mChunkManager->clearCache();
}
void World::enableHeightCullCallback(bool enable)
{
if (enable)
mHeightCullCallback = new HeightCullCallback;
else
mHeightCullCallback = nullptr;
}
osg::Callback* World::getHeightCullCallback(float highz, unsigned int mask)
{
if (!mHeightCullCallback || mTerrainRoot->getNumChildren() == 0)

@ -106,6 +106,7 @@ namespace Terrain
Storage* getStorage() { return mStorage; }
void enableHeightCullCallback(bool enable);
osg::Callback* getHeightCullCallback(float highz, unsigned int mask);
void setActiveGrid(const osg::Vec4i& grid) { mActiveGrid = grid; }

@ -205,3 +205,16 @@ object paging min size cost multiplier
This setting adjusts the calculated cost of merging an object used in the mentioned functionality.
The larger this value is, the less expensive objects can be before they are discarded.
See the formula above to figure out the math.
water culling
-------------
:Type: boolean
:Range: True/False
:Default: True
Controls whether water culling is used.
Water culling is an optimisation that prevents the expensive rendering of water when it is
evaluated to be below any visible terrain chunk, potentially improving performance in many scenes.
You may want to opt out of it if it causes framerate instability or inappropriately invisible water on your setup.

@ -119,6 +119,9 @@ object paging min size merge factor = 0.3
# Controls how inexpensive an object needs to be to utilize 'min size merge factor'.
object paging min size cost multiplier = 25
# Don't draw water if it's evaluated to be below all visible terrain
water culling = true
[Fog]
# If true, use extended fog parameters for distant terrain not controlled by

Loading…
Cancel
Save