Index: /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.h
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.h (revision 8563)
+++ /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.h (revision 10084)
@@ -25,4 +25,6 @@
 #include <osg/Transform>
 #include <osg/Geometry>
+#include <osg/PolygonOffset>
+#include <osg/Depth>
 #include <osgDB/ReaderWriter>
 
@@ -166,4 +168,10 @@
         ShaderPool* getOrCreateShaderPool();
         bool getShaderPoolParent() const { return _shaderPoolParent; }
+
+        void setSubSurfacePolygonOffset(int level, osg::PolygonOffset* po);
+        osg::PolygonOffset* getSubSurfacePolygonOffset(int level);
+
+        void setSubSurfaceDepth(osg::Depth* depth) { _subsurfaceDepth = depth; }
+        osg::Depth* getSubSurfaceDepth() { return _subsurfaceDepth.get(); }
 
 
@@ -185,5 +193,5 @@
         void setDesiredUnits(CoordUnits units ) { _desiredUnits=units; }
         CoordUnits getDesiredUnits() const { return _desiredUnits; }
-        
+
         void setKeepExternalReferences( bool flag) { _keepExternalReferences=flag; }
         bool getKeepExternalReferences() const { return _keepExternalReferences; }
@@ -226,4 +234,9 @@
         osg::ref_ptr<LightPointAnimationPool> _lightPointAnimationPool;
         osg::ref_ptr<ShaderPool> _shaderPool;
+
+        typedef std::map<int, osg::ref_ptr<osg::PolygonOffset> > SubSurfacePolygonOffsets;
+        SubSurfacePolygonOffsets _subsurfacePolygonOffsets;
+        osg::ref_ptr<osg::Depth> _subsurfaceDepth;
+
         bool _colorPoolParent;
         bool _texturePoolParent;
Index: /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/GeometryRecords.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/GeometryRecords.cpp (revision 9041)
+++ /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/GeometryRecords.cpp (revision 10084)
@@ -24,6 +24,4 @@
 #include <osg/Texture2D>
 #include <osg/CullFace>
-#include <osg/PolygonOffset>
-#include <osg/Depth>
 #include <osg/BlendFunc>
 #include <osgUtil/TransformAttributeFunctor>
@@ -384,25 +382,9 @@
         if (document.subfaceLevel() > 0)
         {
-            static osg::ref_ptr<osg::PolygonOffset> polygonOffset = new osg::PolygonOffset(-10.0f, -40.0f);
-            stateset->setAttributeAndModes(polygonOffset.get(), osg::StateAttribute::ON);
-
-            static osg::ref_ptr<osg::Depth> depth = new osg::Depth(osg::Depth::LESS, 0.0, 1.0,false);
-            stateset->setAttribute(depth.get());
+            stateset->setAttributeAndModes(document.getSubSurfacePolygonOffset(document.subfaceLevel()), osg::StateAttribute::ON);
+            stateset->setAttribute(document.getSubSurfaceDepth());
 
             stateset->setRenderBinDetails(document.subfaceLevel(),"RenderBin");
         }
-
-#if 0
-// note from Robert Osfield, this "optimization" breaks multi-textured datasets that mix single texture 
-// and mulit-texture geometries as the Multitexture parsing can come after the below code, and accidentally 
-// polute the non multi-texture geometries StateSet.
-
-        // A simple share stateset optimization.
-        static osg::ref_ptr<osg::StateSet> lastStateset;
-        if (lastStateset.valid() && (stateset->compare(*lastStateset,false)==0))
-            stateset = lastStateset;
-        else
-            lastStateset = stateset;
-#endif
 
         _geode->setStateSet(stateset.get());
@@ -953,25 +935,9 @@
         if (document.subfaceLevel() > 0)
         {
-            static osg::ref_ptr<osg::PolygonOffset> polygonOffset = new osg::PolygonOffset(-10.0f, -40.0f);
-            stateset->setAttributeAndModes(polygonOffset.get(), osg::StateAttribute::ON);
-
-            static osg::ref_ptr<osg::Depth> depth = new osg::Depth(osg::Depth::LESS, 0.0, 1.0,false);
-            stateset->setAttribute(depth.get());
+            stateset->setAttributeAndModes(document.getSubSurfacePolygonOffset(document.subfaceLevel()), osg::StateAttribute::ON);
+            stateset->setAttribute(document.getSubSurfaceDepth());
 
             stateset->setRenderBinDetails(document.subfaceLevel(),"RenderBin");
         }
-
-#if 0
-// note from Robert Osfield, this "optimization" breaks multi-textured datasets that mix single texture 
-// and mulit-texture geometries as the Multitexture parsing can come after the below code, and accidentally 
-// polute the non multi-texture geometries StateSet.
-
-        // A simple share stateset optimization.
-        static osg::ref_ptr<osg::StateSet> lastStateset;
-        if (lastStateset.valid() && (stateset->compare(*lastStateset,false)==0))
-            stateset = lastStateset;
-        else
-            lastStateset = stateset;
-#endif
 
         _geode->setStateSet(stateset.get());
Index: /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.cpp (revision 8563)
+++ /OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/Document.cpp (revision 10084)
@@ -46,4 +46,5 @@
     _shaderPoolParent(false)
 {
+    _subsurfaceDepth = new osg::Depth(osg::Depth::LESS, 0.0, 1.0,false);
 }
 
@@ -111,4 +112,20 @@
 }
 
+void Document::setSubSurfacePolygonOffset(int level, osg::PolygonOffset* po)
+{
+    _subsurfacePolygonOffsets[level] = po;
+}
+
+osg::PolygonOffset* Document::getSubSurfacePolygonOffset(int level)
+{
+    osg::notify(osg::DEBUG_INFO)<<"Document::getSubSurfacePolygonOffset("<<level<<")"<<std::endl;
+    osg::ref_ptr<osg::PolygonOffset>& po = _subsurfacePolygonOffsets[level];
+    if (!po)
+    {
+        po = new osg::PolygonOffset(-1.0f*float(level), -1.0f);
+    }
+    return po.get();
+}
+
 double flt::unitsToMeters(CoordUnits unit)
 {
