From ac4b29be08622ee48901106d9494679dcf8f12cd Mon Sep 17 00:00:00 2001 From: cody glassman Date: Sun, 7 Aug 2022 06:42:48 -0700 Subject: [PATCH] cleanup default shaders and remove confusing main shader --- apps/openmw/mwgui/postprocessorhud.cpp | 28 +-------- apps/openmw/mwrender/pingpongcanvas.cpp | 17 +---- apps/openmw/mwrender/pingpongcanvas.hpp | 2 - apps/openmw/mwrender/postprocessor.cpp | 63 ++++--------------- apps/openmw/mwrender/postprocessor.hpp | 21 +++---- apps/openmw_test_suite/fx/lexer.cpp | 1 - components/fx/lexer.cpp | 1 - components/fx/lexer_types.hpp | 3 +- components/fx/technique.cpp | 44 ------------- components/fx/technique.hpp | 4 -- files/data/CMakeLists.txt | 4 +- files/data/l10n/BuiltInShaders/de.yaml | 6 +- files/data/l10n/BuiltInShaders/en.yaml | 15 ++++- files/data/l10n/BuiltInShaders/ru.yaml | 11 +++- files/data/l10n/BuiltInShaders/sv.yaml | 6 +- files/data/l10n/PostProcessing/de.yaml | 4 -- files/data/l10n/PostProcessing/en.yaml | 5 -- files/data/l10n/PostProcessing/ru.yaml | 5 -- files/data/l10n/PostProcessing/sv.yaml | 5 -- .../shaders/{main.omwfx => adjustments.omwfx} | 19 ++---- files/data/shaders/debug.omwfx | 45 +++++++++++++ files/data/shaders/displaydepth.omwfx | 25 -------- 22 files changed, 114 insertions(+), 220 deletions(-) rename files/data/shaders/{main.omwfx => adjustments.omwfx} (53%) create mode 100644 files/data/shaders/debug.omwfx delete mode 100644 files/data/shaders/displaydepth.omwfx diff --git a/apps/openmw/mwgui/postprocessorhud.cpp b/apps/openmw/mwgui/postprocessorhud.cpp index 1653d2f1d5..fc77f1e841 100644 --- a/apps/openmw/mwgui/postprocessorhud.cpp +++ b/apps/openmw/mwgui/postprocessorhud.cpp @@ -17,28 +17,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -namespace -{ - void saveChain() - { - auto* processor = MWBase::Environment::get().getWorld()->getPostProcessor(); - - std::vector chain; - - for (size_t i = 1; i < processor->getTechniques().size(); ++i) - { - auto technique = processor->getTechniques()[i]; - - if (!technique || technique->getDynamic()) - continue; - - chain.push_back(technique->getName()); - } - - Settings::Manager::setStringArray("chain", "Post Processing", chain); - } -} - namespace MWGui { void PostProcessorHud::ListWrapper::onKeyButtonPressed(MyGUI::KeyCode key, MyGUI::Char ch) @@ -145,7 +123,7 @@ namespace MWGui processor->enableTechnique(technique); else processor->disableTechnique(technique); - saveChain(); + processor->saveChain(); } } @@ -178,7 +156,7 @@ namespace MWGui return; if (processor->enableTechnique(technique, index) != MWRender::PostProcessor::Status_Error) - saveChain(); + processor->saveChain(); } } @@ -377,7 +355,7 @@ namespace MWGui { Gui::AutoSizedTextBox* divider = mConfigArea->createWidget("MW_UniformGroup", {0,0,0,34}, MyGUI::Align::Default); divider->setNeedMouseFocus(false); - divider->setCaption(uniform->mHeader); + divider->setCaptionWithReplacing(uniform->mHeader); } fx::Widgets::UniformBase* uwidget = mConfigArea->createWidget("MW_UniformEdit", {0,0,0,22}, MyGUI::Align::Default); diff --git a/apps/openmw/mwrender/pingpongcanvas.cpp b/apps/openmw/mwrender/pingpongcanvas.cpp index 37c357f3fb..16c59787a2 100644 --- a/apps/openmw/mwrender/pingpongcanvas.cpp +++ b/apps/openmw/mwrender/pingpongcanvas.cpp @@ -100,21 +100,10 @@ namespace MWRender if (filtered.empty() || !bufferData.postprocessing) { - if (bufferData.postprocessing) - { - if (!mLoggedLastError) - { - Log(Debug::Error) << "Critical error, postprocess shaders failed to compile. Using default shader."; - mLoggedLastError = true; - } - } - else - mLoggedLastError = false; - state.pushStateSet(mFallbackStateSet); state.apply(); - if (Stereo::getMultiview() && mMultiviewResolveProgram) + if (Stereo::getMultiview()) { state.pushStateSet(mMultiviewResolveStateSet); state.apply(); @@ -126,7 +115,7 @@ namespace MWRender drawGeometry(renderInfo); state.popStateSet(); - if (Stereo::getMultiview() && mMultiviewResolveProgram) + if (Stereo::getMultiview()) { state.popStateSet(); } @@ -298,7 +287,7 @@ namespace MWRender state.popStateSet(); } - if (Stereo::getMultiview() && mMultiviewResolveProgram) + if (Stereo::getMultiview()) { ext->glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0); lastApplied = 0; diff --git a/apps/openmw/mwrender/pingpongcanvas.hpp b/apps/openmw/mwrender/pingpongcanvas.hpp index c3eedb3494..eaaa90b778 100644 --- a/apps/openmw/mwrender/pingpongcanvas.hpp +++ b/apps/openmw/mwrender/pingpongcanvas.hpp @@ -83,8 +83,6 @@ namespace MWRender mutable std::array mBufferData; mutable std::array, 3> mFbos; mutable osg::ref_ptr mRenderViewport; - - mutable bool mLoggedLastError = false; }; } diff --git a/apps/openmw/mwrender/postprocessor.cpp b/apps/openmw/mwrender/postprocessor.cpp index 4902dc8ef8..4eb410ad29 100644 --- a/apps/openmw/mwrender/postprocessor.cpp +++ b/apps/openmw/mwrender/postprocessor.cpp @@ -124,7 +124,6 @@ namespace MWRender , mNormalsSupported(false) , mPassLights(false) , mPrevPassLights(false) - , mMainTemplate(new osg::Texture2D) { mSoftParticles = Settings::Manager::getBool("soft particles", "Shaders"); mUsePostProcessing = Settings::Manager::getBool("enabled", "Post Processing"); @@ -247,14 +246,6 @@ namespace MWRender populateTechniqueFiles(); } - mMainTemplate->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); - mMainTemplate->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); - mMainTemplate->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); - mMainTemplate->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); - mMainTemplate->setInternalFormat(GL_RGBA); - mMainTemplate->setSourceType(GL_UNSIGNED_BYTE); - mMainTemplate->setSourceFormat(GL_RGBA); - createTexturesAndCamera(frame() % 2); removeChild(mHUDCamera); @@ -399,13 +390,8 @@ namespace MWRender mReload = false; - if (!mTechniques.empty()) - reloadMainPass(*mTechniques[0]); - - reloadTechniques(); - - if (!mUsePostProcessing) - resize(); + loadChain(); + resize(); } void PostProcessor::update(size_t frameId) @@ -483,9 +469,6 @@ namespace MWRender auto fpDepthRb = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples); fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::PACKED_DEPTH_STENCIL_BUFFER, osg::FrameBufferAttachment(fpDepthRb)); - // When MSAA is enabled we must first render to a render buffer, then - // blit the result to the FBO which is either passed to the main frame - // buffer for display or used as the entry point for a post process chain. if (mSamples > 1) { fbos[FBO_Multisample] = new osg::FrameBufferObject; @@ -494,7 +477,6 @@ namespace MWRender { auto normalRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Normal], mSamples); fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB); - fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB); } auto depthRB = createFrameBufferAttachmentFromTemplate(Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples); fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, colorRB); @@ -667,7 +649,7 @@ namespace MWRender return Status_Error; } - if (!technique || technique->getLocked() || (location.has_value() && location.value() <= 0)) + if (!technique || technique->getLocked() || (location.has_value() && location.value() < 0)) return Status_Error; disableTechnique(technique, false); @@ -734,17 +716,6 @@ namespace MWRender textures[Tex_Normal]->setSourceFormat(GL_RGB); textures[Tex_Normal]->setInternalFormat(GL_RGB); - if (mMainTemplate) - { - textures[Tex_Scene]->setSourceFormat(mMainTemplate->getSourceFormat()); - textures[Tex_Scene]->setSourceType(mMainTemplate->getSourceType()); - textures[Tex_Scene]->setInternalFormat(mMainTemplate->getInternalFormat()); - textures[Tex_Scene]->setFilter(osg::Texture2D::MIN_FILTER, mMainTemplate->getFilter(osg::Texture2D::MIN_FILTER)); - textures[Tex_Scene]->setFilter(osg::Texture2D::MAG_FILTER, mMainTemplate->getFilter(osg::Texture2D::MAG_FILTER)); - textures[Tex_Scene]->setWrap(osg::Texture::WRAP_S, mMainTemplate->getWrap(osg::Texture2D::WRAP_S)); - textures[Tex_Scene]->setWrap(osg::Texture::WRAP_T, mMainTemplate->getWrap(osg::Texture2D::WRAP_T)); - } - auto setupDepth = [] (osg::Texture* tex) { tex->setSourceFormat(GL_DEPTH_STENCIL_EXT); tex->setSourceType(SceneUtil::AutoDepth::depthSourceType()); @@ -816,14 +787,12 @@ namespace MWRender return technique; } - reloadMainPass(*technique); - mTemplates.push_back(std::move(technique)); return mTemplates.back(); } - void PostProcessor::reloadTechniques() + void PostProcessor::loadChain() { if (!isEnabled()) return; @@ -832,18 +801,9 @@ namespace MWRender std::vector techniqueStrings = Settings::Manager::getStringArray("chain", "Post Processing"); - const std::string mainIdentifier = "main"; - - auto main = loadTechnique(mainIdentifier); - - if (main) - main->setLocked(true); - - mTechniques.push_back(std::move(main)); - for (auto& techniqueName : techniqueStrings) { - if (techniqueName.empty() || Misc::StringUtils::ciEqual(techniqueName, mainIdentifier)) + if (techniqueName.empty()) continue; mTechniques.push_back(loadTechnique(techniqueName)); @@ -852,14 +812,17 @@ namespace MWRender dirtyTechniques(); } - void PostProcessor::reloadMainPass(fx::Technique& technique) + void PostProcessor::saveChain() { - if (!technique.getMainTemplate()) - return; + std::vector chain; - mMainTemplate = technique.getMainTemplate(); + for (const auto& technique : mTechniques) { + if (!technique || technique->getDynamic()) + continue; + chain.push_back(technique->getName()); + } - resize(); + Settings::Manager::setStringArray("chain", "Post Processing", chain); } void PostProcessor::toggleMode() diff --git a/apps/openmw/mwrender/postprocessor.hpp b/apps/openmw/mwrender/postprocessor.hpp index 2fa3e5622a..6a8a6aada4 100644 --- a/apps/openmw/mwrender/postprocessor.hpp +++ b/apps/openmw/mwrender/postprocessor.hpp @@ -86,6 +86,13 @@ namespace MWRender Unit_NextFree }; + enum Status + { + Status_Error, + Status_Toggled, + Status_Unchanged + }; + PostProcessor(RenderingManager& rendering, osgViewer::Viewer* viewer, osg::Group* rootNode, const VFS::Manager* vfs); ~PostProcessor(); @@ -110,13 +117,6 @@ namespace MWRender void resize(); - enum Status - { - Status_Error, - Status_Toggled, - Status_Unchanged - }; - Status enableTechnique(std::shared_ptr technique, std::optional location = std::nullopt); Status disableTechnique(std::shared_ptr technique, bool dirty = true); @@ -180,6 +180,9 @@ namespace MWRender int renderWidth() const; int renderHeight() const; + void loadChain(); + void saveChain(); + private: void populateTechniqueFiles(); @@ -190,8 +193,6 @@ namespace MWRender void createTexturesAndCamera(size_t frameId); - void reloadTechniques(); - void reloadMainPass(fx::Technique& technique); void dirtyTechniques(); @@ -245,8 +246,6 @@ namespace MWRender bool mUBO; int mGLSLVersion; - osg::ref_ptr mMainTemplate; - osg::ref_ptr mStateUpdater; osg::ref_ptr mPingPongCull; osg::ref_ptr mPingPongCanvas; diff --git a/apps/openmw_test_suite/fx/lexer.cpp b/apps/openmw_test_suite/fx/lexer.cpp index 5024622a71..f5df35c982 100644 --- a/apps/openmw_test_suite/fx/lexer.cpp +++ b/apps/openmw_test_suite/fx/lexer.cpp @@ -23,7 +23,6 @@ namespace TEST_F(LexerSingleTokenTest, single_token_shared) { test(); } TEST_F(LexerSingleTokenTest, single_token_technique) { test(); } - TEST_F(LexerSingleTokenTest, single_token_main_pass) { test(); } TEST_F(LexerSingleTokenTest, single_token_render_target) { test(); } TEST_F(LexerSingleTokenTest, single_token_vertex) { test(); } TEST_F(LexerSingleTokenTest, single_token_fragment) { test(); } diff --git a/components/fx/lexer.cpp b/components/fx/lexer.cpp index d416dd692d..3227071d23 100644 --- a/components/fx/lexer.cpp +++ b/components/fx/lexer.cpp @@ -230,7 +230,6 @@ namespace fx if (value == "shared") return Shared{}; if (value == "technique") return Technique{}; - if (value == "main_pass") return Main_Pass{}; if (value == "render_target") return Render_Target{}; if (value == "vertex") return Vertex{}; if (value == "fragment") return Fragment{}; diff --git a/components/fx/lexer_types.hpp b/components/fx/lexer_types.hpp index 0d81c483b7..cacddff3c5 100644 --- a/components/fx/lexer_types.hpp +++ b/components/fx/lexer_types.hpp @@ -18,7 +18,6 @@ namespace fx struct Fragment { inline static constexpr std::string_view repr = "fragment"; }; struct Compute { inline static constexpr std::string_view repr = "compute"; }; struct Technique { inline static constexpr std::string_view repr = "technique"; }; - struct Main_Pass { inline static constexpr std::string_view repr = "main_pass"; }; struct Render_Target { inline static constexpr std::string_view repr = "render_target"; }; struct Sampler_1D { inline static constexpr std::string_view repr = "sampler_1d"; }; struct Sampler_2D { inline static constexpr std::string_view repr = "sampler_2d"; }; @@ -49,7 +48,7 @@ namespace fx using Token = std::variant; + True, False, Vec2, Vec3, Vec4, Eof>; } } diff --git a/components/fx/technique.cpp b/components/fx/technique.cpp index eaa74e3e3b..68f5ff3b67 100644 --- a/components/fx/technique.cpp +++ b/components/fx/technique.cpp @@ -65,7 +65,6 @@ namespace fx mPassKeys.clear(); mDefinedUniforms.clear(); mRenderTargets.clear(); - mMainTemplate = nullptr; mLastAppliedType = Pass::Type::None; mFlags = 0; mShared.clear(); @@ -262,47 +261,6 @@ namespace fx error("pass list in 'technique' block cannot be empty."); } - template<> - void Technique::parseBlockImp() - { - if (mMainTemplate) - error("duplicate 'main_pass' block"); - - if (mName != "main") - error("'main_pass' block can only be defined in the 'main.omwfx' technique file"); - - mMainTemplate = new osg::Texture2D; - - mMainTemplate->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); - mMainTemplate->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); - - while (!isNext() && !isNext()) - { - expect(); - - auto key = std::get(mToken).value; - - expect(); - - if (key == "wrap_s") - mMainTemplate->setWrap(osg::Texture::WRAP_S, parseWrapMode()); - else if (key == "wrap_t") - mMainTemplate->setWrap(osg::Texture::WRAP_T, parseWrapMode()); - // Skip depth attachments for main scene, as some engine settings rely on specific depth formats. - // Allowing this to be overriden will cause confusion. - else if (key == "internal_format") - mMainTemplate->setInternalFormat(parseInternalFormat()); - else if (key == "source_type") - mMainTemplate->setSourceType(parseSourceType()); - else if (key == "source_format") - mMainTemplate->setSourceFormat(parseSourceFormat()); - else - error(Misc::StringUtils::format("unexpected key '%s'", std::string(key))); - - expect(); - } - } - template<> void Technique::parseBlockImp() { @@ -738,8 +696,6 @@ namespace fx parseBlock(false); else if constexpr (std::is_same_v) parseBlock(false); - else if constexpr (std::is_same_v) - parseBlock(false); else if constexpr (std::is_same_v) parseBlock(); else if constexpr (std::is_same_v) diff --git a/components/fx/technique.hpp b/components/fx/technique.hpp index 1cb4e3e743..4b1c9f19bb 100644 --- a/components/fx/technique.hpp +++ b/components/fx/technique.hpp @@ -159,8 +159,6 @@ namespace fx const std::unordered_set& getGLSLExtensions() const { return mGLSLExtensions; } - osg::ref_ptr getMainTemplate() const { return mMainTemplate; } - FlagsType getFlags() const { return mFlags; } bool getHidden() const { return mFlags & Flag_Hidden; } @@ -273,7 +271,6 @@ namespace fx int mWidth; int mHeight; - osg::ref_ptr mMainTemplate; RenderTargetMap mRenderTargets; TexList mTextures; @@ -301,7 +298,6 @@ namespace fx template<> void Technique::parseBlockImp(); template<> void Technique::parseBlockImp(); - template<> void Technique::parseBlockImp(); template<> void Technique::parseBlockImp(); template<> void Technique::parseBlockImp(); template<> void Technique::parseBlockImp(); diff --git a/files/data/CMakeLists.txt b/files/data/CMakeLists.txt index f0a1d9b260..d876918f31 100644 --- a/files/data/CMakeLists.txt +++ b/files/data/CMakeLists.txt @@ -87,8 +87,8 @@ set(BUILTIN_DATA_FILES scripts/omw/mwui/space.lua scripts/omw/mwui/init.lua - shaders/main.omwfx - shaders/displaydepth.omwfx + shaders/adjustments.omwfx + shaders/debug.omwfx mygui/core.skin mygui/core.xml diff --git a/files/data/l10n/BuiltInShaders/de.yaml b/files/data/l10n/BuiltInShaders/de.yaml index e8011a2a17..5886356782 100644 --- a/files/data/l10n/BuiltInShaders/de.yaml +++ b/files/data/l10n/BuiltInShaders/de.yaml @@ -1,3 +1,7 @@ -DisplayDepthDescription: "Visualisiert den Tiefenpuffer." +DisplayDepthName: "Visualisiert den Tiefenpuffer." DisplayDepthFactorDescription: "Bestimmt die Korrelation zwischen dem Pixeltiefenwert und seiner Ausgabefarbe. Hohe Werte führen zu einem helleren Bild." DisplayDepthFactorName: "Farbfaktor" +ContrastLevelDescription: "Kontraststufe" +ContrastLevelName: "Kontrast" +GammaLevelDescription: "Gamma-Level" +GammaLevelName: "Gamma" \ No newline at end of file diff --git a/files/data/l10n/BuiltInShaders/en.yaml b/files/data/l10n/BuiltInShaders/en.yaml index f1c6112a49..4454fdefa5 100644 --- a/files/data/l10n/BuiltInShaders/en.yaml +++ b/files/data/l10n/BuiltInShaders/en.yaml @@ -1,3 +1,12 @@ -DisplayDepthDescription: "Visualizes the depth buffer." -DisplayDepthFactorDescription: "Determines correlation between pixel depth value and its output color. High values lead to brighter image." -DisplayDepthFactorName: "Color factor" +AdjustmentsDescription: "Colour adjustments." +DebugDescription: "Debug shader." +DebugHeaderDepth: "Depth Buffer" +DebugHeaderNormals: "Normals" +DisplayDepthFactorName: "Depth colour factor" +DisplayDepthFactorDescription: "Determines correlation between pixel depth value and its output colour. High values lead to brighter image." +DisplayDepthName: "Visualize depth buffer" +DisplayNormalsName: "Visualize pass normals" +ContrastLevelDescription: "Constrast level" +ContrastLevelName: "Constrast" +GammaLevelDescription: "Gamma level" +GammaLevelName: "Gamma" \ No newline at end of file diff --git a/files/data/l10n/BuiltInShaders/ru.yaml b/files/data/l10n/BuiltInShaders/ru.yaml index 3c552ea301..46fc34b856 100644 --- a/files/data/l10n/BuiltInShaders/ru.yaml +++ b/files/data/l10n/BuiltInShaders/ru.yaml @@ -1,3 +1,12 @@ -DisplayDepthDescription: "Визуализирует буфер глубины." +AdjustmentsDescription: "Коррекция цвета." +DebugDescription: "Отладочный шейдер." +DebugHeaderDepth: "Буфер глубины" +DebugHeaderNormals: "Нормали" +DisplayDepthName: "Визуализация буфера глубины" DisplayDepthFactorDescription: "Определяет соотношение между значением глубины пикселя и его цветом. Чем выше значение, тем ярче будет изображение." DisplayDepthFactorName: "Соотношение цвета" +DisplayNormalsName: "Визуализация нормалей" +ContrastLevelDescription: "Контрастность изображения" +ContrastLevelName: "Контрастность" +GammaLevelDescription: "Яркость изображения" +GammaLevelName: "Яркость" \ No newline at end of file diff --git a/files/data/l10n/BuiltInShaders/sv.yaml b/files/data/l10n/BuiltInShaders/sv.yaml index f73ad5ea3d..b43cb34930 100644 --- a/files/data/l10n/BuiltInShaders/sv.yaml +++ b/files/data/l10n/BuiltInShaders/sv.yaml @@ -1,3 +1,7 @@ -DisplayDepthDescription: "Visualiserar djupbufferten." +DisplayDepthName: "Visualiserar djupbufferten." DisplayDepthFactorDescription: "Avgör korrelation mellan djupvärdet på pixeln och dess producerade färg. Högre värden ger ljusare bild." DisplayDepthFactorName: "Färgfaktor" +ContrastLevelDescription: "Kontrastnivå" +ContrastLevelName: "Kontrast" +GammaLevelDescription: "Gammanivå" +# GammaLevelName: "Gamma" samma som en diff --git a/files/data/l10n/PostProcessing/de.yaml b/files/data/l10n/PostProcessing/de.yaml index 4916aa7965..aef3356aa0 100644 --- a/files/data/l10n/PostProcessing/de.yaml +++ b/files/data/l10n/PostProcessing/de.yaml @@ -1,11 +1,7 @@ Abovewater: "Überwasser" Author: "Autor" Configuration: "Konfiguration" -ContrastLevelDescription: "Kontraststufe" -ContrastLevelName: "Kontrast" Description: "Beschreibung" -GammaLevelDescription: "Gamma-Level" -GammaLevelName: "Gamma" InExteriors: "Außenbereich" InInteriors: "Innenbereich" KeyboardControls: | diff --git a/files/data/l10n/PostProcessing/en.yaml b/files/data/l10n/PostProcessing/en.yaml index f40a318cca..44cb90cacf 100644 --- a/files/data/l10n/PostProcessing/en.yaml +++ b/files/data/l10n/PostProcessing/en.yaml @@ -1,11 +1,7 @@ Abovewater: "Abovewater" Author: "Author" Configuration: "Configuration" -ContrastLevelDescription: "Constrast level" -ContrastLevelName: "Constrast" Description: "Description" -GammaLevelDescription: "Gamma level" -GammaLevelName: "Gamma" InExteriors: "Exteriors" InInteriors: "Interiors" KeyboardControls: | @@ -15,7 +11,6 @@ KeyboardControls: | Shift+Left-Arrow > Deactive shader Shift+Up-Arrow > Move shader up Shift+Down-Arrow > Move shader down -MainPassDescription: "Passes scene data to post processing shaders. Can not be toggled or moved." PostProcessHUD: "Postprocess HUD" ResetShader: "Reset shader to default state" ShaderLocked: "Locked" diff --git a/files/data/l10n/PostProcessing/ru.yaml b/files/data/l10n/PostProcessing/ru.yaml index fdae0947ba..55ca595163 100644 --- a/files/data/l10n/PostProcessing/ru.yaml +++ b/files/data/l10n/PostProcessing/ru.yaml @@ -1,11 +1,7 @@ Abovewater: "Над водой" Author: "Автор" Configuration: "Настройки" -ContrastLevelDescription: "Контрастность изображения" -ContrastLevelName: "Контрастность" Description: "Описание" -GammaLevelDescription: "Яркость изображения" -GammaLevelName: "Яркость" InExteriors: "Вне помещений" InInteriors: "В помещениях" KeyboardControls: | @@ -15,7 +11,6 @@ KeyboardControls: | Shift+Left-Arrow > Выключить шейдер Shift+Up-Arrow > Передвинуть шейдер выше Shift+Down-Arrow > Передвинуть шейдер ниже -MainPassDescription: "Передает данные сцены в шейдеры постобработки. Не может быть выключен или передвинут." PostProcessHUD: "Настройки постобработки" ResetShader: "Обнулить настройки этого шейдера" ShaderLocked: "Заблокирован" diff --git a/files/data/l10n/PostProcessing/sv.yaml b/files/data/l10n/PostProcessing/sv.yaml index ed76ff8549..e3c25b72cb 100644 --- a/files/data/l10n/PostProcessing/sv.yaml +++ b/files/data/l10n/PostProcessing/sv.yaml @@ -1,11 +1,7 @@ Abovewater: "Ovan vatten" Author: "Skapare" # Author = Författare, but författare sounds very book-author-ish. Skapare, meaning "creator", sounds better in Swedish in this case. Ok? Configuration: "Konfiguration" -ContrastLevelDescription: "Kontrastnivå" -ContrastLevelName: "Kontrast" Description: "Beskrivning" -GammaLevelDescription: "Gammanivå" -# GammaLevelName: "Gamma" samma som en InExteriors: "Exteriörer" InInteriors: "Interiörer" KeyboardControls: | @@ -15,7 +11,6 @@ KeyboardControls: | Shift+Vänsterpil > Avaktivera shader Shift+Pil upp > Flytta shader upp Shift+Pil ner > Flytta shader ner -MainPassDescription: "Flyttar scendata till postprocess-shaders. Kan ej slås på/av eller flyttas." PostProcessHUD: "Postprocess HUD" ResetShader: "Återställ shader to ursprungligt läge" ShaderLocked: "Låst" diff --git a/files/data/shaders/main.omwfx b/files/data/shaders/adjustments.omwfx similarity index 53% rename from files/data/shaders/main.omwfx rename to files/data/shaders/adjustments.omwfx index d42fb6c77f..dff182d422 100644 --- a/files/data/shaders/main.omwfx +++ b/files/data/shaders/adjustments.omwfx @@ -1,18 +1,10 @@ -main_pass { - wrap_s = clamp_to_edge; - wrap_t = clamp_to_edge; - internal_format = rgba; - source_type = unsigned_int; - source_format = rgba; -} - uniform_float uGamma { default = 1.0; step = 0.01; min = 0.0; max = 5.0; - display_name = "#{PostProcessing:GammaLevelName}"; - description = "#{PostProcessing:GammaLevelDescription}"; + display_name = "#{BuiltInShaders:GammaLevelName}"; + description = "#{BuiltInShaders:GammaLevelDescription}"; } uniform_float uContrast { @@ -20,8 +12,8 @@ uniform_float uContrast { step = 0.01; min = 0.0; max = 5.0; - display_name = "#{PostProcessing:ContrastLevelName}"; - description = "#{PostProcessing:ContrastLevelDescription}"; + display_name = "#{BuiltInShaders:ContrastLevelName}"; + description = "#{BuiltInShaders:ContrastLevelDescription}"; } fragment main { @@ -39,9 +31,8 @@ fragment main { } technique { - description = "#{PostProcessing:MainPassDescription}"; + description = "#{BuiltInShaders:AdjustmentsDescription}"; version = "1.0"; author = "OpenMW"; passes = main; - hdr = false; } diff --git a/files/data/shaders/debug.omwfx b/files/data/shaders/debug.omwfx new file mode 100644 index 0000000000..addcbf6c38 --- /dev/null +++ b/files/data/shaders/debug.omwfx @@ -0,0 +1,45 @@ +uniform_bool uDisplayDepth { + header = "#{BuiltInShaders:DebugHeaderDepth}"; + default = true; + display_name = "#{BuiltInShaders:DisplayDepthName}"; +} + +uniform_float uDepthFactor { + step = 0.1; + min = 0.01; + max = 20.0; + default = 1.0; + display_name = "#{BuiltInShaders:DisplayDepthFactorName}"; + description = "#{BuiltInShaders:DisplayDepthFactorDescription}"; +} + +uniform_bool uDisplayNormals { + header = "#{BuiltInShaders:DebugHeaderNormals}"; + default = true; + display_name = "#{BuiltInShaders:DisplayNormalsName}"; +} + +fragment main { + + omw_In vec2 omw_TexCoord; + + void main() + { + omw_FragColor = omw_GetLastShader(omw_TexCoord); + + if (uDisplayDepth) + omw_FragColor = vec4(vec3(omw_GetLinearDepth(omw_TexCoord) / omw.far * uDepthFactor), 1.0); +#if OMW_NORMALS + if (uDisplayNormals && (!uDisplayDepth || omw_TexCoord.x < 0.5)) + omw_FragColor.rgb = omw_GetNormals(omw_TexCoord); +#endif + } +} + +technique { + passes = main; + description = "#{BuiltInShaders:DebugDescription}"; + author = "OpenMW"; + version = "1.0"; + pass_normals = true; +} diff --git a/files/data/shaders/displaydepth.omwfx b/files/data/shaders/displaydepth.omwfx deleted file mode 100644 index b20b5208e7..0000000000 --- a/files/data/shaders/displaydepth.omwfx +++ /dev/null @@ -1,25 +0,0 @@ -uniform_float uFactor { - step = 0.1; - min = 0.01; - max = 20.0; - default = 1.0; - display_name = "#{BuiltInShaders:DisplayDepthFactorName}"; - description = "#{BuiltInShaders:DisplayDepthFactorDescription}"; -} - -fragment main { - - omw_In vec2 omw_TexCoord; - - void main() - { - omw_FragColor = vec4(vec3(omw_GetLinearDepth(omw_TexCoord) / omw.far * uFactor), 1.0); - } -} - -technique { - passes = main; - description = "#{BuiltInShaders:DisplayDepthDescription}"; - author = "OpenMW"; - version = "1.0"; -}