diff --git a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp index 88e76a45b..8a4af3605 100644 --- a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp +++ b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp @@ -143,6 +143,9 @@ FbxMaterialToOsgStateSet::convert(const KFbxSurfaceMaterial* pFbxMat) static_cast(color[2] * factor), 1.0f)); + // get maps factors... + result.diffuseFactor = pFbxLambert->GetDiffuseFactor().Get(); + if (const KFbxSurfacePhong* pFbxPhong = dynamic_cast(pFbxLambert)) { color = pFbxPhong->GetSpecularColor().Get(); @@ -157,9 +160,7 @@ FbxMaterialToOsgStateSet::convert(const KFbxSurfaceMaterial* pFbxMat) static_cast(pFbxPhong->GetShininess().Get())); // get maps factors... - result.diffuseFactor = pFbxPhong->GetDiffuseFactor().Get(); result.reflectionFactor = pFbxPhong->GetReflectionFactor().Get(); - result.opacityFactor = pFbxPhong->GetTransparencyFactor().Get(); // get more factors here... } } diff --git a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.h b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.h index 3d9bd4fea..8f5aac824 100644 --- a/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.h +++ b/src/osgPlugins/fbx/fbxMaterialToOsgStateSet.h @@ -20,7 +20,6 @@ struct StateSetContent { StateSetContent() : diffuseFactor(1.0), - opacityFactor(1.0), reflectionFactor(1.0), emissiveFactor(1.0) { @@ -44,7 +43,6 @@ struct StateSetContent // combining factors... double diffuseFactor; - double opacityFactor; double reflectionFactor; double emissiveFactor; // more combining factors here... diff --git a/src/osgPlugins/fbx/fbxRMesh.cpp b/src/osgPlugins/fbx/fbxRMesh.cpp index 9cf3a5494..df771ffda 100644 --- a/src/osgPlugins/fbx/fbxRMesh.cpp +++ b/src/osgPlugins/fbx/fbxRMesh.cpp @@ -246,16 +246,10 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap, stateSet->setTextureAttributeAndModes(StateSetContent::OPACITY_TEXTURE_UNIT, texmat.get(), osg::StateAttribute::ON); } - // setup combiner for factor... - //In practice factor will always be zero, hence the RGB of the - //opacity map will be ignored. The alpha will modulate the previous alpha. - double factor = ssc.opacityFactor; + // setup combiner to ignore RGB... osg::ref_ptr texenv = new osg::TexEnvCombine(); - texenv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE); - texenv->setSource0_RGB(osg::TexEnvCombine::TEXTURE); - texenv->setSource1_RGB(osg::TexEnvCombine::PREVIOUS); - texenv->setSource2_RGB(osg::TexEnvCombine::CONSTANT); - texenv->setConstantColor(osg::Vec4(factor, factor, factor, factor)); + texenv->setCombine_RGB(osg::TexEnvCombine::REPLACE); + texenv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS); stateSet->setTextureAttributeAndModes(StateSetContent::OPACITY_TEXTURE_UNIT, texenv.get(), osg::StateAttribute::ON); // setup transparency...