Explorar el Código

Added a GLSL150 to most of the shaders used in the engine (except deprecated ones).
All shaders now import the GLSLCompat.glsllib

Nehon hace 8 años
padre
commit
d537a1c22e
Se han modificado 51 ficheros con 149 adiciones y 372 borrados
  1. 4 0
      jme3-core/src/main/java/com/jme3/post/HDRRenderer.java
  2. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Blur/HGaussianBlur.frag
  3. 3 3
      jme3-core/src/main/resources/Common/MatDefs/Blur/HGaussianBlur.j3md
  4. 9 6
      jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur.frag
  5. 2 10
      jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur.j3md
  6. 0 50
      jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur15.frag
  7. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Blur/VGaussianBlur.frag
  8. 3 3
      jme3-core/src/main/resources/Common/MatDefs/Blur/VGaussianBlur.j3md
  9. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Light/Deferred.j3md
  10. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Light/Glow.frag
  11. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.frag
  12. 12 90
      jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.j3md
  13. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.vert
  14. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag
  15. 5 6
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.j3md
  16. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.frag
  17. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.vert
  18. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag
  19. 18 36
      jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md
  20. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.vert
  21. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.frag
  22. 2 2
      jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.j3md
  23. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.vert
  24. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.frag
  25. 3 3
      jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.j3md
  26. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.vert
  27. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Misc/SoftParticle.vert
  28. 10 65
      jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.j3md
  29. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.frag
  30. 2 2
      jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.j3md
  31. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.vert
  32. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.frag
  33. 2 29
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.j3md
  34. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.vert
  35. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.frag
  36. 2 2
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.j3md
  37. 1 0
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.vert
  38. 1 0
      jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib
  39. 7 13
      jme3-core/src/main/resources/Common/ShaderLib/MultiSample.glsllib
  40. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.frag
  41. 2 2
      jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.j3md
  42. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.vert
  43. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/Post/Post.vert
  44. 18 17
      jme3-effects/src/main/resources/Common/MatDefs/Post/ToneMap.frag
  45. 2 10
      jme3-effects/src/main/resources/Common/MatDefs/Post/ToneMap.j3md
  46. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.frag
  47. 1 3
      jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert
  48. 2 2
      jme3-effects/src/main/resources/Common/MatDefs/Water/SimpleWater.j3md
  49. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/Water/simple_water.frag
  50. 1 0
      jme3-effects/src/main/resources/Common/MatDefs/Water/simple_water.vert
  51. 11 14
      jme3-examples/src/main/java/jme3test/post/TestPostFilters.java

+ 4 - 0
jme3-core/src/main/java/com/jme3/post/HDRRenderer.java

@@ -47,6 +47,10 @@ import com.jme3.ui.Picture;
 import java.util.Collection;
 import java.util.logging.Logger;
 
