diff --git a/Effects/skydome.eff b/Effects/skydome.eff
new file mode 100644
index 000000000..5bfcc713b
--- /dev/null
+++ b/Effects/skydome.eff
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PropertyList>
+  <name>Effects/skydome</name>
+  <parameters>
+    <mie><use>/sim/rendering/mie</use></mie>
+    <rayleigh><use>/sim/rendering/rayleigh</use></rayleigh>
+    <density><use>/sim/rendering/dome-density</use></density>
+  </parameters>
+  <technique n="8">
+    <predicate>
+      <and>
+        <property>/sim/rendering/shader-effects</property>
+        <property>/sim/rendering/scattering-shader</property>
+        <or>
+          <less-equal>
+            <value type="float">2.0</value>
+            <glversion/>
+          </less-equal>
+          <and>
+            <extension-supported>GL_ARB_shader_objects</extension-supported>
+            <extension-supported>GL_ARB_shading_language_100</extension-supported>
+            <extension-supported>GL_ARB_vertex_shader</extension-supported>
+            <extension-supported>GL_ARB_fragment_shader</extension-supported>
+          </and>
+        </or>
+      </and>
+    </predicate>
+
+    <pass>
+      <lighting>true</lighting>
+      <shade-model>smooth</shade-model>
+      <cull-face>back</cull-face>
+      <program>
+        <vertex-shader>Shaders/skydome.vert</vertex-shader>
+        <fragment-shader>Shaders/skydome.frag</fragment-shader>
+      </program>
+      <uniform>
+        <name>mK</name>
+        <type>float</type>
+        <value><use>mie</use></value>
+      </uniform>
+      <uniform>
+        <name>rK</name>
+        <type>float</type>
+        <value><use>rayleigh</use></value>
+      </uniform>
+      <uniform>
+        <name>density</name>
+        <type>float</type>
+        <value><use>density</use></value>
+      </uniform>
+    </pass>
+  </technique>
+
+  <!-- fall back without shaders -->
+  <technique n="11">
+    <pass>
+      <lighting>false</lighting>
+      <shade-model>smooth</shade-model>
+      <cull-face>back</cull-face>
+    </pass>
+  </technique>
+
+</PropertyList>
diff --git a/Shaders/skydome.frag b/Shaders/skydome.frag
new file mode 100644
index 000000000..a120eb2aa
--- /dev/null
+++ b/Shaders/skydome.frag
@@ -0,0 +1,40 @@
+#version 120
+ 
+// Atmospheric scattering shader for flightgear
+// Written by Lauri Peltonen (Zan)
+// Implementation of O'Neil's algorithm
+ 
+varying vec3 rayleigh;
+varying vec3 mie;
+varying vec3 eye;
+ 
+float miePhase(in float cosTheta, in float g)
+{
+  float g2 = g*g;
+  float a = 1.5 * (1.0 - g2);
+  float b = (2.0 + g2);
+  float c = 1.0 + cosTheta*cosTheta;
+  float d = pow(1.0 + g2 - 2.0 * g * cosTheta, 0.6667);
+ 
+  return (a*c) / (b*d);
+}
+ 
+float rayleighPhase(in float cosTheta)
+{
+  //return 1.5 * (1.0 + cosTheta*cosTheta);
+  return 1.5 * (2.0 + 0.5*cosTheta*cosTheta);
+}
+ 
+ 
+ 
+void main()
+{
+  float cosTheta = dot(normalize(eye), gl_LightSource[0].position.xyz);
+ 
+  vec3 color = rayleigh * rayleighPhase(cosTheta);
+  color += mie * miePhase(cosTheta, -0.8);
+ 
+  gl_FragColor = vec4(color, 1.0);
+  gl_FragDepth = 0.1;
+}
+
diff --git a/Shaders/skydome.vert b/Shaders/skydome.vert
new file mode 100644
index 000000000..917aba508
--- /dev/null
+++ b/Shaders/skydome.vert
@@ -0,0 +1,172 @@
+#version 120
+ 
+// Atmospheric scattering shader for flightgear
+// Written by Lauri Peltonen (Zan)
+// Implementation of O'Neil's algorithm
+ 
+ 
+uniform mat4 osg_ViewMatrix;
+uniform mat4 osg_ViewMatrixInverse;
+ 
+varying vec3 rayleigh;
+varying vec3 mie;
+varying vec3 eye;
+ 
+// Dome parameters from FG and screen
+const float domeSize = 80000.0;
+const float realDomeSize = 100000.0;
+const float groundRadius = 0.984503332 * domeSize;
+const float altitudeScale = domeSize - groundRadius;
+ 
+// Dome parameters when calculating scattering
+// Assuming dome size is 5.0
+const float groundLevel = 0.984503332 * 5.0;
+const float heightScale = (5.0 - groundLevel);
+ 
+// Integration parameters
+const int nSamples = 7;
+const float fSamples = float(nSamples);
+ 
+// Scattering parameters
+uniform float rK = 0.0003; //0.00015;
+uniform float mK = 0.003; //0.0025;
+uniform float density = 0.5; //1.0
+vec3 rayleighK = rK * vec3(5.602, 7.222, 19.644);
+vec3 mieK = vec3(mK);
+vec3 sunIntensity = 10.0*vec3(120.0, 125.0, 130.0);
+ 
+// Find intersections of ray to skydome
+// ray must be normalized
+// cheight is camera height
+float intersection (in float cheight, in vec3 ray, in float rad2)
+{
+  float B = 2.0 * cheight*ray.y;
+  float C = cheight*cheight - rad2;  // 25.0 is skydome radius * radius
+  float fDet = max(0.0, B*B - 4.0 * C);
+  return 0.5 * (-B - sqrt(fDet));
+}
+ 
+// Return the scale function at height = 0 for different thetas
+float outscatterscale(in float costheta)
+{
+  float x = 1.0 - costheta;
+ 
+  float a = 1.16941;
+  float b = 0.618989;
+  float c = 6.34484;
+  float d = -31.4138;
+  float e = 75.3249;
+  float f = -80.1643;
+  float g = 32.2878;
+ 
+  return exp(a+x*(b+x*(c+x*(d+x*(e+x*(f+x*g))))));
+}
+ 
+// Return the amount of outscatter for different heights and thetas
+// assuming view ray hits the skydome
+// height is 0 at ground level and 1 at space
+// Assuming average density of atmosphere is at 1/4 height
+// and atmosphere height is 100 km
+float outscatter(in float costheta, in float height)
+{
+  return density * outscatterscale(costheta) * exp(-4.0 * height);
+}
+ 
+ 
+void main()
+{
+    // Make sure the dome is of a correct size
+    vec4 realVertex = gl_Vertex; //vec4(normalize(gl_Vertex.xyz) * domeSize, 1.0);
+ 
+    // Ground point (skydome center) in eye coordinates
+    vec4 groundPoint = gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);
+ 
+    // Calculate altitude as the distance from skydome center to camera
+    // Make it so that 0.0 is ground level and 1.0 is 100km (space) level
+    float altitude = distance(groundPoint, vec4(0.0, 0.0, 0.0, 1.0));
+    float scaledAltitude = altitude / realDomeSize;
+ 
+    // Camera's position, z is up!
+    float cameraRealAltitude = groundLevel + heightScale*scaledAltitude;
+    vec3 camera = vec3(0.0, 0.0, cameraRealAltitude);
+    vec3 sample = 5.0 * realVertex.xyz / domeSize; // Sample is the dome vertex
+    vec3 relativePosition = camera - sample; // Relative position
+ 
+    // Find intersection of skydome and view ray
+    float space = intersection(cameraRealAltitude, -normalize(relativePosition), 25.0);
+    if(space > 0.0) {
+      // We are in space, calculate correct positiondelta!
+      relativePosition -= space * normalize(relativePosition);
+    }
+ 
+    vec3 positionDelta = relativePosition / fSamples;
+    float deltaLength = length(positionDelta); // Should multiply by something?
+ 
+    vec3 lightDirection = gl_LightSource[0].position.xyz;
+ 
+    // Cos theta of camera's position and sample point
+    // Since camera is 0,0,z, dot porduct is just the z coordinate
+    float cameraCosTheta;
+ 
+    // If sample is above camera, reverse ray direction
+    if(positionDelta.z < 0.0) cameraCosTheta = -positionDelta.z / deltaLength;
+    else cameraCosTheta = positionDelta.z / deltaLength;
+ 
+    // Total attenuation from camera to skydome
+    float totalCameraScatter = outscatter(cameraCosTheta, scaledAltitude);
+ 
+ 
+    // Do numerical integration of scsattering function from skydome to camera
+    vec3 color = vec3(0.0);
+    for(int i = 0; i < nSamples; i++) 
+    {
+      // Altitude of the sample point 0...1
+      float sampleAltitude = (length(sample) - groundLevel) / heightScale;
+ 
+      // Cosine between the angle of sample's up vector and sun
+      // Since lightDirection is in eye space, we must transform sample too
+      vec3 sampleUp = gl_NormalMatrix * normalize(sample);
+      float cosTheta = dot(sampleUp, lightDirection);
+ 
+      // Scattering from sky to sample point
+      float skyScatter = outscatter(cosTheta, sampleAltitude);
+ 
+      // Calculate the attenuation from this point to camera
+      // Again, reverse the direction if vertex is over the camera
+      float cameraScatter;
+      if(relativePosition.z < 0.0) {  // Vertex is over the camera
+        cameraCosTheta = -dot(normalize(positionDelta), normalize(sample));
+        cameraScatter = totalCameraScatter - outscatter(cameraCosTheta, sampleAltitude);
+      } else {  // Vertex is below camera
+        cameraCosTheta = dot(normalize(positionDelta), normalize(sample));
+        cameraScatter = outscatter(cameraCosTheta, sampleAltitude) - totalCameraScatter;
+      }
+ 
+      // Total attenuation
+      vec3 totalAttenuate = 4.0 * 3.14159 * (rayleighK + mieK) * (-skyScatter - cameraScatter);
+ 
+      vec3 inScatter = exp(totalAttenuate - sampleAltitude*4.0);
+ 
+      color += inScatter * deltaLength;
+      sample += positionDelta;
+    }
+ 
+    color *= sunIntensity;
+ 
+    rayleigh = rayleighK * color;
+    mie = mieK * color;
+    eye = gl_NormalMatrix * positionDelta;
+ 
+ 
+ 
+    // We need to move the camera so that the dome appears to be centered around earth
+    // to make the dome render correctly!
+    float moveDown = -altitude; // Center dome on camera
+    moveDown += groundRadius;
+    moveDown += scaledAltitude * altitudeScale; // And move correctly according to altitude
+ 
+    // Vertex transformed correctly so that at 100km we are at space border
+    vec4 finalVertex = realVertex - vec4(0.0, 0.0, 1.0, 0.0) * moveDown;
+    // Transform
+    gl_Position = gl_ModelViewProjectionMatrix * finalVertex;
+}
diff --git a/gui/dialogs/rendering.xml b/gui/dialogs/rendering.xml
index d266a1be5..fe6197cb1 100644
--- a/gui/dialogs/rendering.xml
+++ b/gui/dialogs/rendering.xml
@@ -1,74 +1,78 @@
 <?xml version="1.0"?>
 
 <PropertyList>
