Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3356)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3360)
@@ -6,5 +6,7 @@
 //-- ssao + gi parameters
 
-#define NUM_PRECOMPUTED_SAMPLES 8124
+//#define NUM_PRECOMPUTED_SAMPLES 8124
+#define NUM_PRECOMPUTED_SAMPLES 4096
+//#define NUM_PRECOMPUTED_SAMPLES 2048
 
 //#define NUM_SAMPLES 8
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 3168)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 3360)
@@ -102,4 +102,5 @@
 	//pix.id = glstate.fog.color.xyz;
 	// the offset to the world pos from old frame
+	//pix.offsVec = float3(0,0,0);
 	pix.offsVec = IN.oldWorldPos.xyz - IN.worldPos.xyz;
 
@@ -124,4 +125,5 @@
 	// the offset to the world pos from old frame
 	pix.offsVec = IN.oldWorldPos.xyz - IN.worldPos.xyz;
+	//pix.offsVec = float3(0,0,0);
 
 	return pix;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3353)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 3360)
@@ -40,5 +40,5 @@
 
 	// hack: prevent to shade the sky
-#if 0
+#if 1
 	if (color.w > DEPTH_THRESHOLD)
 	{
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3359)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3360)
@@ -551,5 +551,5 @@
 	camera = new PerspectiveCamera(winWidth / winHeight, fov);
 	camera->SetNear(nearDist);
-	camera->SetFar(1000);
+	camera->SetFar(1e6f);
 
 	camera->SetDirection(camDir);
@@ -621,5 +621,4 @@
 	//resourceManager->mUseNormalMapping = true;
 	//resourceManager->mUseNormalMapping = false;
-
 	resourceManager->mUseSpecialColors = true;
 
@@ -632,5 +631,5 @@
 
 	if (0) LoadPompeiiFloor();
-
+#if 1
 
 #if 0
@@ -647,11 +646,17 @@
 	VertexArray positions;
 	
+	// for buddha (lowres)
 	/*positions.push_back(Vector3(6.07307, 8.20723, 6.62));
 	positions.push_back(Vector3(-17.1935, 11.1687, 8.8781));
 	positions.push_back(Vector3(1.50032, 31.1943, 19.1f));*/
 
-	positions.push_back(Vector3(6.07307, 8.20723, 4.6f));
-	positions.push_back(Vector3(-17.1935, 11.1687, 6.8f));
-	positions.push_back(Vector3(1.50032, 31.1943, 17.6f));
+	// for happy buddha
+	//positions.push_back(Vector3(6.07307, 8.20723, 4.6f));
+	//positions.push_back(Vector3(-17.1935, 11.1687, 6.8f));
+	//positions.push_back(Vector3(1.50032, 31.1943, 17.6f));
+
+	// for dragon
+	//positions.push_back(Vector3(6.07307, 8.20723, 5.0f));
+	positions.push_back(Vector3(0, 0, -0.8));
 
 #endif
@@ -661,6 +666,7 @@
 	
 	//LoadModel("hbuddha.dem", dynamicObjects);
-	//LoadModel("horse.dem", dynamicObjects);
-	LoadModel("happy.dem", dynamicObjects);
+	LoadModel("horse.dem", dynamicObjects);
+	//LoadModel("happy.dem", dynamicObjects);
+	//LoadModel("dragon.dem", dynamicObjects);
 	//LoadModel("torus.dem", dynamicObjects);
 	//LoadModel("venusm.dem", dynamicObjects);
@@ -680,12 +686,17 @@
 
 	// hack: second buddha
-	dynamicObjects[2]->GetTransform()->MultMatrix(rotMatrix);
-	dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix);
 	dynamicObjects[0]->GetTransform()->MultMatrix(rotMatrix);
 	dynamicObjects[0]->GetTransform()->MultMatrix(scaleMatrix);
-	dynamicObjects[1]->GetTransform()->MultMatrix(scaleMatrix);
-	dynamicObjects[2]->GetTransform()->MultMatrix(scaleMatrix);
+
+	//dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix);
+	//dynamicObjects[1]->GetTransform()->MultMatrix(scaleMatrix);
+
+	//dynamicObjects[2]->GetTransform()->MultMatrix(rotMatrix);
+	//dynamicObjects[2]->GetTransform()->MultMatrix(scaleMatrix);
 
 	cout << "dynamic objects: " << (int)dynamicObjects.size() << endl;
+
+	CreateAnimation(positions[0]);
+#endif
 
 	// hack
@@ -722,5 +733,6 @@
 
 	// set far plane based on scene extent
-	farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal());
+	//farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal());
+	farDist = 1000.0f;
 	camera->SetFar(farDist);
 
@@ -739,6 +751,4 @@
 	/// the turbitity of the sky (from clear to hazy, use <3 for clear sky)
 	preetham = new SkyPreetham(turbitity, skyDome);
