Index: experimental/distortionNG/distortionNG.cpp
===================================================================
--- experimental/distortionNG/distortionNG.cpp	(revision 331)
+++ experimental/distortionNG/distortionNG.cpp	(revision 332)
@@ -130,5 +130,10 @@
 	- Verzerrung der Textur-Koordinaten aus der RTT-Szene
     - Verzerrung des Meshes im Verzerrungs-Rendern
- Die IntensityMap muss über das fertige verzerrte Bild gelegt werden.
+ * 
+ Die IntensityMap kann folgendermaßen angewendet werden:
+ * Extrahierung der Coloran den Mesh-Nodes und anwendung als Color im Mesh node. Vorteil : Einfach. Nachteil: Helligkeiten werden zwischen Mesh-Nodes interpoliert: nur grobe Intensity Steuerung möglich
+ * Anwendung der Intensity-Textur pro Pixel: Verwenden eines Sharders um die Frament-Color mit der Farbe der Intensity-color zu multiplizieren
+ * 
+ -> Evtl. sollte die Funktion der Intensitysteuerung aus den OSG-Distortion-Funktionen ausgeklammert und als eigene OSG-Schnittstelle/Funktion angestrebt werden.
 
 
Index: experimental/distortionNG/extViewer.cpp
===================================================================
--- experimental/distortionNG/extViewer.cpp	(revision 331)
+++ experimental/distortionNG/extViewer.cpp	(revision 332)
@@ -32,5 +32,59 @@
 }
 
-static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, osg::Image* intensityMap, const osg::Matrix& projectorMatrix)
+static void configureShaders( osg::StateSet* stateSet )
+{
+	// Create Shaders
+    const std::string vertexSource = 
+		"uniform sampler2D sceneTexture;\n"
+		"uniform sampler2D intensityMapTexture;\n"
+        "uniform mat4 osg_ModelViewProjectionMatrix; \n"
+		//"uniform vec3 ecLightDir; \n"
+        " \n"
+        "in vec4 osg_Vertex; \n"
+		"in vec4 osg_Color; \n"
+        " \n"
+        "void main() \n"
+        "{ \n"
+        "    gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex; \n"
+		"	 gl_FrontColor = osg_Color;\n"
+		" \n"
+        "} \n";
+
+    osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, vertexSource );
+	vShader->setName("intensityMapVertShader");
+
+    const std::string fragmentSource = 
+		"uniform sampler2D sceneTexture;\n"
+		"uniform sampler2D intensityMapTexture;\n"
+        "varying vec2 texcoord;\n"
+        "\n"
+        "void main(void) \n"
+        "{\n"
+		"	 vec2 texcoord0 = vec2( gl_TexCoord[0] );\n"
+		"	 vec2 texcoord1 = vec2( gl_TexCoord[1] );\n"
+        "    gl_FragColor = texture2D( sceneTexture, texcoord0) * texture2D( sceneTexture, texcoord0); \n"
+        "}\n";
+    osg::Shader* fShader = new osg::Shader( osg::Shader::FRAGMENT, fragmentSource );
+	fShader->setName("intensityMapFragShader");
+
+	// Create Programm
+    osg::Program* program = new osg::Program;
+    program->addShader( vShader );
+    program->addShader( fShader );
+	program->setName("intensityMapFragProgramm");
+    stateSet->setAttribute( program );
+
+	osg::Uniform* sceneTextureSampler = new osg::Uniform("sceneTexture",0);
+    stateSet->addUniform(sceneTextureSampler);
+	osg::Uniform* intensityMapTextureSampler = new osg::Uniform("intensityMapTexture",1);
+    stateSet->addUniform(intensityMapTextureSampler);
+
+
+    /*osg::Vec3f lightDir( 0., 0.5, 1. );
+    lightDir.normalize();
+    stateSet->addUniform( new osg::Uniform( "ecLightDir", lightDir ) );*/
+}
+
+static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, osg::Image* intensityMap, bool applyIntensityMapAsColours, const osg::Matrix& projectorMatrix)
 {
 	// Create Quad to render on
@@ -73,5 +127,5 @@
 
 			// Set Color of the mesh node
-			if (intensityMap)
+			if (intensityMap && applyIntensityMapAsColours)
 			{
 				colors->push_back(intensityMap->getColor(texcoord));
@@ -109,4 +163,10 @@
 		}
 		geom->addPrimitiveSet( de.get() );
+	}
+
+	if (intensityMap && !applyIntensityMapAsColours)
+	{
+		configureShaders( geom->getOrCreateStateSet() );
+		geom->setInitialBound( osg::BoundingBox(origin, origin+widthVector+heightVector) );
 	}
 
@@ -215,5 +275,5 @@
         osg::Geode* geode = new osg::Geode();
 		//geode->addDrawable(createParoramicSphericalDisplayDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 1, 0.45, intensityMap, projectorMatrix));
-		osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, intensityMap, projectorMatrix);
+		osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, intensityMap, applyIntensityMapAsColours, projectorMatrix);
 		geode->addDrawable(distortionMesh);
 
