From c3cc8ee1e17ff3b4faa2ec8b26831b90716c1fde Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Fri, 17 Apr 2020 14:08:29 +0300 Subject: [PATCH] Disable specular lighting for 4.0.0.2 and earlier files --- components/nifosg/nifloader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 5a9693740..74cdcefe3 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1705,7 +1705,8 @@ namespace NifOsg { osg::StateSet* stateset = node->getOrCreateStateSet(); - int specFlags = 0; // Specular is disabled by default, even if there's a specular color in the NiMaterialProperty + // Specular lighting is enabled by default, but there's a quirk... + int specFlags = 1; osg::ref_ptr mat (new osg::Material); mat->setColorMode(hasVertexColors ? osg::Material::AMBIENT_AND_DIFFUSE : osg::Material::OFF); @@ -1723,6 +1724,7 @@ namespace NifOsg { case Nif::RC_NiSpecularProperty: { + // Specular property can turn specular lighting off. specFlags = property->flags; break; } @@ -1806,7 +1808,8 @@ namespace NifOsg } } - if (specFlags == 0) + // While NetImmerse and Gamebryo support specular lighting, Morrowind has its support disabled. + if (mVersion <= Nif::NIFFile::NIFVersion::VER_MW || specFlags == 0) mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f,0.f,0.f,0.f)); // Particles don't have normals, so can't be diffuse lit.