+/**
+ * @deprecated use the ToneMappingFilter.
+ */
+@Deprecated
 public class HDRRenderer implements SceneProcessor {
 
     private static final int LUMMODE_NONE = 0x1,

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Blur/HGaussianBlur.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
 uniform float m_Size;
 uniform float m_Scale;

+ 3 - 3
jme3-core/src/main/resources/Common/MatDefs/Blur/HGaussianBlur.j3md

@@ -1,4 +1,4 @@
-MaterialDef Bloom {
+MaterialDef HGaussianBlur {
 
     MaterialParameters {
         Int NumSamples
@@ -8,8 +8,8 @@ MaterialDef Bloom {
     }
 
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Post/Post.vert
-        FragmentShader GLSL100: Common/MatDefs/Blur/HGaussianBlur.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Post/Post.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Blur/HGaussianBlur.frag
 
         WorldParameters {
         }

+ 9 - 6
jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur.frag

@@ -1,7 +1,11 @@
-uniform sampler2D m_Texture;
+#import "Common/ShaderLib/GLSLCompat.glsllib"
+#import "Common/ShaderLib/MultiSample.glsllib"
+
+uniform COLORTEXTURE m_Texture;
 uniform float m_SampleDist;
 uniform float m_SampleStrength;
 uniform float m_Samples[10];
+
 varying vec2 texCoord;
 
 void main(void)
@@ -22,15 +26,14 @@ void main(void)
 
     // this is the original colour of this fragment
     // using only this would result in a nonblurred version
-    vec4 colorRes = texture2D(m_Texture,texCoord);
+    vec4 colorRes = getColor(m_Texture,texCoord);
 
     vec4 sum = colorRes;
 
     // take 10 additional blur samples in the direction towards
     // the center of the screen
-    for (int i = 0; i < 10; i++)
-    {
-      sum += texture2D( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
+    for (int i = 0; i < 10; i++){
+      sum += getColor( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
     }
 
     // we have taken eleven samples
@@ -42,6 +45,6 @@ void main(void)
     t = clamp( t ,0.0,1.0); //0 &lt;= t &lt;= 1
 
     //Blend the original color with the averaged pixels
-    gl_FragColor =mix( colorRes, sum, t );
+    gl_FragColor = mix( colorRes, sum, t );
      
 }

+ 2 - 10
jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur.j3md

@@ -10,8 +10,8 @@ MaterialDef Radial Blur {
     }
 
     Technique {
-        VertexShader GLSL150:   Common/MatDefs/Post/Post15.vert
-        FragmentShader GLSL150: Common/MatDefs/Blur/RadialBlur15.frag
+        VertexShader GLSL120 GLSL150:   Common/MatDefs/Post/Post.vert
+        FragmentShader GLSL120 GLSL150: Common/MatDefs/Blur/RadialBlur.frag
 
         WorldParameters {
         }
@@ -20,12 +20,4 @@ MaterialDef Radial Blur {
             RESOLVE_MS : NumSamples
         }
     }
-
-    Technique {
-        VertexShader GLSL120:   Common/MatDefs/Post/Post.vert
-        FragmentShader GLSL120: Common/MatDefs/Blur/RadialBlur.frag
-
-        WorldParameters {
-        }
-    }
 }

+ 0 - 50
jme3-core/src/main/resources/Common/MatDefs/Blur/RadialBlur15.frag

@@ -1,50 +0,0 @@
-#import "Common/ShaderLib/MultiSample.glsllib"
-
-uniform COLORTEXTURE m_Texture;
-uniform float m_SampleDist;
-uniform float m_SampleStrength;
-uniform float m_Samples[10];
-
-in vec2 texCoord;
-out vec4 outFragColor;
-
-void main(void)
-{
-   // some sample positions
-   //float samples[10] =   float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);
-
-    // 0.5,0.5 is the center of the screen
-    // so substracting texCoord from it will result in
-    // a vector pointing to the middle of the screen
-    vec2 dir = 0.5 - texCoord;
-
-    // calculate the distance to the center of the screen
-    float dist = sqrt(dir.x*dir.x + dir.y*dir.y);
-
-    // normalize the direction (reuse the distance)
-    dir = dir/dist;
-
-    // this is the original colour of this fragment
-    // using only this would result in a nonblurred version
-    vec4 colorRes = getColor(m_Texture,texCoord);
-
-    vec4 sum = colorRes;
-
-    // take 10 additional blur samples in the direction towards
-    // the center of the screen
-    for (int i = 0; i < 10; i++){
-      sum += getColor( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
-    }
-
-    // we have taken eleven samples
-    sum *= 1.0/11.0;
-
-    // weighten the blur effect with the distance to the
-    // center of the screen ( further out is blurred more)
-    float t = dist * m_SampleStrength;
-    t = clamp( t ,0.0,1.0); //0 &lt;= t &lt;= 1
-
-    //Blend the original color with the averaged pixels
-    outFragColor =mix( colorRes, sum, t );
-     
-}

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Blur/VGaussianBlur.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
 uniform float m_Size;
 uniform float m_Scale;

+ 3 - 3
jme3-core/src/main/resources/Common/MatDefs/Blur/VGaussianBlur.j3md

@@ -1,4 +1,4 @@
-MaterialDef Bloom {
+MaterialDef VGaussianBlur {
 
     MaterialParameters {
         Int NumSamples
@@ -8,8 +8,8 @@ MaterialDef Bloom {
     }
 
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Post/Post.vert
-        FragmentShader GLSL100: Common/MatDefs/Blur/VGaussianBlur.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Post/Post.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Blur/VGaussianBlur.frag
 
         WorldParameters {
         }

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Light/Deferred.j3md

@@ -1,3 +1,4 @@
+//Don't use this
 MaterialDef Phong Lighting Deferred {
 
     MaterialParameters {

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Light/Glow.frag

@@ -1,4 +1,4 @@
-
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #if defined(NEED_TEXCOORD1) 
     varying vec2 texCoord1;
 #else 

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Parallax.glsllib"
 #import "Common/ShaderLib/Optics.glsllib"
 #ifndef VERTEX_LIGHTING

+ 12 - 90
jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.j3md

@@ -120,8 +120,8 @@ MaterialDef Phong Lighting {
     Technique {
         LightMode SinglePass
 
-        VertexShader GLSL100:   Common/MatDefs/Light/SPLighting.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/SPLighting.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Light/SPLighting.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/SPLighting.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -159,8 +159,8 @@ MaterialDef Phong Lighting {
 
         LightMode MultiPass
 
-        VertexShader GLSL100:   Common/MatDefs/Light/Lighting.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Light/Lighting.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Lighting.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -194,12 +194,10 @@ MaterialDef Phong Lighting {
         }
     }
 
-   
-
     Technique PreShadow {
 
-        VertexShader GLSL100 :   Common/MatDefs/Shadow/PreShadow.vert
-        FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/Shadow/PreShadow.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -226,8 +224,8 @@ MaterialDef Phong Lighting {
 
 
     Technique PostShadow {
-        VertexShader GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -258,43 +256,11 @@ MaterialDef Phong Lighting {
         }
     }
 
-    Technique PostShadow{
-        VertexShader GLSL100:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            WorldMatrix
-            ViewProjectionMatrix
-            ViewMatrix
-            NormalMatrix
-        }
-
-        Defines {
-            HARDWARE_SHADOWS : HardwareShadows
-            FILTER_MODE : FilterMode
-            PCFEDGE : PCFEdge
-            DISCARD_ALPHA : AlphaDiscardThreshold
-            SHADOWMAP_SIZE : ShadowMapSize
-            FADE : FadeInfo
-            PSSM : Splits
-            POINTLIGHT : LightViewProjectionMatrix5
-            NUM_BONES : NumberOfBones
-            INSTANCING : UseInstancing
-            BACKFACE_SHADOWS: BackfaceShadows
-        }
-
-        ForcedRenderState {
-            Blend Modulate
-            DepthWrite Off   
-            PolyOffset -0.1 0  
-        }
-    }
 
   Technique PreNormalPass {
 
-        VertexShader GLSL100 :   Common/MatDefs/SSAO/normal.vert
-        FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/SSAO/normal.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -312,54 +278,10 @@ MaterialDef Phong Lighting {
 
     }
 
-
-    Technique PreNormalPassDerivative {
-
-        VertexShader GLSL100 :   Common/MatDefs/MSSAO/normal.vert
-        FragmentShader GLSL100 : Common/MatDefs/MSSAO/normal.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            WorldViewMatrix
-            NormalMatrix                        
-            ViewProjectionMatrix
-            ViewMatrix
-        }
-
-        Defines {
-            DIFFUSEMAP_ALPHA : DiffuseMap
-            NUM_BONES : NumberOfBones
-            INSTANCING : UseInstancing
-        }
-
-    }
-
-    Technique GBuf {
-
-        VertexShader GLSL100:   Common/MatDefs/Light/GBuf.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            NormalMatrix
-            WorldViewMatrix
-            WorldMatrix
-        }
-
-        Defines {
-            VERTEX_COLOR : UseVertexColor
-            MATERIAL_COLORS : UseMaterialColors
-            DIFFUSEMAP : DiffuseMap
-            NORMALMAP : NormalMap
-            SPECULARMAP : SpecularMap
-            PARALLAXMAP : ParallaxMap
-        }
-    }
-
     Technique Glow {
 
-        VertexShader GLSL100:   Common/MatDefs/Misc/Unshaded.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/Unshaded.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 #import "Common/ShaderLib/Skinning.glsllib"
 #import "Common/ShaderLib/Lighting.glsllib"

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag

@@ -1,5 +1,5 @@
-#import "Common/ShaderLib/PBR.glsllib"
 #import "Common/ShaderLib/GLSLCompat.glsllib"
+#import "Common/ShaderLib/PBR.glsllib"
 #import "Common/ShaderLib/Parallax.glsllib"
 #import "Common/ShaderLib/Lighting.glsllib"
 

+ 5 - 6
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.j3md

@@ -108,11 +108,11 @@ MaterialDef PBR Lighting {
         Boolean BackfaceShadows : false
     }
 
- Technique {
+    Technique {
         LightMode SinglePassAndImageBased
         
-        VertexShader GLSL110:   Common/MatDefs/Light/PBRLighting.vert
-        FragmentShader GLSL110: Common/MatDefs/Light/PBRLighting.frag
+        VertexShader GLSL110 GLSL150:   Common/MatDefs/Light/PBRLighting.vert
+        FragmentShader GLSL110 GLSL150: Common/MatDefs/Light/PBRLighting.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -141,12 +141,11 @@ MaterialDef PBR Lighting {
         }
     }
 
-   
 
     Technique PreShadow {
 
-        VertexShader GLSL100 :   Common/MatDefs/Shadow/PreShadow.vert
-        FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/Shadow/PreShadow.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Parallax.glsllib"
 #import "Common/ShaderLib/Optics.glsllib"
 #ifndef VERTEX_LIGHTING

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 #import "Common/ShaderLib/Skinning.glsllib"
 #import "Common/ShaderLib/Lighting.glsllib"

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #ifdef POINT_SPRITE
 #  if !defined(GL_ES) && __VERSION__ < 120
 #    error Point sprite is not supported by the video hardware!

+ 18 - 36
jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md

@@ -18,38 +18,14 @@ MaterialDef Point Sprite {
 
     Technique {
 
-        VertexShader   GLSL100 : Common/MatDefs/Misc/Particle.vert
-        FragmentShader GLSL120 : Common/MatDefs/Misc/Particle.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            WorldViewMatrix
-            WorldMatrix
-            CameraPosition
-        }
-
-        RenderState {
-            Blend AlphaAdditive
-            DepthWrite Off
-            PointSprite On
-        }
-
-        Defines {
-            USE_TEXTURE : Texture
-            POINT_SPRITE : PointSprite
-        }
-    }
-
-    Technique {
-
-        // This technique is used in two cases:
+        // The GLSL100 technique is used in two cases:
         // - When the driver doesn't support GLSL 1.2
         // - When running on OpenGL ES 2.0
         // Point sprite should be used if running on ES2, but crash
         // if on desktop (because its not supported by HW)
 
-        VertexShader   GLSL100 : Common/MatDefs/Misc/Particle.vert
-        FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
+        VertexShader   GLSL100 GLSL100 GLSL150 : Common/MatDefs/Misc/Particle.vert
+        FragmentShader GLSL100 GLSL120 GLSL150 : Common/MatDefs/Misc/Particle.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -72,25 +48,31 @@ MaterialDef Point Sprite {
 
     Technique PreShadow {
 
-        VertexShader   GLSL100 : Common/MatDefs/Misc/Particle.vert
-        FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/Shadow/PreShadow.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
             WorldViewMatrix
-            WorldMatrix
-            CameraPosition
+            ViewProjectionMatrix
+            ViewMatrix
         }
 
         Defines {
-            USE_TEXTURE : Texture
-            PRE_SHADOW
+            COLOR_MAP : ColorMap
+            DISCARD_ALPHA : AlphaDiscardThreshold
+            NUM_BONES : NumberOfBones
+            INSTANCING : UseInstancing
         }
 
         ForcedRenderState {
+            FaceCull Off
+            DepthTest On
             DepthWrite On
+            PolyOffset 5 3
             ColorWrite Off
         }
+
     }
 
     Technique SoftParticles{
@@ -117,7 +99,7 @@ MaterialDef Point Sprite {
 
     Technique SoftParticles15{
 
-        VertexShader   GLSL100 : Common/MatDefs/Misc/SoftParticle.vert
+        VertexShader   GLSL150 : Common/MatDefs/Misc/SoftParticle.vert
         FragmentShader GLSL150 : Common/MatDefs/Misc/SoftParticle15.frag
 
         WorldParameters {
@@ -150,8 +132,8 @@ MaterialDef Point Sprite {
 
    Technique Glow {
 
-        VertexShader GLSL100:   Common/MatDefs/Misc/Unshaded.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/Unshaded.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform mat4 g_WorldViewProjectionMatrix;
 
 attribute vec3 inPosition;

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 varying vec3 normal;
 
 void main(){

+ 2 - 2
jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.j3md

@@ -5,8 +5,8 @@ MaterialDef Debug Normals {
     }
 
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Misc/ShowNormals.vert
-        FragmentShader GLSL100: Common/MatDefs/Misc/ShowNormals.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/ShowNormals.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/ShowNormals.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/ShowNormals.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 
 attribute vec3 inPosition;

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Optics.glsllib"
 
 uniform ENVMAP m_Texture;

+ 3 - 3
jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.j3md

@@ -6,8 +6,8 @@ MaterialDef Sky Plane {
         Vector3 NormalScale
     }
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Misc/Sky.vert
-        FragmentShader GLSL100: Common/MatDefs/Misc/Sky.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/Sky.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/Sky.frag
 
         WorldParameters {
             ViewMatrix
@@ -17,7 +17,7 @@ MaterialDef Sky Plane {
 
         Defines {
             SPHERE_MAP : SphereMap
-	    EQUIRECT_MAP : EquirectMap
+	        EQUIRECT_MAP : EquirectMap
         }
 
         RenderState {

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/Sky.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform mat4 g_ViewMatrix;
 uniform mat4 g_ProjectionMatrix;
 uniform mat4 g_WorldMatrix;

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Misc/SoftParticle.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform mat4 g_WorldViewProjectionMatrix;
 
 attribute vec3 inPosition;

+ 10 - 65
jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.j3md

@@ -56,30 +56,8 @@ MaterialDef Unshaded {
     }
 
     Technique {
-        VertexShader GLSL150:   Common/MatDefs/Misc/Unshaded.vert
-        FragmentShader GLSL150: Common/MatDefs/Misc/Unshaded.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            ViewProjectionMatrix
-            ViewMatrix
-        }
-
-        Defines {
-            INSTANCING : UseInstancing
-            SEPARATE_TEXCOORD : SeparateTexCoord
-            HAS_COLORMAP : ColorMap
-            HAS_LIGHTMAP : LightMap
-            HAS_VERTEXCOLOR : VertexColor
-            HAS_COLOR : Color
-            NUM_BONES : NumberOfBones
-            DISCARD_ALPHA : AlphaDiscardThreshold
-        }
-    }
-
-    Technique {
-        VertexShader GLSL100:   Common/MatDefs/Misc/Unshaded.vert
-        FragmentShader GLSL100: Common/MatDefs/Misc/Unshaded.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/Unshaded.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Misc/Unshaded.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -101,8 +79,8 @@ MaterialDef Unshaded {
 
     Technique PreNormalPass {
 
-          VertexShader GLSL100 :   Common/MatDefs/SSAO/normal.vert
-          FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
+          VertexShader GLSL100 GLSL150 :   Common/MatDefs/SSAO/normal.vert
+          FragmentShader GLSL100 GLSL150 : Common/MatDefs/SSAO/normal.frag
 
           WorldParameters {
               WorldViewProjectionMatrix
@@ -120,8 +98,8 @@ MaterialDef Unshaded {
 
     Technique PreShadow {
 
-        VertexShader GLSL100 :   Common/MatDefs/Shadow/PreShadow.vert
-        FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/Shadow/PreShadow.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -149,8 +127,8 @@ MaterialDef Unshaded {
 
 
     Technique PostShadow {
-        VertexShader GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -181,43 +159,10 @@ MaterialDef Unshaded {
         }
     }
 
-    Technique PostShadow {
-        VertexShader GLSL100:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            WorldMatrix
-            ViewProjectionMatrix
-            ViewMatrix
-        }
-
-        Defines {
-            HARDWARE_SHADOWS : HardwareShadows
-            FILTER_MODE : FilterMode
-            PCFEDGE : PCFEdge
-            DISCARD_ALPHA : AlphaDiscardThreshold           
-            COLOR_MAP : ColorMap
-            SHADOWMAP_SIZE : ShadowMapSize
-            FADE : FadeInfo
-            PSSM : Splits
-            POINTLIGHT : LightViewProjectionMatrix5
-            NUM_BONES : NumberOfBones
-            INSTANCING : UseInstancing
-            BACKFACE_SHADOWS: BackfaceShadows
-        }
-
-        ForcedRenderState {
-            Blend Modulate
-            DepthWrite Off   
-            PolyOffset -0.1 0  
-        }
-    }
-
     Technique Glow {
 
-        VertexShader GLSL100:   Common/MatDefs/Misc/Unshaded.vert
-        FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Misc/Unshaded.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Light/Glow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/BasicShadow.glsllib"
 
 uniform SHADOWMAP m_ShadowMap;

+ 2 - 2
jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.j3md

@@ -6,8 +6,8 @@ MaterialDef Basic Post Shadow {
     }
 
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Shadow/BasicPostShadow.vert
-        FragmentShader GLSL100: Common/MatDefs/Shadow/BasicPostShadow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Shadow/BasicPostShadow.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/BasicPostShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Shadow/BasicPostShadow.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform mat4 m_LightViewProjectionMatrix;
 uniform mat4 g_WorldViewProjectionMatrix;
 uniform mat4 g_WorldMatrix;

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.frag

@@ -1,5 +1,5 @@
-#import "Common/ShaderLib/Shadows.glsllib"
 #import "Common/ShaderLib/GLSLCompat.glsllib"
+#import "Common/ShaderLib/Shadows.glsllib"
 
 #if defined(PSSM) || defined(FADE)
 varying float shadowPosition;

+ 2 - 29
jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.j3md

@@ -35,8 +35,8 @@ MaterialDef Post Shadow {
     }
 
     Technique {
-        VertexShader GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Shadow/PostShadow.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Shadow/PostShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix
@@ -61,31 +61,4 @@ MaterialDef Post Shadow {
         }
     }
 
-    Technique {
-        VertexShader GLSL100:   Common/MatDefs/Shadow/PostShadow.vert
-        FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
-
-        WorldParameters {
-            WorldViewProjectionMatrix
-            WorldMatrix
-        }
-
-        Defines {
-            HARDWARE_SHADOWS : HardwareShadows
-            FILTER_MODE : FilterMode
-            PCFEDGE : PCFEdge
-            SHADOWMAP_SIZE : ShadowMapSize
-            FADE : FadeInfo
-            PSSM : Splits
-            POINTLIGHT : LightViewProjectionMatrix5
-            BACKFACE_SHADOWS: BackfaceShadows
-        }
-
-        RenderState {
-            Blend Modulate
-            DepthWrite Off    
-            PolyOffset -0.1 0
-        }
-    }
-
 }

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.vert

@@ -1,6 +1,6 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 #import "Common/ShaderLib/Skinning.glsllib"
-#import "Common/ShaderLib/GLSLCompat.glsllib"
 
 uniform mat4 m_LightViewProjectionMatrix0;
 uniform mat4 m_LightViewProjectionMatrix1;

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 varying vec2 texCoord;
 
 #ifdef DISCARD_ALPHA

+ 2 - 2
jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.j3md

@@ -1,7 +1,7 @@
 MaterialDef Pre Shadow {
     Technique {
-        VertexShader GLSL100 :   Common/MatDefs/Shadow/PreShadow.vert
-        FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
+        VertexShader GLSL100 GLSL150 :   Common/MatDefs/Shadow/PreShadow.vert
+        FragmentShader GLSL100 GLSL150 : Common/MatDefs/Shadow/PreShadow.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-core/src/main/resources/Common/MatDefs/Shadow/PreShadow.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 #import "Common/ShaderLib/Skinning.glsllib"
 attribute vec3 inPosition;

+ 1 - 0
jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib

@@ -23,6 +23,7 @@ out vec4 outFragColor;
 #  define texture1D texture
 #  define texture2D texture
 #  define texture3D texture
+#  define textureCube texture
 #  define texture2DLod textureLod
 #  define textureCubeLod textureLod
 #  if defined VERTEX_SHADER

+ 7 - 13
jme3-core/src/main/resources/Common/ShaderLib/MultiSample.glsllib

@@ -15,12 +15,6 @@ uniform int m_NumSamplesDepth;
     #define DEPTHTEXTURE sampler2D
 #endif
 
-#if __VERSION__ >= 150
-    #define TEXTURE texture
-#else
-    #define TEXTURE texture2D
-#endif
-
 // NOTE: Only define multisample functions if multisample is available
 #if defined(GL_ARB_texture_multisample)
 vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
@@ -32,9 +26,9 @@ vec4 textureFetch(in sampler2DMS tex,in vec2 texC, in int numSamples){
       return color / float(numSamples);
 }
 
-vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sample){
+vec4 fetchTextureSample(in sampler2DMS tex,in vec2 texC,in int sampleId){
     ivec2 iTexC = ivec2(texC * vec2(textureSize(tex)));
-    return texelFetch(tex, iTexC, sample);
+    return texelFetch(tex, iTexC, sampleId);
 }
 
 vec4 getColor(in sampler2DMS tex, in vec2 texC){
@@ -52,19 +46,19 @@ vec4 getDepth(in sampler2DMS tex,in vec2 texC){
 
 #endif
 
-vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sample){
-    return TEXTURE(tex,texC);
+vec4 fetchTextureSample(in sampler2D tex,in vec2 texC,in int sampleId){
+    return texture2D(tex,texC);
 }
 
 vec4 getColor(in sampler2D tex, in vec2 texC){
-    return TEXTURE(tex,texC);
+    return texture2D(tex,texC);
 }
 
 vec4 getColorSingle(in sampler2D tex, in vec2 texC){
-    return TEXTURE(tex, texC);
+    return texture2D(tex, texC);
 }
 
 vec4 getDepth(in sampler2D tex,in vec2 texC){
-    return TEXTURE(tex,texC);
+    return texture2D(tex,texC);
 }
 

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #extension GL_EXT_gpu_shader4 : enable
 
 uniform sampler2D m_Texture;

+ 2 - 2
jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.j3md

@@ -8,8 +8,8 @@ MaterialDef FXAA {
         Float ReduceMul
     }
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Post/FXAA.vert
-        FragmentShader GLSL100: Common/MatDefs/Post/FXAA.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Post/FXAA.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Post/FXAA.frag
         WorldParameters {
             ResolutionInverse
         }

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/Post/FXAA.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 uniform mat4 g_WorldViewProjectionMatrix;
 uniform vec2 g_ResolutionInverse;
 

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/Post/Post.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 attribute vec4 inPosition;
 attribute vec2 inTexCoord;
 

+ 18 - 17
jme3-effects/src/main/resources/Common/MatDefs/Post/ToneMap.frag

@@ -1,17 +1,12 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/MultiSample.glsllib"
 
 uniform COLORTEXTURE m_Texture;
 uniform vec3 m_WhitePoint;
 
-#if __VERSION__ >= 150
-in vec2 texCoord;
-out vec4 outFragColor;
-#else
 varying vec2 texCoord;
-#endif
 
-vec3 FilmicCurve(in vec3 x)
-{
+vec3 FilmicCurve(in vec3 x){
     const float A = 0.22;
     const float B = 0.30;
     const float C = 0.10;
@@ -24,21 +19,27 @@ vec3 FilmicCurve(in vec3 x)
 
 // whitePoint should be 11.2
 
-vec3 ToneMap_Filmic(vec3 color, vec3 whitePoint)
-{
+vec3 ToneMap_Filmic(vec3 color, vec3 whitePoint){
     return FilmicCurve(color) / FilmicCurve(whitePoint);
 }
 
-void main() {
-    // TODO: This is incorrect if multi-sampling is used.
-    // The tone-mapping should be performed for each sample independently.
+vec4 tonemap(int i) {
 
-    vec4 texVal = getColor(m_Texture, texCoord);
+    vec4 texVal = fetchTextureSample(m_Texture, texCoord, i);
     vec3 toneMapped = ToneMap_Filmic(texVal.rgb, m_WhitePoint);
 
-    #if __VERSION__ >= 150
-        outFragColor = vec4(toneMapped, texVal.a);
+    return vec4(toneMapped, texVal.a);
+}
+
+
+void main() {
+    #ifdef RESOLVE_MS
+        vec4 color = vec4(0.0);
+        for (int i = 0; i < m_NumSamples; i++){
+            color += tonemap(i);
+        }
+        gl_FragColor = color / m_NumSamples;
     #else
-        gl_FragColor = vec4(toneMapped, texVal.a);
+        gl_FragColor = tonemap(0);
     #endif
-}
+}

+ 2 - 10
jme3-effects/src/main/resources/Common/MatDefs/Post/ToneMap.j3md

@@ -8,8 +8,8 @@ MaterialDef Default GUI {
     }
 
     Technique {
-        VertexShader GLSL150:   Common/MatDefs/Post/Post15.vert
-        FragmentShader GLSL150: Common/MatDefs/Post/ToneMap.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Post/Post.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Post/ToneMap.frag
 
         WorldParameters {
         }
@@ -20,12 +20,4 @@ MaterialDef Default GUI {
 
     }
 
-    Technique {
-        VertexShader GLSL100:   Common/MatDefs/Post/Post.vert
-        FragmentShader GLSL100: Common/MatDefs/Post/ToneMap.frag
-
-        WorldParameters {  
-        }
-
-    }
 }

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 varying vec3 normal;
 varying vec2 texCoord;
 

+ 1 - 3
jme3-effects/src/main/resources/Common/MatDefs/SSAO/normal.vert

@@ -1,8 +1,6 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Instancing.glsllib"
 #import "Common/ShaderLib/Skinning.glsllib"
-// These are included in the above now
-//uniform mat4 g_WorldViewProjectionMatrix;
-//uniform mat3 g_NormalMatrix;
 
 attribute vec3 inPosition;
 attribute vec3 inNormal;

+ 2 - 2
jme3-effects/src/main/resources/Common/MatDefs/Water/SimpleWater.j3md

@@ -18,8 +18,8 @@ MaterialDef Simple Water {
     }
 
     Technique {
-        VertexShader GLSL100:   Common/MatDefs/Water/simple_water.vert
-        FragmentShader GLSL100: Common/MatDefs/Water/simple_water.frag
+        VertexShader GLSL100 GLSL150:   Common/MatDefs/Water/simple_water.vert
+        FragmentShader GLSL100 GLSL150: Common/MatDefs/Water/simple_water.frag
 
         WorldParameters {
             WorldViewProjectionMatrix

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/Water/simple_water.frag

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 /*
 GLSL conversion of Michael Horsch water demo
 http://www.bonzaisoftware.com/wfs.html

+ 1 - 0
jme3-effects/src/main/resources/Common/MatDefs/Water/simple_water.vert

@@ -1,3 +1,4 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
 /*
 GLSL conversion of Michael Horsch water demo
 http://www.bonzaisoftware.com/wfs.html

+ 11 - 14
jme3-examples/src/main/java/jme3test/post/TestPostFilters.java

@@ -39,15 +39,14 @@ import com.jme3.light.DirectionalLight;
 import com.jme3.material.Material;
 import com.jme3.math.*;
 import com.jme3.post.FilterPostProcessor;
-import com.jme3.post.filters.ColorOverlayFilter;
-import com.jme3.post.filters.FadeFilter;
-import com.jme3.post.filters.RadialBlurFilter;
+import com.jme3.post.filters.*;
 import com.jme3.renderer.Caps;
 import com.jme3.renderer.queue.RenderQueue.ShadowMode;
 import com.jme3.scene.Geometry;
 import com.jme3.scene.Spatial;
 import com.jme3.scene.Spatial.CullHint;
 import com.jme3.scene.shape.Box;
+import com.jme3.system.AppSettings;
 import com.jme3.texture.Texture;
 import com.jme3.texture.Texture.WrapMode;
 import com.jme3.util.SkyFactory;
@@ -61,17 +60,21 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
 
     public static void main(String[] args) {
         TestPostFilters app = new TestPostFilters();
+        AppSettings settings = new AppSettings(true);
+        settings.setRenderer(AppSettings.LWJGL_OPENGL2);
+        app.setSettings(settings);
         app.start();
     }
 
     public void setupFilters() {
         if (renderer.getCaps().contains(Caps.GLSL100)) {
             fpp = new FilterPostProcessor(assetManager);
+            //     fpp.setNumSamples(4);
             // fpp.setNumSamples(4);
-            fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
+            //fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
             fpp.addFilter(new RadialBlurFilter());
-            //fade=new FadeFilter(1.0f);
-            //fpp.addFilter(fade);
+            fade = new FadeFilter(1.0f);
+            fpp.addFilter(fade);
 
 
             viewPort.addProcessor(fpp);
@@ -102,7 +105,7 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
 
         dl.setColor(new ColorRGBA(.4f, .4f, .4f, 1));
 
-        rootNode.addLight(dl);
+        //   rootNode.addLight(dl);
     }
 
     public void setupFloor() {
@@ -131,12 +134,6 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
     public void simpleInitApp() {
         cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
         cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
-        cam.update();
-
-        cam.setFrustumFar(300);
-        flyCam.setMoveSpeed(30);
-
-        rootNode.setCullHint(CullHint.Never);
 
         setupLighting();
         setupSkyBox();
@@ -153,7 +150,7 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
     }
 
     protected void initInput() {
-        flyCam.setMoveSpeed(3);
+        flyCam.setMoveSpeed(50);
         //init input
         inputManager.addMapping("fadein", new KeyTrigger(KeyInput.KEY_I));
         inputManager.addListener(this, "fadein");