-
-	CreateAnimation(positions[0]);
 
 
@@ -1606,20 +1616,20 @@
 		break;
 	case '9':
-		ssaoKernelRadius *= 0.8f;
+		ssaoKernelRadius *= .8f;
 		cout << "new ssao kernel radius: " << ssaoKernelRadius << endl;
 		if (deferredShader) deferredShader->SetKernelRadius(ssaoKernelRadius);
 		break;
 	case '0':
-		ssaoKernelRadius *= 1.0f / 0.8f;
+		ssaoKernelRadius *= 1.0f / .8f;
 		if (deferredShader) deferredShader->SetKernelRadius(ssaoKernelRadius);
 		cout << "new ssao kernel radius: " << ssaoKernelRadius << endl;
 		break;
 	case 'n':
-		ssaoSampleIntensity *= 0.9f;
+		ssaoSampleIntensity *= .9f;
 		if (deferredShader) deferredShader->SetSampleIntensity(ssaoSampleIntensity);
 		cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl;
 		break;
 	case 'N':
-		ssaoSampleIntensity *= 1.0f / 0.9f;
+		ssaoSampleIntensity *= 1.0f / .9f;
 		if (deferredShader) deferredShader->SetSampleIntensity(ssaoSampleIntensity);
 		cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl;
@@ -1671,4 +1681,5 @@
 	case 'T':
 		useTemporalCoherence = !useTemporalCoherence;
+		cout << "using temporal coherence " << useTemporalCoherence << endl;
 		break;
 	case 'a':
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3352)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3360)
@@ -674,4 +674,5 @@
 		FilterSsao(fbo);
 		CombineSsao(fbo);
+
 		break;
 	case GI:
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/data/city/model/plane.obj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/data/city/model/plane.obj	(revision 3360)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/data/city/model/plane.obj	(revision 3360)
@@ -0,0 +1,5 @@
+v  30 -30 0
+v  30  30 0
+v -30  30 0
+v -30 -30 0
+f 1 2 3 4
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3334)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3360)
@@ -143,5 +143,5 @@
 ssaoSampleIntensity=0.8f
 # ssao temporal coherence factor
-tempCohFactor=2000.0f
+tempCohFactor=1500.0f
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3358)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3360)
@@ -401,5 +401,5 @@
 }
 
-#if 0
+#if 1
 
 bool ObjConverter::WriteFile(const string &filename)
@@ -450,4 +450,31 @@
 	}
 
+	int texId = 0;
+	ofile.write(reinterpret_cast<char *>(&texId), sizeof(int));
+
+	bool alphaTestEnabled = false;
+	//bool cullFaceEnabled = false;
+	bool cullFaceEnabled = true;
+		
+	ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool));
+	ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool));
+
+	// material
+	bool hasMaterial = true;
+	ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool));
+	
+	SimpleVec ambient, diffuse, spec, emm;
+
+	ambient.x = ambient.y = ambient.z = 0.2f;
+	diffuse.x = diffuse.y = diffuse.z = 1.0f;
+	spec.x = spec.y = spec.z = .0f;
+	emm = spec;
+
+	// only write rgb part of the material
+	ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec));
+	ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec));
+	ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec));
+	ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec));
+
 
 	int entityCount = 1;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp	(revision 3358)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp	(revision 3360)
@@ -300,5 +300,4 @@
 	{
 		//cout << "line: " << line << endl;
-
 		switch (str[0])
 		{
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 3357)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 3360)
@@ -1,4 +1,4 @@
-//#include "ObjConverter.h"
-#include "PlyConverter.h"
+#include "ObjConverter.h"
+//#include "PlyConverter.h"
 #include <iostream>
 #include <time.h>
@@ -12,6 +12,6 @@
 
 	//ObjConverter2 converter;
-	//ObjConverter converter;
-	PlyConverter converter;
+	ObjConverter converter;
+	//PlyConverter converter;
 
 	cout << "converting obj to dem format" << endl;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/sibenik.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/sibenik.env	(revision 3343)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/sibenik.env	(revision 3360)
@@ -52,10 +52,10 @@
 keyForwardMotion=30.0f
 
-camPosition=53.7718 -2.29418 8.67807
-camDirection=-0.994522 0.104525 -0
+#camPosition=53.7718 -2.29418 8.67807
+#camDirection=-0.994522 0.104525 -0
 
 #lightDirection=0.509293 0.784034 -0.35484
 #lightDirection=0.360937 0.0267167 -0.932207
-lightDirection=0.556361 0.559966 -0.613923
+#lightDirection=0.556361 0.559966 -0.613923
 
 #####################
@@ -113,2 +113,9 @@
 defaultAmbient=0.4 0.4 0.4
 defaultDiffuse=1.4 1.4 1.4
+
+
+# good view point for buddha
+
+camPosition=6.13507 5.48306 7.48809
+camDirection=-0.0136068 0.974275 -0.224952
+lightDirection=0.556361 0.559966 -0.613923