-  <name>rendering</name>
-  <modal>false</modal>
-  <layout>vbox</layout>
-  <padding>20</padding>
+	<name>rendering</name>
+	<modal>false</modal>
+	<layout>vbox</layout>
+	<padding>20</padding>
 
-  <group>
-    <layout>hbox</layout>
-    <empty><stretch>1</stretch></empty>
+	<group>
+		<layout>hbox</layout>
+		<empty>
+			<stretch>1</stretch>
+		</empty>
 
-	<text>
-	  <label>Rendering options</label>
-	</text>
+		<text>
+			<label>Rendering options</label>
+		</text>
 
-	<empty><stretch>1</stretch></empty>
+		<empty>
+			<stretch>1</stretch>
+		</empty>
 
-	<button>
-	  <pref-width>16</pref-width>
-	  <pref-height>16</pref-height>
-	  <legend></legend>
-	  <keynum>27</keynum>
-	  <border>2</border>
-	  <binding>
-	  	<command>dialog-close</command>
-	  </binding>
-	</button>
-  </group>
+		<button>
+			<pref-width>16</pref-width>
+			<pref-height>16</pref-height>
+			<legend></legend>
+			<keynum>27</keynum>
+			<border>2</border>
+			<binding>
+				<command>dialog-close</command>
+			</binding>
+		</button>
+	</group>
 
