Index: /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 346)
+++ /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 347)
@@ -309,8 +309,4 @@
 		generateScene(200, 2);
 	}
-
-	// no limitations on height => it is possible for the user to put single 
-	// objects on peaks of the terrain (only few, not relevant for occlusion)
-	mTerrainContentGenerator->SetMaxPos(mTerrainMaxPos);
 }
 //-----------------------------------------------------------------------
@@ -319,7 +315,7 @@
 	float val = TerrainFrameListener::msObjectScales[objectType];
 	Vector3 scale(val, val, val); 
-	const float maxHeight = 100;
+	const float maxHeight = 75;
 	// to provide much occlusion,
-	// height is restricted to 50 => no objects are created on peaks
+	// height is restricted to maxHeight => no objects are created on peaks
 	mTerrainContentGenerator->SetMinPos(Vector3(mTerrainMinPos));
 	mTerrainContentGenerator->SetMaxPos(Vector3(mTerrainMaxPos.x, maxHeight, mTerrainMaxPos.z));
@@ -342,6 +338,6 @@
 	}
 
-	// no limitations anymore => it is possible for the user to put single 
-	// objects on peaks of the terrain (only few, not relevant for occlusion)
+	// release limitations on height => it is possible for the user to put single 
+	// objects on peaks of the terrain (will be only few, not relevant for occlusion)
 	mTerrainContentGenerator->SetMaxPos(mTerrainMaxPos);
 }
Index: /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h
===================================================================
--- /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 316)
+++ /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 347)
@@ -188,12 +188,11 @@
 	*/
 	void setLastRendered(int frameid);
-	/** Returns current depth of octree 
-	@return current depth
-	*/
-	int getDepth();
-	/** Returns real extent of the octree, i.e., the merged extent of the bounding boxes. */
+	
+	/** Returns real extent of the octree, i.e., the merged extent of the bounding boxes. 
+	*/
 	AxisAlignedBox _getWorldAABB(void) const;
 
-	/** Updates bounds of real aabb of octree. */
+	/** Updates bounds of real aabb of octree. 
+	*/
 	void _updateBounds();
 
@@ -206,5 +205,4 @@
 	int mLastVisited;
 	bool mVisible;
-	int mDepth;
 	
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
Index: /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
===================================================================
--- /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 316)
+++ /trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 347)
@@ -104,10 +104,6 @@
     mParent = parent;
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
-	if (mParent) 
-		mDepth = parent->getDepth() + 1;
-	else
-		mDepth = 0;
 	// update bounds because we want tight octree
-	_updateBounds();
+	if (1) _updateBounds(); 
 	
 #endif //GTP_VISIBILITY_MODIFIED_OGRE
@@ -219,9 +215,4 @@
 {
 	return mParent;
-}
-//-----------------------------------------------------------------------	
-int Octree::getDepth()
-{
-	return mDepth;
 }
 //-----------------------------------------------------------------------	
Index: /trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp
===================================================================
--- /trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp	(revision 343)
+++ /trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp	(revision 347)
@@ -2344,5 +2344,5 @@
             glDisableVertexAttribArrayARB_ptr(1); // disable weights
         }
-
+		glColor4f(1,1,1,1);
         glSecondaryColor3fEXT_ptr(0.0f, 0.0f, 0.0f);
 
Index: /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
===================================================================
--- /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 254)
+++ /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 347)
@@ -92,4 +92,10 @@
 	void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
 
+	/** Override standard function so octree boxes are always of equal side length.
+		This has advantages for CHC, because terrain tiles are in different octree nodes
+		and can be culled.
+	*/
+	void setWorldGeometry( const String& filename );
+
 protected:
 	
Index: /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 343)
+++ /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 347)
@@ -94,4 +94,33 @@
 	//mItemBufferPass->setAmbient(1, 1, 0);
 }
+//-------------------------------------------------------------------------
+void VisibilityTerrainSceneManager::setWorldGeometry( const String& filename )
+{
+    // Clear out any existing world resources (if not default)
+    if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() != 
+        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
+    {
+        ResourceGroupManager::getSingleton().clearResourceGroup(
+            ResourceGroupManager::getSingleton().getWorldResourceGroupName());
+    }
+    mTerrainPages.clear();
+    // Load the configuration
+    loadConfig(filename);
+
+    // Resize the octree, allow for 1 page for now
+    float max_x = mOptions.scale.x * mOptions.pageSize;
+    float max_y = mOptions.scale.y;
+    float max_z = mOptions.scale.z * mOptions.pageSize;
+
+	float maxAxis = std::max(max_x, max_y);
+	maxAxis = std::max(maxAxis, max_z);
+	resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) );
+    
+    setupTerrainMaterial();
+
+    setupTerrainPages();
+
+ }
+
 //-----------------------------------------------------------------------
 void VisibilityTerrainSceneManager::PrepareVisualization(Camera *cam)
Index: /trunk/VUT/Ogre/resources/terrain.cfg
===================================================================
--- /trunk/VUT/Ogre/resources/terrain.cfg	(revision 346)
+++ /trunk/VUT/Ogre/resources/terrain.cfg	(revision 347)
@@ -26,5 +26,5 @@
 
 # How large is each tile? Must be (2^n)+1 and be smaller than PageSize
-TileSize=129
+TileSize=65
 
 # The maximum error allowed when determining which LOD to use
@@ -34,6 +34,7 @@
 PageWorldX=5000
 PageWorldZ=5000
+
 # Maximum height of the terrain 
-MaxHeight=500
+MaxHeight=400
 
 # Upper LOD limit
