Index: /data/branches/atmospheric_engine/shaders/mapped_water.frag
===================================================================
--- /data/branches/atmospheric_engine/shaders/mapped_water.frag	(revision 3899)
+++ /data/branches/atmospheric_engine/shaders/mapped_water.frag	(revision 3899)
@@ -0,0 +1,53 @@
+varying vec4 refrCoords; 
+varying vec4 normCoords; 
+varying vec4 viewCoords;
+varying vec4 viewTangetSpace;
+varying vec4 lightTangetSpace;
+
+uniform sampler2D reflection;
+uniform sampler2D refraction;
+uniform sampler2D normalMap;
+uniform sampler2D dudvMap;
+uniform sampler2D depthMap;
+uniform float kShine;
+uniform vec4 waterColor;
+
+void main()
+{
+	const float kDistortion = 0.015;
+	const float kRefraction = 0.009;
+
+	vec4 distOffset = texture2D(dudvMap, normCoords.xy) * kDistortion;
+	vec4 dudvColor = texture2D(dudvMap, vec2(refrCoords + distOffset));
+	dudvColor = normalize(dudvColor * 2.0 - 1.0) * kRefraction;
+
+	vec4 normalVector = texture2D(normalMap, vec2(refrCoords + distOffset));
+	normalVector = normalVector * 2.0 - 1.0;
+	normalVector.a = 0.0;
+
+	vec4 lightReflection = normalize( reflect(-lightTangetSpace, normalVector) );
+
+	vec4 invertedFresnel = vec4( dot(normalVector, lightReflection ) );
+	vec4 fresnelTerm = 1.0 - invertedFresnel;
+
+	vec4 projCoord = viewCoords / viewCoords.q;
+	projCoord = (projCoord + 1.0) * 0.5;
+	projCoord += dudvColor;
+	projCoord = clamp(projCoord, 0.001, 0.999);
+	
+	vec4 reflectionColor  = texture2D(reflection, projCoord.xy);
+	vec4 refractionColor  = texture2D(refraction, projCoord.xy);
+	vec4 depthValue = texture2D(depthMap, projCoord.xy);
+		
+	vec4 invDepth = 1.0 - depthValue;
+	refractionColor *= invertedFresnel * invDepth;
+	refractionColor +=  waterColor * depthValue * invertedFresnel;
+
+	reflectionColor *= fresnelTerm;
+
+	vec4 localView = normalize(viewTangetSpace);		
+	float intensity = max(0.0, dot(lightReflection, localView) );
+	vec4 specular = vec4(pow(intensity, kShine));
+
+	gl_FragColor = refractionColor + reflectionColor + specular; 
+}
Index: /data/branches/atmospheric_engine/shaders/mapped_water.vert
===================================================================
--- /data/branches/atmospheric_engine/shaders/mapped_water.vert	(revision 3899)
+++ /data/branches/atmospheric_engine/shaders/mapped_water.vert	(revision 3899)
@@ -0,0 +1,42 @@
+varying vec4 refrCoords; 
+varying vec4 normCoords; 
+varying vec4 viewCoords;
+varying vec4 viewTangetSpace;
+varying vec4 lightTangetSpace;
+
+uniform vec4 lightPos, cameraPos;
+
+
+void main()
+{
+	// Because we have a flat plane for water we already know the vectors for tangent space
+	vec4 tangent = vec4(1.0, 0.0, 0.0, 0.0);
+	vec4 normal = vec4(0.0, 1.0, 0.0, 0.0);
+	vec4 biTangent = vec4(0.0, 0.0, 1.0, 0.0);
+
+	// Calculate the vector coming from the vertex to the camera
+	vec4 viewDir = cameraPos - gl_Vertex;
+
+	// Compute tangent space for the view direction
+	viewTangetSpace.x = dot(viewDir, tangent);
+	viewTangetSpace.y = dot(viewDir, biTangent);
+	viewTangetSpace.z = dot(viewDir, normal);
+	viewTangetSpace.w = 1.0;
+
+	// Calculate the vector that the light hits the vertex
+	vec4 lightDir = lightPos - gl_Vertex;
+
+	// Compute tangent space for the light direction
+	lightTangetSpace.x = dot(lightDir, tangent);
+	lightTangetSpace.y = dot(lightDir, biTangent);
+	lightTangetSpace.z = dot(lightDir, normal);
+	lightTangetSpace.w = 1.0;
+
+	refrCoords = gl_MultiTexCoord1;
+	normCoords = gl_MultiTexCoord2;
+
+	// This calculates our current projection coordinates
+	viewCoords = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+	gl_Position = viewCoords;
+}
Index: /data/branches/atmospheric_engine/worlds/mountainlake.oxw
===================================================================
--- /data/branches/atmospheric_engine/worlds/mountainlake.oxw	(revision 3899)
+++ /data/branches/atmospheric_engine/worlds/mountainlake.oxw	(revision 3899)
@@ -0,0 +1,98 @@
+<WorldDataFile>
+  <name>Mountain Lake</name>
+  <menu-item-image>pictures/menu/se_vulcano_512x128.png</menu-item-image>
+  <screenshoot>pictures/menu/ss_vulcano_512x512.png</screenshoot>
+
+  <LoadScreen>
+    <BackgroundImage>pictures/load_screens/default.jpg</BackgroundImage>
+
+    <ElementCount>12</ElementCount>
+    <BackgroundPS>0,0,1.01,1</BackgroundPS>
+    <BarPS>.65,.87,.3,.05</BarPS>
+    <BarImage>pictures/load_screens/default_bar.png</BarImage>
+  </LoadScreen>
+  <WorldEntities>
+    <Hover>
+      <name>Player</name>
+      <abs-coor>50, 100, 50</abs-coor>
+    </Hover>
+
+    <SkyBox>
+     <name>Sky</name>
+     <Materialset>pictures/sky/desert</Materialset>
+     <Size>10000</Size>
+    </SkyBox>
+    <Terrain>
+      <name>water</name>
+      <model>worlds/sea_ground.obj, 4</model>
+    </Terrain>
+
+
+    <SpaceShip>
+      <name>Player2</name>
+      <model>models/ships/reap_#.obj</model>
+      <abs-coor>50,460,300</abs-coor>
+    </SpaceShip>
+
+    <MappedWater>
+      <waterpos>-500,40,-500</waterpos>
+      <watersize>1000,1000</watersize>
+      <wateruv>9</wateruv>
+      <waterflow>0.08</waterflow>
+      <lightpos>50,460,300</lightpos>
+      <shininess>10</shininess>
+      <watercolor>0.2, 0.5, 0.5</watercolor>
+      <waterangle>0</waterangle>
+    </MappedWater>
+    <!--<MappedWater>
+      <waterpos>-500,20,0</waterpos>
+      <watersize>500,500</watersize>
+      <wateruv>9</wateruv>
+      <waterflow>0.08</waterflow>
+      <lightpos>50,460,300</lightpos>
+      <shininess>80</shininess>
+      <watercolor>0.1, 0.4, 0.4</watercolor>
+      <waterangle>0</waterangle>
+    </MappedWater>
+    <MappedWater>
+      <waterpos>0,40,0</waterpos>
+      <watersize>500,500</watersize>
+      <wateruv>9</wateruv>
+      <waterflow>0.08</waterflow>
+      <lightpos>50,460,300</lightpos>
+      <shininess>80</shininess>
+      <watercolor>0.1, 0.4, 0.4</watercolor>
+      <waterangle>0</waterangle>
+    </MappedWater>
+    <MappedWater>
+      <waterpos>0,60,-500</waterpos>
+      <watersize>500,500</watersize>
+      <wateruv>9</wateruv>
+      <waterflow>0.08</waterflow>
+      <lightpos>50,460,300</lightpos>
+      <shininess>80</shininess>
+      <watercolor>0.1, 0.4, 0.4</watercolor>
+      <waterangle>0</waterangle>
+    </MappedWater>-->
+
+</WorldEntities>
+
+  <LightManager>
+    <ambient-color>1,1,1</ambient-color>
+    <Lights>
+      <Light>
+       <diffuse-color>1,1,1</diffuse-color>
+       <abs-coor>100,100,50</abs-coor>
+      </Light>
+      <Light>
+       <diffuse-color>1,1,1</diffuse-color>
+       <abs-coor>-100,0,100</abs-coor>
+      </Light>
+      <Light>
+       <diffuse-color>1,1,1</diffuse-color>
+       <abs-coor>-100,2000,50</abs-coor>
+      </Light>
+    </Lights>
+  </LightManager>
+
+</WorldDataFile>
Index: /data/branches/atmospheric_engine/worlds/sea_ground.mtl
===================================================================
--- /data/branches/atmospheric_engine/worlds/sea_ground.mtl	(revision 3899)
+++ /data/branches/atmospheric_engine/worlds/sea_ground.mtl	(revision 3899)
@@ -0,0 +1,8 @@
+newmtl blinn1SG
+illum 4
+Kd 0.00 0.00 0.00
+Ka 0.39 0.39 0.39
+Tf 1.00 1.00 1.00
+map_Kd ground-stone-grass-dirt.jpg
+Ni 1.00
+Ks 0.50 0.50 0.50