-  <hrule/>
+	<hrule/>
 
-  <group>
-    <halign>center</halign>
-    <layout>hbox</layout>
+	<group>
+		<halign>center</halign>
+		<layout>hbox</layout>
 
-    <group>
-      <layout>vbox</layout>
+		<group>
+			<layout>vbox</layout>
 
-      <text>
-        <halign>left</halign>
-	    <label>"Material shaders" must be enabled for most options.</label>
-      </text>
-	  <text>
-        <halign>left</halign>
-	    <label>Snow is dependant on crop, landmass and urban shaders.</label>
-      </text>
+			<text>
+				<halign>left</halign>
+				<label>"Material shaders" must be enabled for most options.</label>
+			</text>
+			<text>
+				<halign>left</halign>
+				<label>Snow is dependant on crop, landmass and urban shaders.</label>
+			</text>
 
-	  <group>
-        <layout>hbox</layout>
-	    <text>
-          <label>General</label>
-          <halign>left</halign>
-        </text>
-	    <hrule>
-          <stretch>true</stretch>
-        </hrule>
-	  </group>
-	  
-	  <checkbox>
-        <halign>left</halign>
-        <label>Wireframe</label>
-		<name>wireframe</name>
-        <property>/sim/rendering/wireframe</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>wireframe</object-name>
-        </binding>
-      </checkbox>
+			<group>
+				<layout>hbox</layout>
+				<text>
+					<label>General</label>
+					<halign>left</halign>
+				</text>
+				<hrule>
+					<stretch>true</stretch>
+				</hrule>
+			</group>
 
