Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h	(revision 1103)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h	(revision 1130)
@@ -68,4 +68,5 @@
 	float maxRad;
 	unsigned int focusingMapSize;
+	unsigned int shadowMapSize;
 	std::map<RenderingRunType,float> maxRads;
 	/**
@@ -151,4 +152,5 @@
 	void setMaxJoinRadius(RenderingRunType type, float rad){maxRads[type] = rad;}
 	void setFocusingMapSize(unsigned int size){focusingMapSize = size;}
+	void setShadowMapSize(unsigned int size){shadowMapSize = size;}
 	/**
 		@brief Returns the one and only OgreIlluminationManager instance.
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreDepthShadowMapRenderingRun.h
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreDepthShadowMapRenderingRun.h	(revision 1120)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreDepthShadowMapRenderingRun.h	(revision 1130)
@@ -42,5 +42,5 @@
 		@brief returns the depth shadow map texture created by this run
 	*/
-	String getDepthMapTextureName(){return name;}
+	String getDepthMapTextureName(){return blurredname;}
 	/**
 		@brief Refreshes light camera matrices, called in each update.
@@ -77,8 +77,10 @@
 	*/
 	String name;
+	String blurredname;
 	/**
 		@brief a pointer to the depth shadow texture that was created by this run
 	*/
 	Texture* depthMapTexture;
+	Texture* blurredDepthMapTexture;
 	
 	//inherited
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp	(revision 1125)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp	(revision 1130)
@@ -17,4 +17,5 @@
 	this->sharedRuns = sharedRuns;
 	this->name = name;	
+	this->blurredname = name + "blurred";
 	
 	this->materialName = materialName;
@@ -34,5 +35,5 @@
 																			0,
 																			PF_FLOAT16_RGBA,
-																			TU_RENDERTARGET);
+																			TU_RENDERTARGET);		
 		depthMapTexture = texPtr.getPointer();
 		depthMapCamera = Root::getSingleton()._getCurrentSceneManager()->createCamera(name + "_CAMERA");
@@ -42,5 +43,21 @@
 		Viewport* v = rt->addViewport(depthMapCamera);
 		v->setOverlaysEnabled(false);
-		rt->setAutoUpdated(false);	
+		rt->setAutoUpdated(false);
+
+		texPtr = Ogre::TextureManager::getSingleton().createManual(blurredname, 
+																			"default",
+																			TEX_TYPE_2D,
+																			resolutionX,
+																			resolutionY,
+																			6,
+																			0,
+																			PF_FLOAT16_RGBA,
+																			TU_RENDERTARGET);
+		blurredDepthMapTexture = texPtr.getPointer();
+		hpb = (blurredDepthMapTexture->getBuffer()).getPointer();
+		rt = hpb->getRenderTarget();
+		v = rt->addViewport(depthMapCamera);
+		v->setOverlaysEnabled(false);
+		rt->setAutoUpdated(false);
 }
 
@@ -56,7 +73,5 @@
 	{
 		updateDepthMap();
-	}
-	
-	
+	}	
 }
 
@@ -73,5 +88,14 @@
 	rt->update();
 	restoreMaterials();
-	rt->writeContentsToFile("shadowmap1.dds");
+
+	rt = blurredDepthMapTexture->getBuffer().getPointer()->getRenderTarget();
+	Material*  mat = (Material*) MaterialManager::getSingleton().getByName("GameTools/Blur").getPointer();
+	mat->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(depthMapTexture->getName());
+	renderFullscreenQuad("GameTools/Blur", rt);
+	
+	
+	//rt->writeContentsToFile("shadowmap1.dds");
+
+	//depthMapTexture->();
 }
 
@@ -118,5 +142,4 @@
 				//left = lightdir.crossProduct(up);
 				left.normalise();				
