diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index 31338da8b..d090c3397 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "shadermanager.hpp" @@ -138,6 +139,12 @@ namespace Shader // Bump maps are off by default as well writableStateSet->setTextureMode(unit, GL_TEXTURE_2D, osg::StateAttribute::ON); } + else if (texName == "envMap") + { + static const bool preLightEnv = Settings::Manager::getBool("apply lighting to environment maps", "Shaders"); + if (preLightEnv) + mRequirements.back().mShaderRequired = true; + } } else Log(Debug::Error) << "ShaderVisitor encountered unknown texture " << texture; diff --git a/docs/source/reference/modding/settings/shaders.rst b/docs/source/reference/modding/settings/shaders.rst index eaea53972..bc676d22f 100644 --- a/docs/source/reference/modding/settings/shaders.rst +++ b/docs/source/reference/modding/settings/shaders.rst @@ -134,4 +134,4 @@ apply lighting to environment maps Normally environment map reflections aren't affected by lighting, which makes environment-mapped (and thus bump-mapped objects) glow in the dark. Morrowind Code Patch includes an option to remedy that by doing environment-mapping before applying lighting, this is the equivalent of that option. -Has no effect in fixed function pipeline. +Affected objects will use shaders. diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 523ffc2f6..c6f7abfba 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -346,8 +346,8 @@ specular map pattern = _spec # The filename pattern to probe for when detecting terrain specular maps (see 'auto use terrain specular maps') terrain specular map pattern = _diffusespec -# Apply lighting to environment map reflections on the rendered objects like in Morrowind Code Patch. -# Requires shaders to work. +# Apply lighting to reflections on the environment-mapped objects like in Morrowind Code Patch. +# Affected objects use shaders. apply lighting to environment maps = false [Input]