-	  <!--
+			<checkbox>
+				<halign>left</halign>
+				<label>Wireframe</label>
+				<name>wireframe</name>
+				<property>/sim/rendering/wireframe</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>wireframe</object-name>
+				</binding>
+			</checkbox>
+
+			<!--
 
 	  <group>
         <layout>hbox</layout>
@@ -128,40 +132,40 @@
 
 	  -->
 
-      <group>
-        <layout>hbox</layout>
-	    <text>
-          <label>Objects</label>
-          <halign>left</halign>
-        </text>
-	    <hrule>
-          <stretch>true</stretch>
-        </hrule>
-	  </group>
+			<group>
+				<layout>hbox</layout>
+				<text>
+					<label>Objects</label>
+					<halign>left</halign>
+				</text>
+				<hrule>
+					<stretch>true</stretch>
+				</hrule>
+			</group>
 
-      <checkbox>
-        <halign>left</halign>
-        <label>Particles (smoke, dust, spray)</label>
-		<name>particles</name>
-        <property>/sim/rendering/particles</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>particles</object-name>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>Particles (smoke, dust, spray)</label>
+				<name>particles</name>
+				<property>/sim/rendering/particles</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>particles</object-name>
+				</binding>
+			</checkbox>
 
-      <checkbox>
-        <halign>left</halign>
-        <label>Precipitation</label>
-		<name>precipitation</name>
-        <property>/sim/rendering/precipitation-gui-enable</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>precipitation</object-name>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>Precipitation</label>
+				<name>precipitation</name>
+				<property>/sim/rendering/precipitation-gui-enable</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>precipitation</object-name>
+				</binding>
+			</checkbox>
 
-	  <!--
+			<!--
 
 	  <checkbox>
         <halign>left</halign>
@@ -174,47 +178,47 @@
 
 	  -->
 
