Index: trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 512)
+++ trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 527)
@@ -135,4 +135,7 @@
 			</File>
 			<File
+				RelativePath="..\src\dual_depth.cg">
+			</File>
+			<File
 				RelativePath="..\src\Environment.cpp">
 			</File>
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 519)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 527)
@@ -53,4 +53,9 @@
 	virtual ~ViewCellsManager();
 
+	/** Constructs view cells container taking a preprocessor
+		@returns construction rays.
+	*/
+	int Construct(VssRayContainer &rays);
+
 	/** Constructs view cell container with a given number of samples.
 	*/
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 516)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 527)
@@ -522,5 +522,11 @@
 	mViewCellsManager->SetViewSpaceBox(mKdTree->GetBox());
   }
-		
+  
+  //-- load view cells from file if requested
+  if (mLoadViewCells)
+  {	
+	  // load now because otherwise bounding box not correct
+	  mViewCellsManager->LoadViewCells(mViewCellsFilename, &mObjects);
+  }
 
   RssTree *rssTree = NULL;
@@ -645,4 +651,7 @@
   rssTree->SetPass(mPass);
   
+  /// compute view cell contribution of rays if view cells manager already constructed
+  mViewCellsManager->ComputeSampleContributions(mVssRays);
+
   if (mUseImportanceSampling) {
 	
Index: trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg	(revision 525)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/dual_depth.cg	(revision 527)
@@ -25,10 +25,11 @@
 	
 	// the depth buffer	
-	float4 depth = tex2Dproj(shadowMap, IN.SMTexCoord);
+	float4 depth = tex2Dproj(shadowMap, IN.depthTexCoord);
 	float test = IN.depthTexCoord.z / IN.depthTexCoord.w;
-	
-	float shadow;
-	shadow = (test < depth.x) ? 1.0 : 0.0;
-	OUT.color = localcolor * shadow * IN.color1;
+	// reject by alpha test
+	if (test < depth.x)
+		col[4] = 0;
+		
+	//OUT.color = localcolor * shadow * IN.color1;
 
 	return OUT;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 520)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp	(revision 527)
@@ -403,7 +403,7 @@
 
   //-- load view cells from file if requested
-  // load now because otherwise bounding box is messed up
   if (mLoadViewCells)
-  {
+  {	
+	  // load now because otherwise bounding box not correct
 	  mViewCellsManager->LoadViewCells(mViewCellsFilename, &mObjects);
   }
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 520)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 527)
@@ -70,4 +70,9 @@
 }
 
+
+int ViewCellsManager::Construct(VssRayContainer &rays)
+{
+	return 0;
+}
 
 bool ViewCellsManager::LoadViewCells(const string filename, ObjectContainer *objects)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 526)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 527)
@@ -13,10 +13,8 @@
 static CGcontext sCgContext = NULL;
 static CGprogram sCgFragmentProgram = NULL;
-
-static CGparameter sCgKdParam = NULL;
-static CGparameter sCgModelViewProjParam = NULL;
-
-
-static CGprofile sCgFragmentProfile = CG_PROFILE_FP30;
+static CGprofile sCgFragmentProfile;// = CG_PROFILE_FP30;
+
+//static CGparameter sCgKdParam = NULL;
+//static CGparameter sCgModelViewProjParam = NULL;
 
 GLuint depthMap;
@@ -157,9 +155,11 @@
   sCgContext = cgCreateContext();
 
-  /*sCgFragmentProgram = cgCreateProgramFromFile(sCgContext, 		
+  sCgFragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
+
+  sCgFragmentProgram = cgCreateProgramFromFile(sCgContext, 		
 											   CG_SOURCE, "../src/dual_depth.cg",
 											   sCgFragmentProfile,
 											   NULL, 
-											   NULL);*/
+											   NULL);
 }
 
@@ -585,4 +585,7 @@
 	glShadeModel(GL_FLAT);
 	glDisable(GL_LIGHTING);
+	// needed to kill fragments
+	glEnable(GL_ALPHA_TEST);
+	glAlphaFunc(GL_GREATER, 0);
 
 	// assumes that the beam is constructed and contains kd-tree nodes
