Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 3245)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 3251)
@@ -120,5 +120,8 @@
 	static void SetGlobalVisibleId(int id);
 
+	static int GetGlobalVisibleId();
+
 protected:
+
 
 	/** Internally updates current lod level.
@@ -219,4 +222,10 @@
 
 
+inline int SceneEntity::GetGlobalVisibleId()
+{
+	return sVisibleId;
+}
+
+
 inline int SceneEntity::GetVisibleId(int id) const
 {
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp	(revision 3250)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp	(revision 3251)
@@ -15,6 +15,6 @@
 
 // hack: this has to be set to 0.05f for powerplant, to 1 otherwise
-static const float sScale = 0.05f;
-//static const float sScale = 1.0f;
+//static const float sScale = 0.05f;
+static const float sScale = 1.0f;
 
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 3245)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 3251)
@@ -291,3 +291,23 @@
 }
 
-}
+
+bool RenderTraverser::IsNodeVisible(BvhNode *node, int maxSize)
+{
+	// no invisible objects
+	if (SceneEntity::GetGlobalVisibleId() == -1) return true;
+
+	int geometrySize;
+	SceneEntity **entities = mBvh->GetGeometry(node, geometrySize);
+
+	if (geometrySize > maxSize) return true;
+
+	for (int i = 0; i < geometrySize; ++ i)
+	{
+		if (entities[i]->IsVisible()) return true;
+	}
+	
+	return false;
+}
+
+
+}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3247)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3251)
@@ -63,5 +63,5 @@
 
 
-//#define USE_GTX
+#define USE_GTX
 
 #endif // __SHADERENV_H
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp	(revision 3147)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp	(revision 3251)
@@ -68,5 +68,9 @@
 	sCgFragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
 	//sCgFragmentProfile = CG_PROFILE_GPU_FP;
-		//CG_PROFILE_FP40;;
+	if (sCgFragmentProfile == CG_PROFILE_FP40)
+		cout << "cg profile: fp40" << endl;
+	else
+		cout << "cg profile " << sCgFragmentProfile << endl;
+
 	cgGLSetOptimalOptions(sCgFragmentProfile);
 	// get the optimal vertex profile
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.cpp	(revision 3065)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.cpp	(revision 3251)
@@ -121,5 +121,7 @@
 					// always traverse a node if it was visible
 					if (wasVisible)
+					{
 						TraverseNode(node);
+					}
 				}
 			}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3250)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3251)
@@ -466,15 +466,15 @@
 		texHeight = winHeight;
 
-		cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; 
-		cout << "maxBatchSize: " << maxBatchSize << endl;
-		cout << "trianglesPerVirtualLeaf: " << trianglesPerVirtualLeaf << endl;
-
-		cout << "keyForwardMotion: " << keyForwardMotion << endl;
-		cout << "keyRotation: " << keyRotation << endl;
-		cout << "winWidth: " << winWidth << endl;
-		cout << "winHeight: " << winHeight << endl;
-		cout << "useFullScreen: " << useFullScreen << endl;
-		cout << "useLODs: " << useLODs << endl;
-		cout << "camPosition: " << camPos << endl;
+		cout << "assumed visible frames: " << assumedVisibleFrames << endl; 
+		cout << "max batch size: " << maxBatchSize << endl;
+		cout << "triangles per virtual leaf: " << trianglesPerVirtualLeaf << endl;
+
+		cout << "key forward motion: " << keyForwardMotion << endl;
+		cout << "key rotation: " << keyRotation << endl;
+		cout << "win width: " << winWidth << endl;
+		cout << "win height: " << winHeight << endl;
+		cout << "use full screen: " << useFullScreen << endl;
+		cout << "use LODs: " << useLODs << endl;
+		cout << "camera position: " << camPos << endl;
 		cout << "shadow size: " << shadowSize << endl;
 		cout << "render method: " << renderMethod << endl;
@@ -483,14 +483,14 @@
 		cout << "use advanced shading: " << useAdvancedShading << endl;
 		cout << "turbitity: " << turbitity << endl;
-		cout << "temporal coherence: " << ssaoTempCohFactor << endl;
+		cout << "temporal coherence factor: " << ssaoTempCohFactor << endl;
 		cout << "sample intensity: " << ssaoSampleIntensity << endl;
 		cout << "kernel radius: " << ssaoKernelRadius << endl;
-		cout << "ssao full resolution: " << ssaoUseFullResolution << endl;
+		cout << "use ssao full resolution: " << ssaoUseFullResolution << endl;
 		cout << "recorded frames suffix: " << recordedFramesSuffix << endl;
 		cout << "stats filename: " << statsFilename << endl;
-		cout << "filename: " << filename << endl;
-		cout << "use PVS: " << usePvs << endl;
-		cout << "visibilitySolution: " << visibilitySolution << endl;
-		cout << "useSkylightForIllum" << useSkylightForIllum << endl;
+		cout << "static scene filename prefix: " << filename << endl;
+		cout << "use PVSs: " << usePvs << endl;
+		cout << "visibility solution: " << visibilitySolution << endl;
+		cout << "use skylight for illumination: " << useSkylightForIllum << endl;
 
 		//cout << "model path: " << model_path << endl;
@@ -1190,8 +1190,7 @@
 	glEnableClientState(GL_VERTEX_ARRAY);
 
-	if (usePvs)
+	if (0 && usePvs)
 	{
 		if (!viewCellsTree) LoadVisibilitySolution();
-
 		LoadPvs();
 	}
@@ -1276,4 +1275,10 @@
 	else
 	{
+		if (usePvs)
+		{
+			if (!viewCellsTree) LoadVisibilitySolution();
+			LoadPvs();
+		}
+		else
 		// actually render the scene geometry using the specified algorithm
 		traverser->RenderScene();
@@ -2302,5 +2307,5 @@
 			sprintf(msg[i ++], "traversed: %5d, frustum culled: %5d, query culled: %5d",
 				traversedNodes, frustumCulledNodes, queryCulledNodes);
-			sprintf(msg[i ++], "issued queries: %5d, renderstate changes: %5d, render batches: %5d", 
+			sprintf(msg[i ++], "issued queries: %5d, state changes: %5d, render batches: %5d", 
 				issuedQueries, stateChanges, numBatches);
 
@@ -2580,13 +2585,17 @@
 	int numTriangles = 0;
 
+	SceneEntity::SetGlobalVisibleId(globalVisibleId);
+
 	for (int i = 0; i < viewCell->mPvs.Size(); ++ i)
 	{
 		SceneEntity *ent = viewCell->mPvs.GetEntry(i);
+
 		ent->SetVisibleId(globalVisibleId);
+		ent->Render(&renderState);
 
 		numTriangles += ent->CountNumTriangles();
 	}
 
-	SceneEntity::SetGlobalVisibleId(globalVisibleId ++);
+	++ globalVisibleId;
 }
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 3065)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp	(revision 3251)
@@ -119,4 +119,10 @@
 			mDistanceQueue.pop();
 	
+			if (1 && !IsNodeVisible(node, 10))
+			{
+				node->SetVisible(false);
+				continue;
+			}
+			
 			if (mBvh->IsWithinViewFrustum(node))
 			{
@@ -143,5 +149,7 @@
 					// node was not recently tested => reset flag 
 					if (node->GetLastVisitedFrame() != mFrameId - 1)
+					{
 						node->SetTimesTestedInvisible(0);
+					}
 
 					// update node's visited flag
@@ -162,4 +170,5 @@
 					else
 					{
+						// node is leaf => set to visible
 						if (node->IsVirtualLeaf())
 						{
@@ -175,5 +184,7 @@
 					// always traverse a node if it was previously visible
 					if (wasVisible)
+					{
 						TraverseNode(node);
+					}
 				}
 			}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp	(revision 3071)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp	(revision 3251)
@@ -18,4 +18,10 @@
 		mDistanceQueue.pop();
 	
+		if (1 && !IsNodeVisible(node, 10))
+		{
+			node->SetVisible(false);
+			continue;
+		}
+
 		if (mBvh->IsWithinViewFrustum(node))
 		{
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h	(revision 3147)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h	(revision 3251)
@@ -168,4 +168,6 @@
 	*/
 	void ApplyRenderQueue();
+
+	bool IsNodeVisible(BvhNode *node, int maxSize);
 
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3250)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3251)
@@ -61,11 +61,11 @@
 ## powerplant options
 
-filename=PowerPlantM
+#filename=PowerPlantM
 
-keyForwardMotion=500.0f
-mouseMotion=3.0f;
-visibilitySolution=power-plant-2c-xx-1000b-pgv2
-camPosition=-1320.57 -6306.34 3603
-camDirection=0.292156 0.9556 0.0383878
+#keyForwardMotion=500.0f
+#mouseMotion=3.0f;
+#visibilitySolution=power-plant-2c-xx-1000b-pgv2
+#camPosition=-1320.57 -6306.34 3603
+#camDirection=0.292156 0.9556 0.0383878
 
 