-      <checkbox>
-        <halign>left</halign>
-        <label>Random objects (triggers scenery reload)</label>
-        <name>random-objects</name>
-        <property>/sim/rendering/random-objects</property>
-        <binding>
-          <command>dialog-apply</command>
-          <object-name>random-objects</object-name>
-        </binding>
-        <binding>
-          <command>reinit</command>
-          <subsystem>tile-manager</subsystem>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>Random objects (triggers scenery reload)</label>
+				<name>random-objects</name>
+				<property>/sim/rendering/random-objects</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>random-objects</object-name>
+				</binding>
+				<binding>
+					<command>reinit</command>
+					<subsystem>tile-manager</subsystem>
+				</binding>
+			</checkbox>
 
-      <checkbox>
-        <halign>left</halign>
-        <label>Random vegetation</label>
-		<name>random-vegetation</name>
-		<enable>
-          <property>/sim/rendering/shader-effects</property>
-        </enable>
-        <property>/sim/rendering/random-vegetation</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>random-vegetation</object-name>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>Random vegetation</label>
+				<name>random-vegetation</name>
+				<enable>
+					<property>/sim/rendering/shader-effects</property>
+				</enable>
+				<property>/sim/rendering/random-vegetation</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>random-vegetation</object-name>
+				</binding>
+			</checkbox>
 
-	  <group>
-        <layout>hbox</layout>
-	    <text>
-          <label>Clouds</label>
-          <halign>left</halign>
-        </text>
-	    <hrule>
-          <stretch>true</stretch>
-        </hrule>
-	  </group>
+			<group>
+				<layout>hbox</layout>
+				<text>
+					<label>Clouds</label>
+					<halign>left</halign>
+				</text>
+				<hrule>
+					<stretch>true</stretch>
+				</hrule>
+			</group>
 
-	  <!--
+			<!--
 
 	  <checkbox>
         <halign>left</halign>
@@ -227,340 +231,473 @@
 
 	  -->
 
-      <checkbox>
-	    <halign>left</halign>
-        <label>3D clouds</label>
-		<name>3d-clouds</name>
-		<enable>
-          <property>/sim/rendering/shader-effects</property>
-        </enable>
-        <property>/sim/rendering/clouds3d-enable</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>3d-clouds</object-name>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>3D clouds</label>
+				<name>3d-clouds</name>
+				<enable>
+					<property>/sim/rendering/shader-effects</property>
+				</enable>
+				<property>/sim/rendering/clouds3d-enable</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>3d-clouds</object-name>
+				</binding>
+			</checkbox>
 
-      <group>
-        <layout>hbox</layout>
-        <halign>right</halign>
-        <text>
-		  <label>Cloud density</label>
-		  <enable>
-            <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-		</text>
-        <slider>
-		  <name>cloud-density</name>
-		  <enable>
-            <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-          <min>0</min>
-          <max>1.0</max>
-          <property>/sim/rendering/clouds3d-density</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>cloud-density</object-name>
-          </binding>
-		  <binding>
-            <command>property-toggle</command>
-			<property>/sim/rendering/clouds3d-enable</property>
-          </binding>
-		  <binding>
-            <command>property-toggle</command>
-			<property>/sim/rendering/clouds3d-enable</property>
-          </binding>
-        </slider>
-        <text>
-		  <enable>
-            <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-          <label>12345678</label>
-          <format>%.2f</format>
-          <live>true</live>
-          <property>/sim/rendering/clouds3d-density</property>
-        </text>
-      </group>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Cloud density</label>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+				</text>
+				<slider>
+					<name>cloud-density</name>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+					<min>0</min>
+					<max>1.0</max>
+					<property>/sim/rendering/clouds3d-density</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>cloud-density</object-name>
+					</binding>
+					<binding>
+						<command>property-toggle</command>
+						<property>/sim/rendering/clouds3d-enable</property>
+					</binding>
+					<binding>
+						<command>property-toggle</command>
+						<property>/sim/rendering/clouds3d-enable</property>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+					<label>12345678</label>
+					<format>%.2f</format>
+					<live>true</live>
+					<property>/sim/rendering/clouds3d-density</property>
+				</text>
+			</group>
 
