diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 80877e08b..6af8a49a4 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1067,6 +1067,9 @@ namespace MWRender parentNode = found->second; } osg::ref_ptr node = mResourceSystem->getSceneManager()->createInstance(model, parentNode); + + node->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + params.mObjects = PartHolderPtr(new PartHolder(node)); SceneUtil::FindMaxControllerLengthVisitor findMaxLengthVisitor; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 1f089f0c4..530aa3dec 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -6,9 +6,6 @@ #include #include -#include -#include - // resource #include #include @@ -862,7 +859,15 @@ namespace NifOsg collectMaterialProperties(nifNode, materialProps); applyMaterialProperties(geode, materialProps, true, animflags); - partsys->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + // Particles don't have normals, so can't be diffuse lit. + osg::Material* mat = static_cast(geode->getStateSet()->getAttribute(osg::StateAttribute::MATERIAL)); + if (mat) + { + osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK); + mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0,0,0,diffuse.a())); + mat->setColorMode(osg::Material::AMBIENT); + } + partsys->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); // particle system updater (after the emitters and affectors in the scene graph)