-
 				Matrix4 viewMatrix( left.x,      left.y,      left.z,		 0,
 									up.x,		 up.y,		  up.z,			 0,
@@ -142,5 +165,4 @@
 
 				Vector3 pos = campos - up * (n - nearclip);
-				
 				Matrix4 newViewMatrix(  left.x,      left.y,      left.z,		 -left.dotProduct(pos),
 										up.x,		 up.y,		  up.z,			 -up.dotProduct(pos),
@@ -148,31 +170,24 @@
 										0,           0,           0,             1);
 
-
-				Matrix4 newProjection = Matrix4::IDENTITY;
-				
-				newProjection[1][1] = (f + n) / (f - n);
-				newProjection[1][3] = - 2* f * n / (f - n);
-				newProjection[3][1] = 1;
-				newProjection[3][3] = 0;
-				//newProjection = newProjection.transpose();
-				Matrix4 standardProjMatrix = Matrix4::IDENTITY;
-				standardProjMatrix.setScale(Vector3(1,1,-1));
-				newProjection = newProjection * standardProjMatrix;
-				depthMapCamera->setCustomProjectionMatrix(true, newProjection);
-				depthMapCamera->setCustomViewMatrix(true, viewMatrix);
+				Matrix4 lispMat = Matrix4::IDENTITY;
+				
+				lispMat[1][1] = f / (f - n);
+				lispMat[1][3] = f * n / (f - n);
+				lispMat[3][1] = 1;
+				lispMat[3][3] = 0;
+				
+				depthMapCamera->setCustomProjectionMatrix(true, Matrix4::IDENTITY);
+				depthMapCamera->setCustomViewMatrix(true, lispMat * newViewMatrix);
 			}
 			else
 			{
-				Matrix4 standardProjMatrix = Matrix4::IDENTITY;
-				standardProjMatrix.setScale(Vector3(0,0,-1));
-				depthMapCamera->setCustomProjectionMatrix(true, standardProjMatrix);
+				depthMapCamera->setCustomProjectionMatrix(true, Matrix4::IDENTITY);
 				depthMapCamera->setCustomViewMatrix(false);
-				depthMapCamera->setProjectionType(PT_ORTHOGRAPHIC);			
 				depthMapCamera->setPosition(lightpos);
-				depthMapCamera->setDirection(lightdir);
+				depthMapCamera->setDirection(lightdir);				
 			}
 
 
-			Matrix4 lightMatrix = depthMapCamera->getProjectionMatrix() * depthMapCamera->getViewMatrix();
+			Matrix4 lightMatrix = depthMapCamera->getViewMatrix();
 			frun->setLightMatrix(lightMatrix);
 			
@@ -191,9 +206,5 @@
 										-(max.y + min.y) / scale.y,
 										-(max.z + min.z) / scale.z));
-			projection = projection * depthMapCamera->getProjectionMatrix();
-			depthMapCamera->setCustomProjectionMatrix(true, projection);
-			
-			
-			
+			depthMapCamera->setCustomProjectionMatrix(true, projection);			
 		}
 		else if(light->getType() == Light::LT_SPOTLIGHT)
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp	(revision 1120)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp	(revision 1130)
@@ -46,13 +46,13 @@
 		Vparams->setNamedAutoConstant("worldViewProj",
 									GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);	
+		Vparams->setNamedAutoConstant("world",
+									GpuProgramParameters::ACT_WORLD_MATRIX);
 		GpuProgramParameters* Fparams = newpass->getFragmentProgramParameters().getPointer();
 		
 		TextureUnitState* st = newpass->createTextureUnitState();		
-		st->setTextureFiltering(TFO_BILINEAR);		
-		st = newpass->createTextureUnitState();		
-		st->setTextureFiltering(TFO_BILINEAR);		
+		st->setTextureFiltering(TFO_ANISOTROPIC);						
 
-		//newpass->setSceneBlending(SBT_MODULATE);
-		newpass->setSceneBlending(SBF_ONE, SBF_ZERO);
+		newpass->setSceneBlending(SBT_MODULATE);
+		//newpass->setSceneBlending(SBF_ONE, SBF_ZERO);
 		newpass->setDepthBias(1);
 		techn->movePass(lastpass, index);			
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp	(revision 1125)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp	(revision 1130)
@@ -80,4 +80,5 @@
 	maxRad = 400;
 	focusingMapSize = 32;
+	shadowMapSize = 512;
 	
 	for(int i = 0; i < RUN_TYPE_COUNT; i++)
@@ -578,6 +579,6 @@
 				lightName + "DEPTH_SHADOW_MAP",
 				sm->getLight(lightName),
-				128, //TODO
-				128, //TODO
+				shadowMapSize,
+				shadowMapSize,
 				"GameTools/ShadowMapDepth" //TODO
 				);