-      <group>
-        <layout>hbox</layout>
-        <halign>right</halign>
-        <text>
-		  <label>Cloud visibility range</label>
-		  <enable>
-            <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-		</text>
-        <slider>
-		  <name>cloud-vis-range</name>
-          <enable>
-            <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-		  <min>100.0</min>
-          <max>20000.0</max>
-          <property>/sim/rendering/clouds3d-vis-range</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>cloud-vis-range</object-name>
-          </binding>
-        </slider>
-        <text>
-          <enable>
-		    <and>
-              <property>/sim/rendering/shader-effects</property>
-			  <property>/sim/rendering/clouds3d-enable</property>
-			</and>
-          </enable>
-		  <label>12345678</label>
-          <format>%.fm</format>
-          <live>true</live>
-          <property>/sim/rendering/clouds3d-vis-range</property>
-        </text>
-      </group>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Cloud visibility range</label>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+				</text>
+				<slider>
+					<name>cloud-vis-range</name>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+					<min>100.0</min>
+					<max>20000.0</max>
+					<property>/sim/rendering/clouds3d-vis-range</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>cloud-vis-range</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<property>/sim/rendering/clouds3d-enable</property>
+						</and>
+					</enable>
+					<label>12345678</label>
+					<format>%.fm</format>
+					<live>true</live>
+					<property>/sim/rendering/clouds3d-vis-range</property>
+				</text>
+			</group>
 
-	  <group>
-	    <layout>vbox</layout>
-		<stretch>1</stretch>
-	  </group>
+			<group>
+				<layout>vbox</layout>
+				<stretch>1</stretch>
+			</group>
 
-    </group>
+		</group>
 
-    <vrule/>
+		<vrule/>
 
-    <group>
-      <layout>vbox</layout>
+		<group>
+			<layout>vbox</layout>
 
-      <group>
-        <layout>hbox</layout>
-	    <text>
-          <label>Shader effects</label>
-          <halign>left</halign>
-        </text>
-	    <hrule>
-          <stretch>true</stretch>
-        </hrule>
-	  </group>
+			<group>
+				<layout>hbox</layout>
+				<text>
+					<label>Shader effects</label>
+					<halign>left</halign>
+				</text>
+				<hrule>
+					<stretch>true</stretch>
+				</hrule>
+			</group>
 
-      <checkbox>
-        <halign>left</halign>
-        <label>Material shaders</label>
-		<name>material-shaders</name>
-        <property>/sim/rendering/shader-effects</property>
-        <binding>
-          <command>dialog-apply</command>
-		  <object-name>material-shaders</object-name>
-        </binding>
-      </checkbox>
+			<checkbox>
+				<halign>left</halign>
+				<label>Material shaders</label>
+				<name>material-shaders</name>
+				<property>/sim/rendering/shader-effects</property>
+				<binding>
+					<command>dialog-apply</command>
+					<object-name>material-shaders</object-name>
+				</binding>
+			</checkbox>
 
-      <group>
-        <layout>vbox</layout>
-        <padding>10</padding>
+			<group>
+				<layout>vbox</layout>
+				<padding>10</padding>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Crop texture</label>
-		  <name>crop-texture</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/crop-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>crop-texture</object-name>
-          </binding>
-        </checkbox>
+				<checkbox>
+					<halign>left</halign>
+					<label>Crop texture</label>
+					<name>crop-texture</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/crop-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>crop-texture</object-name>
+					</binding>
+				</checkbox>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Landmass effects</label>
-		  <name>landmass-effects</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/landmass-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>landmass-effects</object-name>
-          </binding>
-        </checkbox>
+				<checkbox>
+					<halign>left</halign>
+					<label>Landmass effects</label>
+					<name>landmass-effects</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/landmass-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>landmass-effects</object-name>
+					</binding>
+				</checkbox>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Water reflection</label>
-		  <name>water-reflection</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/water-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>water-reflection</object-name>
-          </binding>
-        </checkbox>
+				<checkbox>
+					<halign>left</halign>
+					<label>Water reflection</label>
+					<name>water-reflection</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/water-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>water-reflection</object-name>
+					</binding>
+				</checkbox>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Urban effects</label>
-		  <name>urban-effects</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/urban-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>urban-effects</object-name>
-          </binding>
-        </checkbox>
+				<checkbox>
+					<halign>left</halign>
+					<label>Urban effects</label>
+					<name>urban-effects</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/urban-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>urban-effects</object-name>
+					</binding>
+				</checkbox>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Transition effects</label>
-		  <name>transition-effects</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/transition-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>transition-effects</object-name>
-          </binding>
-        </checkbox>
+				<checkbox>
+					<halign>left</halign>
+					<label>Transition effects</label>
+					<name>transition-effects</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/transition-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>transition-effects</object-name>
+					</binding>
+				</checkbox>
 
-        <checkbox>
-          <halign>left</halign>
-          <label>Persistent contrails</label>
-		  <name>persistent-contrails</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <property>/sim/rendering/contrail-shader</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>persistent-contrails</object-name>
-          </binding>
-        </checkbox>
-      </group>
+				<checkbox>
+					<halign>left</halign>
+					<label>Persistent contrails</label>
+					<name>persistent-contrails</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/contrail-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>persistent-contrails</object-name>
+					</binding>
+				</checkbox>
+			</group>
 
-      <group>
-        <layout>hbox</layout>
-        <halign>right</halign>
-        <text>
-          <label>Snow line</label>
-          <enable>
-            <and>
-			  <property>/sim/rendering/shader-effects</property>
-			  <or>
-			    <property>/sim/rendering/crop-shader</property>
-			    <property>/sim/rendering/landmass-shader</property>
-			    <property>/sim/rendering/urban-shader</property>
-			  </or>
-			</and>
-          </enable>
-        </text>
-        <slider>
-          <name>snow-level</name>
-          <enable>
-			<and>
-			  <property>/sim/rendering/shader-effects</property>
-			  <or>
-			    <property>/sim/rendering/crop-shader</property>
-			    <property>/sim/rendering/landmass-shader</property>
-			    <property>/sim/rendering/urban-shader</property>
-			  </or>
-			</and>
-          </enable>
-          <min>0.0</min>
-          <max>5000.0</max>
-          <property>/sim/rendering/snow-level-m</property>
-          <binding>
-            <command>dialog-apply</command>
-            <object-name>snow-level</object-name>
-          </binding>
-        </slider>
-        <text>
-          <enable>
-            <and>
-			  <property>/sim/rendering/shader-effects</property>
-			  <or>
-			    <property>/sim/rendering/crop-shader</property>
-			    <property>/sim/rendering/landmass-shader</property>
-			    <property>/sim/rendering/urban-shader</property>
-			  </or>
-			</and>
-          </enable>
-          <label>12345678</label>
-          <format>%.fm</format>
-          <live>true</live>
-          <property>/sim/rendering/snow-level-m</property>
-        </text>
-      </group>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Snow line</label>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<or>
+								<property>/sim/rendering/crop-shader</property>
+								<property>/sim/rendering/landmass-shader</property>
+								<property>/sim/rendering/urban-shader</property>
+							</or>
+						</and>
+					</enable>
+				</text>
+				<slider>
+					<name>snow-level</name>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<or>
+								<property>/sim/rendering/crop-shader</property>
+								<property>/sim/rendering/landmass-shader</property>
+								<property>/sim/rendering/urban-shader</property>
+							</or>
+						</and>
+					</enable>
+					<min>0.0</min>
+					<max>5000.0</max>
+					<property>/sim/rendering/snow-level-m</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>snow-level</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<and>
+							<property>/sim/rendering/shader-effects</property>
+							<or>
+								<property>/sim/rendering/crop-shader</property>
+								<property>/sim/rendering/landmass-shader</property>
+								<property>/sim/rendering/urban-shader</property>
+							</or>
+						</and>
+					</enable>
+					<label>12345678</label>
+					<format>%.fm</format>
+					<live>true</live>
+					<property>/sim/rendering/snow-level-m</property>
+				</text>
+			</group>
 
-      <group>
-        <layout>hbox</layout>
-        <halign>right</halign>
-        <text>
-		  <label>Performance vs Quality</label>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-		</text>
-        <slider>
-		  <name>quality-level</name>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <min>0.0</min>
-          <max>5.0</max>
-          <step>0.5</step>
-          <property>/sim/rendering/quality-level</property>
-          <binding>
-            <command>dialog-apply</command>
-			<object-name>quality-level</object-name>
-          </binding>
-        </slider>
-        <text>
-		  <enable>
-            <property>/sim/rendering/shader-effects</property>
-          </enable>
-          <label>12345678</label>
-          <format>%.1f</format>
-          <live>true</live>
-          <property>/sim/rendering/quality-level</property>
-        </text>
-      </group>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Performance vs Quality</label>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+				</text>
+				<slider>
+					<name>quality-level</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<min>0.0</min>
+					<max>5.0</max>
+					<step>0.5</step>
+					<property>/sim/rendering/quality-level</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>quality-level</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<label>12345678</label>
+					<format>%.1f</format>
+					<live>true</live>
+					<property>/sim/rendering/quality-level</property>
+				</text>
+			</group>
 
-    </group>
-  </group>
+			<group>
+				<layout>hbox</layout>
+				<text>
+					<label>Experimental effects</label>
+					<halign>left</halign>
+				</text>
+				<hrule>
+					<stretch>true</stretch>
+				</hrule>
+			</group>
+			
+			<group>
+				<layout>vbox</layout>
+				<padding>10</padding>
+				<checkbox>
+					<halign>left</halign>
+					<label>Skydome scattering</label>
+					<name>skydome-scattering</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<property>/sim/rendering/scattering-shader</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>skydome-scattering</object-name>
+					</binding>
+				</checkbox>
+			</group>
 
-  <hrule/>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Mie factor</label>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+				</text>
+				<slider>
+					<name>mie-factor</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<min>0.0</min>
+					<max>0.01</max>
+					<step>0.001</step>
+					<property>/sim/rendering/mie</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>mie-factor</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<label>12345678</label>
+					<format>%.3f</format>
+					<live>true</live>
+					<property>/sim/rendering/mie</property>
+				</text>
+			</group>
+			
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Rayleigh factor</label>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+				</text>
+				<slider>
+					<name>rayleigh-factor</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<min>0.0</min>
+					<max>0.001</max>
+					<step>0.0001</step>
+					<property>/sim/rendering/rayleigh</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>rayleigh-factor</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<label>12345678</label>
+					<format>%.4f</format>
+					<live>true</live>
+					<property>/sim/rendering/rayleigh</property>
+				</text>
+			</group>
 
-  <button>
-    <legend>Close</legend>
-    <default>true</default>
-    <key>Esc</key>
-    <binding>
-      <command>dialog-close</command>
-    </binding>
-  </button>
+			<group>
+				<layout>hbox</layout>
+				<halign>right</halign>
+				<text>
+					<label>Density factor</label>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+				</text>
+				<slider>
+					<name>density-factor</name>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<min>0.0</min>
+					<max>1.0</max>
+					<step>0.1</step>
+					<property>/sim/rendering/dome-density</property>
+					<binding>
+						<command>dialog-apply</command>
+						<object-name>density-factor</object-name>
+					</binding>
+				</slider>
+				<text>
+					<enable>
+						<property>/sim/rendering/shader-effects</property>
+					</enable>
+					<label>12345678</label>
+					<format>%.1f</format>
+					<live>true</live>
+					<property>/sim/rendering/dome-density</property>
+				</text>
+			</group>
 
-  <nasal>
-    <open>
-      gui.enable_widgets(cmdarg(), "shadows-debug", getprop("/sim/gui/devel-widgets"));
-    </open>
-  </nasal>
+
+
+		</group>
+	</group>
+
+	<hrule/>
+
+	<button>
+		<legend>Close</legend>
+		<default>true</default>
+		<key>Esc</key>
+		<binding>
+			<command>dialog-close</command>
+		</binding>
+	</button>
+
+	<nasal>
+		<open>
+			gui.enable_widgets(cmdarg(), "shadows-debug", getprop("/sim/gui/devel-widgets"));
+		</open>
+	</nasal>
 </PropertyList>