Garrett Johnson 5 سال پیش
والد
کامیت
402804ac7e

+ 1 - 1
examples/jsm/shaders/CopyShader.js

@@ -11,7 +11,7 @@ var CopyShader = {
 	uniforms: {
 
 		"tDiffuse": { value: null },
-		"opacity":  { value: 1.0 }
+		"opacity": { value: 1.0 }
 
 	},
 

+ 14 - 14
examples/jsm/shaders/DepthLimitedBlurShader.js

@@ -8,19 +8,19 @@ import {
 
 var DepthLimitedBlurShader = {
 	defines: {
-		'KERNEL_RADIUS': 4,
-		'DEPTH_PACKING': 1,
-		'PERSPECTIVE_CAMERA': 1
+		"KERNEL_RADIUS": 4,
+		"DEPTH_PACKING": 1,
+		"PERSPECTIVE_CAMERA": 1
 	},
 	uniforms: {
-		'tDiffuse': { value: null },
-		'size': { value: new Vector2( 512, 512 ) },
-		'sampleUvOffsets': { value: [ new Vector2( 0, 0 ) ] },
-		'sampleWeights': { value: [ 1.0 ] },
-		'tDepth': { value: null },
-		'cameraNear': { value: 10 },
-		'cameraFar': { value: 1000 },
-		'depthCutoff': { value: 10 },
+		"tDiffuse": { value: null },
+		"size": { value: new Vector2( 512, 512 ) },
+		"sampleUvOffsets": { value: [ new Vector2( 0, 0 ) ] },
+		"sampleWeights": { value: [ 1.0 ] },
+		"tDepth": { value: null },
+		"cameraNear": { value: 10 },
+		"cameraFar": { value: 1000 },
+		"depthCutoff": { value: 10 },
 	},
 	vertexShader: [
 		"#include <common>",
@@ -153,9 +153,9 @@ var BlurShaderUtils = {
 
 	configure: function ( material, kernelRadius, stdDev, uvIncrement ) {
 
-		material.defines[ 'KERNEL_RADIUS' ] = kernelRadius;
-		material.uniforms[ 'sampleUvOffsets' ].value = BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement );
-		material.uniforms[ 'sampleWeights' ].value = BlurShaderUtils.createSampleWeights( kernelRadius, stdDev );
+		material.defines[ "KERNEL_RADIUS" ] = kernelRadius;
+		material.uniforms[ "sampleUvOffsets" ].value = BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement );
+		material.uniforms[ "sampleWeights" ].value = BlurShaderUtils.createSampleWeights( kernelRadius, stdDev );
 		material.needsUpdate = true;
 
 	}

+ 1 - 1
examples/jsm/shaders/DigitalGlitch.js

@@ -39,7 +39,7 @@ var DigitalGlitch = {
 	].join( "\n" ),
 
 	fragmentShader: [
-		"uniform int byp;",//should we apply the glitch ?
+		"uniform int byp;", //should we apply the glitch ?
 
 		"uniform sampler2D tDiffuse;",
 		"uniform sampler2D tDisp;",

+ 4 - 4
examples/jsm/shaders/DotScreenShader.js

@@ -15,10 +15,10 @@ var DotScreenShader = {
 	uniforms: {
 
 		"tDiffuse": { value: null },
-		"tSize":    { value: new Vector2( 256, 256 ) },
-		"center":   { value: new Vector2( 0.5, 0.5 ) },
-		"angle":    { value: 1.57 },
-		"scale":    { value: 1.0 }
+		"tSize": { value: new Vector2( 256, 256 ) },
+		"center": { value: new Vector2( 0.5, 0.5 ) },
+		"angle": { value: 1.57 },
+		"scale": { value: 1.0 }
 
 	},
 

+ 1080 - 1080
examples/jsm/shaders/FXAAShader.js

@@ -35,1086 +35,1086 @@ var FXAAShader = {
 	].join( "\n" ),
 
 	fragmentShader: [
-        "precision highp float;",
-        "",
-        "uniform sampler2D tDiffuse;",
-        "",
-        "uniform vec2 resolution;",
-        "",
-        "varying vec2 vUv;",
-        "",
-        "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro ([email protected])",
-        "",
-        "//----------------------------------------------------------------------------------",
-        "// File:        es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag",
-        "// SDK Version: v3.00",
-        "// Email:       [email protected]",
-        "// Site:        http://developer.nvidia.com/",
-        "//",
-        "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.",
-        "//",
-        "// Redistribution and use in source and binary forms, with or without",
-        "// modification, are permitted provided that the following conditions",
-        "// are met:",
-        "//  * Redistributions of source code must retain the above copyright",
-        "//    notice, this list of conditions and the following disclaimer.",
-        "//  * Redistributions in binary form must reproduce the above copyright",
-        "//    notice, this list of conditions and the following disclaimer in the",
-        "//    documentation and/or other materials provided with the distribution.",
-        "//  * Neither the name of NVIDIA CORPORATION nor the names of its",
-        "//    contributors may be used to endorse or promote products derived",
-        "//    from this software without specific prior written permission.",
-        "//",
-        "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY",
-        "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
-        "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
-        "// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR",
-        "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,",
-        "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,",
-        "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR",
-        "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY",
-        "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
-        "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
-        "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
-        "//",
-        "//----------------------------------------------------------------------------------",
-        "",
-        "#define FXAA_PC 1",
-        "#define FXAA_GLSL_100 1",
-        "#define FXAA_QUALITY_PRESET 12",
-        "",
-        "#define FXAA_GREEN_AS_LUMA 1",
-        "",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_PC_CONSOLE",
-        "    //",
-        "    // The console algorithm for PC is included",
-        "    // for developers targeting really low spec machines.",
-        "    // Likely better to just run FXAA_PC, and use a really low preset.",
-        "    //",
-        "    #define FXAA_PC_CONSOLE 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_GLSL_120",
-        "    #define FXAA_GLSL_120 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_GLSL_130",
-        "    #define FXAA_GLSL_130 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_HLSL_3",
-        "    #define FXAA_HLSL_3 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_HLSL_4",
-        "    #define FXAA_HLSL_4 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_HLSL_5",
-        "    #define FXAA_HLSL_5 0",
-        "#endif",
-        "/*==========================================================================*/",
-        "#ifndef FXAA_GREEN_AS_LUMA",
-        "    //",
-        "    // For those using non-linear color,",
-        "    // and either not able to get luma in alpha, or not wanting to,",
-        "    // this enables FXAA to run using green as a proxy for luma.",
-        "    // So with this enabled, no need to pack luma in alpha.",
-        "    //",
-        "    // This will turn off AA on anything which lacks some amount of green.",
-        "    // Pure red and blue or combination of only R and B, will get no AA.",
-        "    //",
-        "    // Might want to lower the settings for both,",
-        "    //    fxaaConsoleEdgeThresholdMin",
-        "    //    fxaaQualityEdgeThresholdMin",
-        "    // In order to insure AA does not get turned off on colors",
-        "    // which contain a minor amount of green.",
-        "    //",
-        "    // 1 = On.",
-        "    // 0 = Off.",
-        "    //",
-        "    #define FXAA_GREEN_AS_LUMA 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_EARLY_EXIT",
-        "    //",
-        "    // Controls algorithm's early exit path.",
-        "    // On PS3 turning this ON adds 2 cycles to the shader.",
-        "    // On 360 turning this OFF adds 10ths of a millisecond to the shader.",
-        "    // Turning this off on console will result in a more blurry image.",
-        "    // So this defaults to on.",
-        "    //",
-        "    // 1 = On.",
-        "    // 0 = Off.",
-        "    //",
-        "    #define FXAA_EARLY_EXIT 1",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_DISCARD",
-        "    //",
-        "    // Only valid for PC OpenGL currently.",
-        "    // Probably will not work when FXAA_GREEN_AS_LUMA = 1.",
-        "    //",
-        "    // 1 = Use discard on pixels which don't need AA.",
-        "    //     For APIs which enable concurrent TEX+ROP from same surface.",
-        "    // 0 = Return unchanged color on pixels which don't need AA.",
-        "    //",
-        "    #define FXAA_DISCARD 0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_FAST_PIXEL_OFFSET",
-        "    //",
-        "    // Used for GLSL 120 only.",
-        "    //",
-        "    // 1 = GL API supports fast pixel offsets",
-        "    // 0 = do not use fast pixel offsets",
-        "    //",
-        "    #ifdef GL_EXT_gpu_shader4",
-        "        #define FXAA_FAST_PIXEL_OFFSET 1",
-        "    #endif",
-        "    #ifdef GL_NV_gpu_shader5",
-        "        #define FXAA_FAST_PIXEL_OFFSET 1",
-        "    #endif",
-        "    #ifdef GL_ARB_gpu_shader5",
-        "        #define FXAA_FAST_PIXEL_OFFSET 1",
-        "    #endif",
-        "    #ifndef FXAA_FAST_PIXEL_OFFSET",
-        "        #define FXAA_FAST_PIXEL_OFFSET 0",
-        "    #endif",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#ifndef FXAA_GATHER4_ALPHA",
-        "    //",
-        "    // 1 = API supports gather4 on alpha channel.",
-        "    // 0 = API does not support gather4 on alpha channel.",
-        "    //",
-        "    #if (FXAA_HLSL_5 == 1)",
-        "        #define FXAA_GATHER4_ALPHA 1",
-        "    #endif",
-        "    #ifdef GL_ARB_gpu_shader5",
-        "        #define FXAA_GATHER4_ALPHA 1",
-        "    #endif",
-        "    #ifdef GL_NV_gpu_shader5",
-        "        #define FXAA_GATHER4_ALPHA 1",
-        "    #endif",
-        "    #ifndef FXAA_GATHER4_ALPHA",
-        "        #define FXAA_GATHER4_ALPHA 0",
-        "    #endif",
-        "#endif",
-        "",
-        "",
-        "/*============================================================================",
-        "                        FXAA QUALITY - TUNING KNOBS",
-        "------------------------------------------------------------------------------",
-        "NOTE the other tuning knobs are now in the shader function inputs!",
-        "============================================================================*/",
-        "#ifndef FXAA_QUALITY_PRESET",
-        "    //",
-        "    // Choose the quality preset.",
-        "    // This needs to be compiled into the shader as it effects code.",
-        "    // Best option to include multiple presets is to",
-        "    // in each shader define the preset, then include this file.",
-        "    //",
-        "    // OPTIONS",
-        "    // -----------------------------------------------------------------------",
-        "    // 10 to 15 - default medium dither (10=fastest, 15=highest quality)",
-        "    // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)",
-        "    // 39       - no dither, very expensive",
-        "    //",
-        "    // NOTES",
-        "    // -----------------------------------------------------------------------",
-        "    // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)",
-        "    // 13 = about same speed as FXAA 3.9 and better than 12",
-        "    // 23 = closest to FXAA 3.9 visually and performance wise",
-        "    //  _ = the lowest digit is directly related to performance",
-        "    // _  = the highest digit is directly related to style",
-        "    //",
-        "    #define FXAA_QUALITY_PRESET 12",
-        "#endif",
-        "",
-        "",
-        "/*============================================================================",
-        "",
-        "                           FXAA QUALITY - PRESETS",
-        "",
-        "============================================================================*/",
-        "",
-        "/*============================================================================",
-        "                     FXAA QUALITY - MEDIUM DITHER PRESETS",
-        "============================================================================*/",
-        "#if (FXAA_QUALITY_PRESET == 10)",
-        "    #define FXAA_QUALITY_PS 3",
-        "    #define FXAA_QUALITY_P0 1.5",
-        "    #define FXAA_QUALITY_P1 3.0",
-        "    #define FXAA_QUALITY_P2 12.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 11)",
-        "    #define FXAA_QUALITY_PS 4",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 3.0",
-        "    #define FXAA_QUALITY_P3 12.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 12)",
-        "    #define FXAA_QUALITY_PS 5",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 4.0",
-        "    #define FXAA_QUALITY_P4 12.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 13)",
-        "    #define FXAA_QUALITY_PS 6",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 4.0",
-        "    #define FXAA_QUALITY_P5 12.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 14)",
-        "    #define FXAA_QUALITY_PS 7",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 4.0",
-        "    #define FXAA_QUALITY_P6 12.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 15)",
-        "    #define FXAA_QUALITY_PS 8",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 4.0",
-        "    #define FXAA_QUALITY_P7 12.0",
-        "#endif",
-        "",
-        "/*============================================================================",
-        "                     FXAA QUALITY - LOW DITHER PRESETS",
-        "============================================================================*/",
-        "#if (FXAA_QUALITY_PRESET == 20)",
-        "    #define FXAA_QUALITY_PS 3",
-        "    #define FXAA_QUALITY_P0 1.5",
-        "    #define FXAA_QUALITY_P1 2.0",
-        "    #define FXAA_QUALITY_P2 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 21)",
-        "    #define FXAA_QUALITY_PS 4",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 22)",
-        "    #define FXAA_QUALITY_PS 5",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 23)",
-        "    #define FXAA_QUALITY_PS 6",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 24)",
-        "    #define FXAA_QUALITY_PS 7",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 3.0",
-        "    #define FXAA_QUALITY_P6 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 25)",
-        "    #define FXAA_QUALITY_PS 8",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 4.0",
-        "    #define FXAA_QUALITY_P7 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 26)",
-        "    #define FXAA_QUALITY_PS 9",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 2.0",
-        "    #define FXAA_QUALITY_P7 4.0",
-        "    #define FXAA_QUALITY_P8 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 27)",
-        "    #define FXAA_QUALITY_PS 10",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 2.0",
-        "    #define FXAA_QUALITY_P7 2.0",
-        "    #define FXAA_QUALITY_P8 4.0",
-        "    #define FXAA_QUALITY_P9 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 28)",
-        "    #define FXAA_QUALITY_PS 11",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 2.0",
-        "    #define FXAA_QUALITY_P7 2.0",
-        "    #define FXAA_QUALITY_P8 2.0",
-        "    #define FXAA_QUALITY_P9 4.0",
-        "    #define FXAA_QUALITY_P10 8.0",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_QUALITY_PRESET == 29)",
-        "    #define FXAA_QUALITY_PS 12",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.5",
-        "    #define FXAA_QUALITY_P2 2.0",
-        "    #define FXAA_QUALITY_P3 2.0",
-        "    #define FXAA_QUALITY_P4 2.0",
-        "    #define FXAA_QUALITY_P5 2.0",
-        "    #define FXAA_QUALITY_P6 2.0",
-        "    #define FXAA_QUALITY_P7 2.0",
-        "    #define FXAA_QUALITY_P8 2.0",
-        "    #define FXAA_QUALITY_P9 2.0",
-        "    #define FXAA_QUALITY_P10 4.0",
-        "    #define FXAA_QUALITY_P11 8.0",
-        "#endif",
-        "",
-        "/*============================================================================",
-        "                     FXAA QUALITY - EXTREME QUALITY",
-        "============================================================================*/",
-        "#if (FXAA_QUALITY_PRESET == 39)",
-        "    #define FXAA_QUALITY_PS 12",
-        "    #define FXAA_QUALITY_P0 1.0",
-        "    #define FXAA_QUALITY_P1 1.0",
-        "    #define FXAA_QUALITY_P2 1.0",
-        "    #define FXAA_QUALITY_P3 1.0",
-        "    #define FXAA_QUALITY_P4 1.0",
-        "    #define FXAA_QUALITY_P5 1.5",
-        "    #define FXAA_QUALITY_P6 2.0",
-        "    #define FXAA_QUALITY_P7 2.0",
-        "    #define FXAA_QUALITY_P8 2.0",
-        "    #define FXAA_QUALITY_P9 2.0",
-        "    #define FXAA_QUALITY_P10 4.0",
-        "    #define FXAA_QUALITY_P11 8.0",
-        "#endif",
-        "",
-        "",
-        "",
-        "/*============================================================================",
-        "",
-        "                                API PORTING",
-        "",
-        "============================================================================*/",
-        "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)",
-        "    #define FxaaBool bool",
-        "    #define FxaaDiscard discard",
-        "    #define FxaaFloat float",
-        "    #define FxaaFloat2 vec2",
-        "    #define FxaaFloat3 vec3",
-        "    #define FxaaFloat4 vec4",
-        "    #define FxaaHalf float",
-        "    #define FxaaHalf2 vec2",
-        "    #define FxaaHalf3 vec3",
-        "    #define FxaaHalf4 vec4",
-        "    #define FxaaInt2 ivec2",
-        "    #define FxaaSat(x) clamp(x, 0.0, 1.0)",
-        "    #define FxaaTex sampler2D",
-        "#else",
-        "    #define FxaaBool bool",
-        "    #define FxaaDiscard clip(-1)",
-        "    #define FxaaFloat float",
-        "    #define FxaaFloat2 float2",
-        "    #define FxaaFloat3 float3",
-        "    #define FxaaFloat4 float4",
-        "    #define FxaaHalf half",
-        "    #define FxaaHalf2 half2",
-        "    #define FxaaHalf3 half3",
-        "    #define FxaaHalf4 half4",
-        "    #define FxaaSat(x) saturate(x)",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_GLSL_100 == 1)",
-        "  #define FxaaTexTop(t, p) texture2D(t, p, 0.0)",
-        "  #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_GLSL_120 == 1)",
-        "    // Requires,",
-        "    //  #version 120",
-        "    // And at least,",
-        "    //  #extension GL_EXT_gpu_shader4 : enable",
-        "    //  (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)",
-        "    #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)",
-        "    #if (FXAA_FAST_PIXEL_OFFSET == 1)",
-        "        #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)",
-        "    #else",
-        "        #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)",
-        "    #endif",
-        "    #if (FXAA_GATHER4_ALPHA == 1)",
-        "        // use #extension GL_ARB_gpu_shader5 : enable",
-        "        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
-        "        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
-        "        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
-        "        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
-        "    #endif",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_GLSL_130 == 1)",
-        "    // Requires \"#version 130\" or better",
-        "    #define FxaaTexTop(t, p) textureLod(t, p, 0.0)",
-        "    #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)",
-        "    #if (FXAA_GATHER4_ALPHA == 1)",
-        "        // use #extension GL_ARB_gpu_shader5 : enable",
-        "        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
-        "        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
-        "        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
-        "        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
-        "    #endif",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_HLSL_3 == 1)",
-        "    #define FxaaInt2 float2",
-        "    #define FxaaTex sampler2D",
-        "    #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))",
-        "    #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_HLSL_4 == 1)",
-        "    #define FxaaInt2 int2",
-        "    struct FxaaTex { SamplerState smpl; Texture2D tex; };",
-        "    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
-        "    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
-        "#endif",
-        "/*--------------------------------------------------------------------------*/",
-        "#if (FXAA_HLSL_5 == 1)",
-        "    #define FxaaInt2 int2",
-        "    struct FxaaTex { SamplerState smpl; Texture2D tex; };",
-        "    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
-        "    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
-        "    #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)",
-        "    #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)",
-        "    #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)",
-        "    #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)",
-        "#endif",
-        "",
-        "",
-        "/*============================================================================",
-        "                   GREEN AS LUMA OPTION SUPPORT FUNCTION",
-        "============================================================================*/",
-        "#if (FXAA_GREEN_AS_LUMA == 0)",
-        "    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }",
-        "#else",
-        "    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }",
-        "#endif",
-        "",
-        "",
-        "",
-        "",
-        "/*============================================================================",
-        "",
-        "                             FXAA3 QUALITY - PC",
-        "",
-        "============================================================================*/",
-        "#if (FXAA_PC == 1)",
-        "/*--------------------------------------------------------------------------*/",
-        "FxaaFloat4 FxaaPixelShader(",
-        "    //",
-        "    // Use noperspective interpolation here (turn off perspective interpolation).",
-        "    // {xy} = center of pixel",
-        "    FxaaFloat2 pos,",
-        "    //",
-        "    // Used only for FXAA Console, and not used on the 360 version.",
-        "    // Use noperspective interpolation here (turn off perspective interpolation).",
-        "    // {xy_} = upper left of pixel",
-        "    // {_zw} = lower right of pixel",
-        "    FxaaFloat4 fxaaConsolePosPos,",
-        "    //",
-        "    // Input color texture.",
-        "    // {rgb_} = color in linear or perceptual color space",
-        "    // if (FXAA_GREEN_AS_LUMA == 0)",
-        "    //     {__a} = luma in perceptual color space (not linear)",
-        "    FxaaTex tex,",
-        "    //",
-        "    // Only used on the optimized 360 version of FXAA Console.",
-        "    // For everything but 360, just use the same input here as for \"tex\".",
-        "    // For 360, same texture, just alias with a 2nd sampler.",
-        "    // This sampler needs to have an exponent bias of -1.",
-        "    FxaaTex fxaaConsole360TexExpBiasNegOne,",
-        "    //",
-        "    // Only used on the optimized 360 version of FXAA Console.",
-        "    // For everything but 360, just use the same input here as for \"tex\".",
-        "    // For 360, same texture, just alias with a 3nd sampler.",
-        "    // This sampler needs to have an exponent bias of -2.",
-        "    FxaaTex fxaaConsole360TexExpBiasNegTwo,",
-        "    //",
-        "    // Only used on FXAA Quality.",
-        "    // This must be from a constant/uniform.",
-        "    // {x_} = 1.0/screenWidthInPixels",
-        "    // {_y} = 1.0/screenHeightInPixels",
-        "    FxaaFloat2 fxaaQualityRcpFrame,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // This must be from a constant/uniform.",
-        "    // This effects sub-pixel AA quality and inversely sharpness.",
-        "    //   Where N ranges between,",
-        "    //     N = 0.50 (default)",
-        "    //     N = 0.33 (sharper)",
-        "    // {x__} = -N/screenWidthInPixels",
-        "    // {_y_} = -N/screenHeightInPixels",
-        "    // {_z_} =  N/screenWidthInPixels",
-        "    // {__w} =  N/screenHeightInPixels",
-        "    FxaaFloat4 fxaaConsoleRcpFrameOpt,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // Not used on 360, but used on PS3 and PC.",
-        "    // This must be from a constant/uniform.",
-        "    // {x__} = -2.0/screenWidthInPixels",
-        "    // {_y_} = -2.0/screenHeightInPixels",
-        "    // {_z_} =  2.0/screenWidthInPixels",
-        "    // {__w} =  2.0/screenHeightInPixels",
-        "    FxaaFloat4 fxaaConsoleRcpFrameOpt2,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.",
-        "    // This must be from a constant/uniform.",
-        "    // {x__} =  8.0/screenWidthInPixels",
-        "    // {_y_} =  8.0/screenHeightInPixels",
-        "    // {_z_} = -4.0/screenWidthInPixels",
-        "    // {__w} = -4.0/screenHeightInPixels",
-        "    FxaaFloat4 fxaaConsole360RcpFrameOpt2,",
-        "    //",
-        "    // Only used on FXAA Quality.",
-        "    // This used to be the FXAA_QUALITY_SUBPIX define.",
-        "    // It is here now to allow easier tuning.",
-        "    // Choose the amount of sub-pixel aliasing removal.",
-        "    // This can effect sharpness.",
-        "    //   1.00 - upper limit (softer)",
-        "    //   0.75 - default amount of filtering",
-        "    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)",
-        "    //   0.25 - almost off",
-        "    //   0.00 - completely off",
-        "    FxaaFloat fxaaQualitySubpix,",
-        "    //",
-        "    // Only used on FXAA Quality.",
-        "    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.",
-        "    // It is here now to allow easier tuning.",
-        "    // The minimum amount of local contrast required to apply algorithm.",
-        "    //   0.333 - too little (faster)",
-        "    //   0.250 - low quality",
-        "    //   0.166 - default",
-        "    //   0.125 - high quality",
-        "    //   0.063 - overkill (slower)",
-        "    FxaaFloat fxaaQualityEdgeThreshold,",
-        "    //",
-        "    // Only used on FXAA Quality.",
-        "    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.",
-        "    // It is here now to allow easier tuning.",
-        "    // Trims the algorithm from processing darks.",
-        "    //   0.0833 - upper limit (default, the start of visible unfiltered edges)",
-        "    //   0.0625 - high quality (faster)",
-        "    //   0.0312 - visible limit (slower)",
-        "    // Special notes when using FXAA_GREEN_AS_LUMA,",
-        "    //   Likely want to set this to zero.",
-        "    //   As colors that are mostly not-green",
-        "    //   will appear very dark in the green channel!",
-        "    //   Tune by looking at mostly non-green content,",
-        "    //   then start at zero and increase until aliasing is a problem.",
-        "    FxaaFloat fxaaQualityEdgeThresholdMin,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.",
-        "    // It is here now to allow easier tuning.",
-        "    // This does not effect PS3, as this needs to be compiled in.",
-        "    //   Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.",
-        "    //   Due to the PS3 being ALU bound,",
-        "    //   there are only three safe values here: 2 and 4 and 8.",
-        "    //   These options use the shaders ability to a free *|/ by 2|4|8.",
-        "    // For all other platforms can be a non-power of two.",
-        "    //   8.0 is sharper (default!!!)",
-        "    //   4.0 is softer",
-        "    //   2.0 is really soft (good only for vector graphics inputs)",
-        "    FxaaFloat fxaaConsoleEdgeSharpness,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.",
-        "    // It is here now to allow easier tuning.",
-        "    // This does not effect PS3, as this needs to be compiled in.",
-        "    //   Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.",
-        "    //   Due to the PS3 being ALU bound,",
-        "    //   there are only two safe values here: 1/4 and 1/8.",
-        "    //   These options use the shaders ability to a free *|/ by 2|4|8.",
-        "    // The console setting has a different mapping than the quality setting.",
-        "    // Other platforms can use other values.",
-        "    //   0.125 leaves less aliasing, but is softer (default!!!)",
-        "    //   0.25 leaves more aliasing, and is sharper",
-        "    FxaaFloat fxaaConsoleEdgeThreshold,",
-        "    //",
-        "    // Only used on FXAA Console.",
-        "    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.",
-        "    // It is here now to allow easier tuning.",
-        "    // Trims the algorithm from processing darks.",
-        "    // The console setting has a different mapping than the quality setting.",
-        "    // This only applies when FXAA_EARLY_EXIT is 1.",
-        "    // This does not apply to PS3,",
-        "    // PS3 was simplified to avoid more shader instructions.",
-        "    //   0.06 - faster but more aliasing in darks",
-        "    //   0.05 - default",
-        "    //   0.04 - slower and less aliasing in darks",
-        "    // Special notes when using FXAA_GREEN_AS_LUMA,",
-        "    //   Likely want to set this to zero.",
-        "    //   As colors that are mostly not-green",
-        "    //   will appear very dark in the green channel!",
-        "    //   Tune by looking at mostly non-green content,",
-        "    //   then start at zero and increase until aliasing is a problem.",
-        "    FxaaFloat fxaaConsoleEdgeThresholdMin,",
-        "    //",
-        "    // Extra constants for 360 FXAA Console only.",
-        "    // Use zeros or anything else for other platforms.",
-        "    // These must be in physical constant registers and NOT immediates.",
-        "    // Immediates will result in compiler un-optimizing.",
-        "    // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)",
-        "    FxaaFloat4 fxaaConsole360ConstDir",
-        ") {",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat2 posM;",
-        "    posM.x = pos.x;",
-        "    posM.y = pos.y;",
-        "    #if (FXAA_GATHER4_ALPHA == 1)",
-        "        #if (FXAA_DISCARD == 0)",
-        "            FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
-        "            #if (FXAA_GREEN_AS_LUMA == 0)",
-        "                #define lumaM rgbyM.w",
-        "            #else",
-        "                #define lumaM rgbyM.y",
-        "            #endif",
-        "        #endif",
-        "        #if (FXAA_GREEN_AS_LUMA == 0)",
-        "            FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);",
-        "            FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));",
-        "        #else",
-        "            FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);",
-        "            FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));",
-        "        #endif",
-        "        #if (FXAA_DISCARD == 1)",
-        "            #define lumaM luma4A.w",
-        "        #endif",
-        "        #define lumaE luma4A.z",
-        "        #define lumaS luma4A.x",
-        "        #define lumaSE luma4A.y",
-        "        #define lumaNW luma4B.w",
-        "        #define lumaN luma4B.z",
-        "        #define lumaW luma4B.x",
-        "    #else",
-        "        FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
-        "        #if (FXAA_GREEN_AS_LUMA == 0)",
-        "            #define lumaM rgbyM.w",
-        "        #else",
-        "            #define lumaM rgbyM.y",
-        "        #endif",
-        "        #if (FXAA_GLSL_100 == 1)",
-        "          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));",
-        "        #else",
-        "          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));",
-        "        #endif",
-        "    #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat maxSM = max(lumaS, lumaM);",
-        "    FxaaFloat minSM = min(lumaS, lumaM);",
-        "    FxaaFloat maxESM = max(lumaE, maxSM);",
-        "    FxaaFloat minESM = min(lumaE, minSM);",
-        "    FxaaFloat maxWN = max(lumaN, lumaW);",
-        "    FxaaFloat minWN = min(lumaN, lumaW);",
-        "    FxaaFloat rangeMax = max(maxWN, maxESM);",
-        "    FxaaFloat rangeMin = min(minWN, minESM);",
-        "    FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;",
-        "    FxaaFloat range = rangeMax - rangeMin;",
-        "    FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);",
-        "    FxaaBool earlyExit = range < rangeMaxClamped;",
-        "/*--------------------------------------------------------------------------*/",
-        "    if(earlyExit)",
-        "        #if (FXAA_DISCARD == 1)",
-        "            FxaaDiscard;",
-        "        #else",
-        "            return rgbyM;",
-        "        #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "    #if (FXAA_GATHER4_ALPHA == 0)",
-        "        #if (FXAA_GLSL_100 == 1)",
-        "          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));",
-        "        #else",
-        "          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));",
-        "          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
-        "        #endif",
-        "    #else",
-        "        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));",
-        "        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
-        "    #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat lumaNS = lumaN + lumaS;",
-        "    FxaaFloat lumaWE = lumaW + lumaE;",
-        "    FxaaFloat subpixRcpRange = 1.0/range;",
-        "    FxaaFloat subpixNSWE = lumaNS + lumaWE;",
-        "    FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;",
-        "    FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat lumaNESE = lumaNE + lumaSE;",
-        "    FxaaFloat lumaNWNE = lumaNW + lumaNE;",
-        "    FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;",
-        "    FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat lumaNWSW = lumaNW + lumaSW;",
-        "    FxaaFloat lumaSWSE = lumaSW + lumaSE;",
-        "    FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);",
-        "    FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);",
-        "    FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;",
-        "    FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;",
-        "    FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;",
-        "    FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;",
-        "    FxaaFloat lengthSign = fxaaQualityRcpFrame.x;",
-        "    FxaaBool horzSpan = edgeHorz >= edgeVert;",
-        "    FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;",
-        "/*--------------------------------------------------------------------------*/",
-        "    if(!horzSpan) lumaN = lumaW;",
-        "    if(!horzSpan) lumaS = lumaE;",
-        "    if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;",
-        "    FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat gradientN = lumaN - lumaM;",
-        "    FxaaFloat gradientS = lumaS - lumaM;",
-        "    FxaaFloat lumaNN = lumaN + lumaM;",
-        "    FxaaFloat lumaSS = lumaS + lumaM;",
-        "    FxaaBool pairN = abs(gradientN) >= abs(gradientS);",
-        "    FxaaFloat gradient = max(abs(gradientN), abs(gradientS));",
-        "    if(pairN) lengthSign = -lengthSign;",
-        "    FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat2 posB;",
-        "    posB.x = posM.x;",
-        "    posB.y = posM.y;",
-        "    FxaaFloat2 offNP;",
-        "    offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;",
-        "    offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;",
-        "    if(!horzSpan) posB.x += lengthSign * 0.5;",
-        "    if( horzSpan) posB.y += lengthSign * 0.5;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat2 posN;",
-        "    posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;",
-        "    posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;",
-        "    FxaaFloat2 posP;",
-        "    posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;",
-        "    posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;",
-        "    FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;",
-        "    FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));",
-        "    FxaaFloat subpixE = subpixC * subpixC;",
-        "    FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));",
-        "/*--------------------------------------------------------------------------*/",
-        "    if(!pairN) lumaNN = lumaSS;",
-        "    FxaaFloat gradientScaled = gradient * 1.0/4.0;",
-        "    FxaaFloat lumaMM = lumaM - lumaNN * 0.5;",
-        "    FxaaFloat subpixF = subpixD * subpixE;",
-        "    FxaaBool lumaMLTZero = lumaMM < 0.0;",
-        "/*--------------------------------------------------------------------------*/",
-        "    lumaEndN -= lumaNN * 0.5;",
-        "    lumaEndP -= lumaNN * 0.5;",
-        "    FxaaBool doneN = abs(lumaEndN) >= gradientScaled;",
-        "    FxaaBool doneP = abs(lumaEndP) >= gradientScaled;",
-        "    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;",
-        "    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;",
-        "    FxaaBool doneNP = (!doneN) || (!doneP);",
-        "    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;",
-        "    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;",
-        "/*--------------------------------------------------------------------------*/",
-        "    if(doneNP) {",
-        "        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "        doneN = abs(lumaEndN) >= gradientScaled;",
-        "        doneP = abs(lumaEndP) >= gradientScaled;",
-        "        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;",
-        "        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;",
-        "        doneNP = (!doneN) || (!doneP);",
-        "        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;",
-        "        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;",
-        "/*--------------------------------------------------------------------------*/",
-        "        #if (FXAA_QUALITY_PS > 3)",
-        "        if(doneNP) {",
-        "            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "            doneN = abs(lumaEndN) >= gradientScaled;",
-        "            doneP = abs(lumaEndP) >= gradientScaled;",
-        "            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;",
-        "            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;",
-        "            doneNP = (!doneN) || (!doneP);",
-        "            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;",
-        "            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;",
-        "/*--------------------------------------------------------------------------*/",
-        "            #if (FXAA_QUALITY_PS > 4)",
-        "            if(doneNP) {",
-        "                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                doneN = abs(lumaEndN) >= gradientScaled;",
-        "                doneP = abs(lumaEndP) >= gradientScaled;",
-        "                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;",
-        "                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;",
-        "                doneNP = (!doneN) || (!doneP);",
-        "                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;",
-        "                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;",
-        "/*--------------------------------------------------------------------------*/",
-        "                #if (FXAA_QUALITY_PS > 5)",
-        "                if(doneNP) {",
-        "                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                    doneN = abs(lumaEndN) >= gradientScaled;",
-        "                    doneP = abs(lumaEndP) >= gradientScaled;",
-        "                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;",
-        "                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;",
-        "                    doneNP = (!doneN) || (!doneP);",
-        "                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;",
-        "                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;",
-        "/*--------------------------------------------------------------------------*/",
-        "                    #if (FXAA_QUALITY_PS > 6)",
-        "                    if(doneNP) {",
-        "                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                        doneN = abs(lumaEndN) >= gradientScaled;",
-        "                        doneP = abs(lumaEndP) >= gradientScaled;",
-        "                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;",
-        "                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;",
-        "                        doneNP = (!doneN) || (!doneP);",
-        "                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;",
-        "                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;",
-        "/*--------------------------------------------------------------------------*/",
-        "                        #if (FXAA_QUALITY_PS > 7)",
-        "                        if(doneNP) {",
-        "                            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                            doneN = abs(lumaEndN) >= gradientScaled;",
-        "                            doneP = abs(lumaEndP) >= gradientScaled;",
-        "                            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;",
-        "                            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;",
-        "                            doneNP = (!doneN) || (!doneP);",
-        "                            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;",
-        "                            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;",
-        "/*--------------------------------------------------------------------------*/",
-        "    #if (FXAA_QUALITY_PS > 8)",
-        "    if(doneNP) {",
-        "        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "        doneN = abs(lumaEndN) >= gradientScaled;",
-        "        doneP = abs(lumaEndP) >= gradientScaled;",
-        "        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;",
-        "        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;",
-        "        doneNP = (!doneN) || (!doneP);",
-        "        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;",
-        "        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;",
-        "/*--------------------------------------------------------------------------*/",
-        "        #if (FXAA_QUALITY_PS > 9)",
-        "        if(doneNP) {",
-        "            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "            doneN = abs(lumaEndN) >= gradientScaled;",
-        "            doneP = abs(lumaEndP) >= gradientScaled;",
-        "            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;",
-        "            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;",
-        "            doneNP = (!doneN) || (!doneP);",
-        "            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;",
-        "            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;",
-        "/*--------------------------------------------------------------------------*/",
-        "            #if (FXAA_QUALITY_PS > 10)",
-        "            if(doneNP) {",
-        "                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                doneN = abs(lumaEndN) >= gradientScaled;",
-        "                doneP = abs(lumaEndP) >= gradientScaled;",
-        "                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;",
-        "                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;",
-        "                doneNP = (!doneN) || (!doneP);",
-        "                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;",
-        "                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;",
-        "/*--------------------------------------------------------------------------*/",
-        "                #if (FXAA_QUALITY_PS > 11)",
-        "                if(doneNP) {",
-        "                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                    doneN = abs(lumaEndN) >= gradientScaled;",
-        "                    doneP = abs(lumaEndP) >= gradientScaled;",
-        "                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;",
-        "                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;",
-        "                    doneNP = (!doneN) || (!doneP);",
-        "                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;",
-        "                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;",
-        "/*--------------------------------------------------------------------------*/",
-        "                    #if (FXAA_QUALITY_PS > 12)",
-        "                    if(doneNP) {",
-        "                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
-        "                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
-        "                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
-        "                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
-        "                        doneN = abs(lumaEndN) >= gradientScaled;",
-        "                        doneP = abs(lumaEndP) >= gradientScaled;",
-        "                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;",
-        "                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;",
-        "                        doneNP = (!doneN) || (!doneP);",
-        "                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;",
-        "                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;",
-        "/*--------------------------------------------------------------------------*/",
-        "                    }",
-        "                    #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "                }",
-        "                #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "            }",
-        "            #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "        }",
-        "        #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "    }",
-        "    #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "                        }",
-        "                        #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "                    }",
-        "                    #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "                }",
-        "                #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "            }",
-        "            #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "        }",
-        "        #endif",
-        "/*--------------------------------------------------------------------------*/",
-        "    }",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat dstN = posM.x - posN.x;",
-        "    FxaaFloat dstP = posP.x - posM.x;",
-        "    if(!horzSpan) dstN = posM.y - posN.y;",
-        "    if(!horzSpan) dstP = posP.y - posM.y;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;",
-        "    FxaaFloat spanLength = (dstP + dstN);",
-        "    FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;",
-        "    FxaaFloat spanLengthRcp = 1.0/spanLength;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaBool directionN = dstN < dstP;",
-        "    FxaaFloat dst = min(dstN, dstP);",
-        "    FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;",
-        "    FxaaFloat subpixG = subpixF * subpixF;",
-        "    FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;",
-        "    FxaaFloat subpixH = subpixG * fxaaQualitySubpix;",
-        "/*--------------------------------------------------------------------------*/",
-        "    FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;",
-        "    FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);",
-        "    if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;",
-        "    if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;",
-        "    #if (FXAA_DISCARD == 1)",
-        "        return FxaaTexTop(tex, posM);",
-        "    #else",
-        "        return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);",
-        "    #endif",
-        "}",
-        "/*==========================================================================*/",
-        "#endif",
-        "",
-        "void main() {",
-        "  gl_FragColor = FxaaPixelShader(",
-        "    vUv,",
-        "    vec4(0.0),",
-        "    tDiffuse,",
-        "    tDiffuse,",
-        "    tDiffuse,",
-        "    resolution,",
-        "    vec4(0.0),",
-        "    vec4(0.0),",
-        "    vec4(0.0),",
-        "    0.75,",
-        "    0.166,",
-        "    0.0833,",
-        "    0.0,",
-        "    0.0,",
-        "    0.0,",
-        "    vec4(0.0)",
-        "  );",
-        "",
-        "  // TODO avoid querying texture twice for same texel",
-        "  gl_FragColor.a = texture2D(tDiffuse, vUv).a;",
-        "}"
-	].join("\n")
+		"precision highp float;",
+		"",
+		"uniform sampler2D tDiffuse;",
+		"",
+		"uniform vec2 resolution;",
+		"",
+		"varying vec2 vUv;",
+		"",
+		"// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro ([email protected])",
+		"",
+		"//----------------------------------------------------------------------------------",
+		"// File:        es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag",
+		"// SDK Version: v3.00",
+		"// Email:       [email protected]",
+		"// Site:        http://developer.nvidia.com/",
+		"//",
+		"// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.",
+		"//",
+		"// Redistribution and use in source and binary forms, with or without",
+		"// modification, are permitted provided that the following conditions",
+		"// are met:",
+		"//  * Redistributions of source code must retain the above copyright",
+		"//    notice, this list of conditions and the following disclaimer.",
+		"//  * Redistributions in binary form must reproduce the above copyright",
+		"//    notice, this list of conditions and the following disclaimer in the",
+		"//    documentation and/or other materials provided with the distribution.",
+		"//  * Neither the name of NVIDIA CORPORATION nor the names of its",
+		"//    contributors may be used to endorse or promote products derived",
+		"//    from this software without specific prior written permission.",
+		"//",
+		"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY",
+		"// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
+		"// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
+		"// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR",
+		"// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,",
+		"// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,",
+		"// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR",
+		"// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY",
+		"// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
+		"// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
+		"// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
+		"//",
+		"//----------------------------------------------------------------------------------",
+		"",
+		"#define FXAA_PC 1",
+		"#define FXAA_GLSL_100 1",
+		"#define FXAA_QUALITY_PRESET 12",
+		"",
+		"#define FXAA_GREEN_AS_LUMA 1",
+		"",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_PC_CONSOLE",
+		"    //",
+		"    // The console algorithm for PC is included",
+		"    // for developers targeting really low spec machines.",
+		"    // Likely better to just run FXAA_PC, and use a really low preset.",
+		"    //",
+		"    #define FXAA_PC_CONSOLE 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_GLSL_120",
+		"    #define FXAA_GLSL_120 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_GLSL_130",
+		"    #define FXAA_GLSL_130 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_HLSL_3",
+		"    #define FXAA_HLSL_3 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_HLSL_4",
+		"    #define FXAA_HLSL_4 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_HLSL_5",
+		"    #define FXAA_HLSL_5 0",
+		"#endif",
+		"/*==========================================================================*/",
+		"#ifndef FXAA_GREEN_AS_LUMA",
+		"    //",
+		"    // For those using non-linear color,",
+		"    // and either not able to get luma in alpha, or not wanting to,",
+		"    // this enables FXAA to run using green as a proxy for luma.",
+		"    // So with this enabled, no need to pack luma in alpha.",
+		"    //",
+		"    // This will turn off AA on anything which lacks some amount of green.",
+		"    // Pure red and blue or combination of only R and B, will get no AA.",
+		"    //",
+		"    // Might want to lower the settings for both,",
+		"    //    fxaaConsoleEdgeThresholdMin",
+		"    //    fxaaQualityEdgeThresholdMin",
+		"    // In order to insure AA does not get turned off on colors",
+		"    // which contain a minor amount of green.",
+		"    //",
+		"    // 1 = On.",
+		"    // 0 = Off.",
+		"    //",
+		"    #define FXAA_GREEN_AS_LUMA 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_EARLY_EXIT",
+		"    //",
+		"    // Controls algorithm's early exit path.",
+		"    // On PS3 turning this ON adds 2 cycles to the shader.",
+		"    // On 360 turning this OFF adds 10ths of a millisecond to the shader.",
+		"    // Turning this off on console will result in a more blurry image.",
+		"    // So this defaults to on.",
+		"    //",
+		"    // 1 = On.",
+		"    // 0 = Off.",
+		"    //",
+		"    #define FXAA_EARLY_EXIT 1",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_DISCARD",
+		"    //",
+		"    // Only valid for PC OpenGL currently.",
+		"    // Probably will not work when FXAA_GREEN_AS_LUMA = 1.",
+		"    //",
+		"    // 1 = Use discard on pixels which don't need AA.",
+		"    //     For APIs which enable concurrent TEX+ROP from same surface.",
+		"    // 0 = Return unchanged color on pixels which don't need AA.",
+		"    //",
+		"    #define FXAA_DISCARD 0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_FAST_PIXEL_OFFSET",
+		"    //",
+		"    // Used for GLSL 120 only.",
+		"    //",
+		"    // 1 = GL API supports fast pixel offsets",
+		"    // 0 = do not use fast pixel offsets",
+		"    //",
+		"    #ifdef GL_EXT_gpu_shader4",
+		"        #define FXAA_FAST_PIXEL_OFFSET 1",
+		"    #endif",
+		"    #ifdef GL_NV_gpu_shader5",
+		"        #define FXAA_FAST_PIXEL_OFFSET 1",
+		"    #endif",
+		"    #ifdef GL_ARB_gpu_shader5",
+		"        #define FXAA_FAST_PIXEL_OFFSET 1",
+		"    #endif",
+		"    #ifndef FXAA_FAST_PIXEL_OFFSET",
+		"        #define FXAA_FAST_PIXEL_OFFSET 0",
+		"    #endif",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#ifndef FXAA_GATHER4_ALPHA",
+		"    //",
+		"    // 1 = API supports gather4 on alpha channel.",
+		"    // 0 = API does not support gather4 on alpha channel.",
+		"    //",
+		"    #if (FXAA_HLSL_5 == 1)",
+		"        #define FXAA_GATHER4_ALPHA 1",
+		"    #endif",
+		"    #ifdef GL_ARB_gpu_shader5",
+		"        #define FXAA_GATHER4_ALPHA 1",
+		"    #endif",
+		"    #ifdef GL_NV_gpu_shader5",
+		"        #define FXAA_GATHER4_ALPHA 1",
+		"    #endif",
+		"    #ifndef FXAA_GATHER4_ALPHA",
+		"        #define FXAA_GATHER4_ALPHA 0",
+		"    #endif",
+		"#endif",
+		"",
+		"",
+		"/*============================================================================",
+		"                        FXAA QUALITY - TUNING KNOBS",
+		"------------------------------------------------------------------------------",
+		"NOTE the other tuning knobs are now in the shader function inputs!",
+		"============================================================================*/",
+		"#ifndef FXAA_QUALITY_PRESET",
+		"    //",
+		"    // Choose the quality preset.",
+		"    // This needs to be compiled into the shader as it effects code.",
+		"    // Best option to include multiple presets is to",
+		"    // in each shader define the preset, then include this file.",
+		"    //",
+		"    // OPTIONS",
+		"    // -----------------------------------------------------------------------",
+		"    // 10 to 15 - default medium dither (10=fastest, 15=highest quality)",
+		"    // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)",
+		"    // 39       - no dither, very expensive",
+		"    //",
+		"    // NOTES",
+		"    // -----------------------------------------------------------------------",
+		"    // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)",
+		"    // 13 = about same speed as FXAA 3.9 and better than 12",
+		"    // 23 = closest to FXAA 3.9 visually and performance wise",
+		"    //  _ = the lowest digit is directly related to performance",
+		"    // _  = the highest digit is directly related to style",
+		"    //",
+		"    #define FXAA_QUALITY_PRESET 12",
+		"#endif",
+		"",
+		"",
+		"/*============================================================================",
+		"",
+		"                           FXAA QUALITY - PRESETS",
+		"",
+		"============================================================================*/",
+		"",
+		"/*============================================================================",
+		"                     FXAA QUALITY - MEDIUM DITHER PRESETS",
+		"============================================================================*/",
+		"#if (FXAA_QUALITY_PRESET == 10)",
+		"    #define FXAA_QUALITY_PS 3",
+		"    #define FXAA_QUALITY_P0 1.5",
+		"    #define FXAA_QUALITY_P1 3.0",
+		"    #define FXAA_QUALITY_P2 12.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 11)",
+		"    #define FXAA_QUALITY_PS 4",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 3.0",
+		"    #define FXAA_QUALITY_P3 12.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 12)",
+		"    #define FXAA_QUALITY_PS 5",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 4.0",
+		"    #define FXAA_QUALITY_P4 12.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 13)",
+		"    #define FXAA_QUALITY_PS 6",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 4.0",
+		"    #define FXAA_QUALITY_P5 12.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 14)",
+		"    #define FXAA_QUALITY_PS 7",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 4.0",
+		"    #define FXAA_QUALITY_P6 12.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 15)",
+		"    #define FXAA_QUALITY_PS 8",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 4.0",
+		"    #define FXAA_QUALITY_P7 12.0",
+		"#endif",
+		"",
+		"/*============================================================================",
+		"                     FXAA QUALITY - LOW DITHER PRESETS",
+		"============================================================================*/",
+		"#if (FXAA_QUALITY_PRESET == 20)",
+		"    #define FXAA_QUALITY_PS 3",
+		"    #define FXAA_QUALITY_P0 1.5",
+		"    #define FXAA_QUALITY_P1 2.0",
+		"    #define FXAA_QUALITY_P2 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 21)",
+		"    #define FXAA_QUALITY_PS 4",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 22)",
+		"    #define FXAA_QUALITY_PS 5",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 23)",
+		"    #define FXAA_QUALITY_PS 6",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 24)",
+		"    #define FXAA_QUALITY_PS 7",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 3.0",
+		"    #define FXAA_QUALITY_P6 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 25)",
+		"    #define FXAA_QUALITY_PS 8",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 4.0",
+		"    #define FXAA_QUALITY_P7 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 26)",
+		"    #define FXAA_QUALITY_PS 9",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 2.0",
+		"    #define FXAA_QUALITY_P7 4.0",
+		"    #define FXAA_QUALITY_P8 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 27)",
+		"    #define FXAA_QUALITY_PS 10",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 2.0",
+		"    #define FXAA_QUALITY_P7 2.0",
+		"    #define FXAA_QUALITY_P8 4.0",
+		"    #define FXAA_QUALITY_P9 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 28)",
+		"    #define FXAA_QUALITY_PS 11",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 2.0",
+		"    #define FXAA_QUALITY_P7 2.0",
+		"    #define FXAA_QUALITY_P8 2.0",
+		"    #define FXAA_QUALITY_P9 4.0",
+		"    #define FXAA_QUALITY_P10 8.0",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_QUALITY_PRESET == 29)",
+		"    #define FXAA_QUALITY_PS 12",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.5",
+		"    #define FXAA_QUALITY_P2 2.0",
+		"    #define FXAA_QUALITY_P3 2.0",
+		"    #define FXAA_QUALITY_P4 2.0",
+		"    #define FXAA_QUALITY_P5 2.0",
+		"    #define FXAA_QUALITY_P6 2.0",
+		"    #define FXAA_QUALITY_P7 2.0",
+		"    #define FXAA_QUALITY_P8 2.0",
+		"    #define FXAA_QUALITY_P9 2.0",
+		"    #define FXAA_QUALITY_P10 4.0",
+		"    #define FXAA_QUALITY_P11 8.0",
+		"#endif",
+		"",
+		"/*============================================================================",
+		"                     FXAA QUALITY - EXTREME QUALITY",
+		"============================================================================*/",
+		"#if (FXAA_QUALITY_PRESET == 39)",
+		"    #define FXAA_QUALITY_PS 12",
+		"    #define FXAA_QUALITY_P0 1.0",
+		"    #define FXAA_QUALITY_P1 1.0",
+		"    #define FXAA_QUALITY_P2 1.0",
+		"    #define FXAA_QUALITY_P3 1.0",
+		"    #define FXAA_QUALITY_P4 1.0",
+		"    #define FXAA_QUALITY_P5 1.5",
+		"    #define FXAA_QUALITY_P6 2.0",
+		"    #define FXAA_QUALITY_P7 2.0",
+		"    #define FXAA_QUALITY_P8 2.0",
+		"    #define FXAA_QUALITY_P9 2.0",
+		"    #define FXAA_QUALITY_P10 4.0",
+		"    #define FXAA_QUALITY_P11 8.0",
+		"#endif",
+		"",
+		"",
+		"",
+		"/*============================================================================",
+		"",
+		"                                API PORTING",
+		"",
+		"============================================================================*/",
+		"#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)",
+		"    #define FxaaBool bool",
+		"    #define FxaaDiscard discard",
+		"    #define FxaaFloat float",
+		"    #define FxaaFloat2 vec2",
+		"    #define FxaaFloat3 vec3",
+		"    #define FxaaFloat4 vec4",
+		"    #define FxaaHalf float",
+		"    #define FxaaHalf2 vec2",
+		"    #define FxaaHalf3 vec3",
+		"    #define FxaaHalf4 vec4",
+		"    #define FxaaInt2 ivec2",
+		"    #define FxaaSat(x) clamp(x, 0.0, 1.0)",
+		"    #define FxaaTex sampler2D",
+		"#else",
+		"    #define FxaaBool bool",
+		"    #define FxaaDiscard clip(-1)",
+		"    #define FxaaFloat float",
+		"    #define FxaaFloat2 float2",
+		"    #define FxaaFloat3 float3",
+		"    #define FxaaFloat4 float4",
+		"    #define FxaaHalf half",
+		"    #define FxaaHalf2 half2",
+		"    #define FxaaHalf3 half3",
+		"    #define FxaaHalf4 half4",
+		"    #define FxaaSat(x) saturate(x)",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_GLSL_100 == 1)",
+		"  #define FxaaTexTop(t, p) texture2D(t, p, 0.0)",
+		"  #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_GLSL_120 == 1)",
+		"    // Requires,",
+		"    //  #version 120",
+		"    // And at least,",
+		"    //  #extension GL_EXT_gpu_shader4 : enable",
+		"    //  (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)",
+		"    #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)",
+		"    #if (FXAA_FAST_PIXEL_OFFSET == 1)",
+		"        #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)",
+		"    #else",
+		"        #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)",
+		"    #endif",
+		"    #if (FXAA_GATHER4_ALPHA == 1)",
+		"        // use #extension GL_ARB_gpu_shader5 : enable",
+		"        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
+		"        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
+		"        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
+		"        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
+		"    #endif",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_GLSL_130 == 1)",
+		"    // Requires \"#version 130\" or better",
+		"    #define FxaaTexTop(t, p) textureLod(t, p, 0.0)",
+		"    #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)",
+		"    #if (FXAA_GATHER4_ALPHA == 1)",
+		"        // use #extension GL_ARB_gpu_shader5 : enable",
+		"        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
+		"        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
+		"        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
+		"        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
+		"    #endif",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_HLSL_3 == 1)",
+		"    #define FxaaInt2 float2",
+		"    #define FxaaTex sampler2D",
+		"    #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))",
+		"    #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_HLSL_4 == 1)",
+		"    #define FxaaInt2 int2",
+		"    struct FxaaTex { SamplerState smpl; Texture2D tex; };",
+		"    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
+		"    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
+		"#endif",
+		"/*--------------------------------------------------------------------------*/",
+		"#if (FXAA_HLSL_5 == 1)",
+		"    #define FxaaInt2 int2",
+		"    struct FxaaTex { SamplerState smpl; Texture2D tex; };",
+		"    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
+		"    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
+		"    #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)",
+		"    #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)",
+		"    #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)",
+		"    #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)",
+		"#endif",
+		"",
+		"",
+		"/*============================================================================",
+		"                   GREEN AS LUMA OPTION SUPPORT FUNCTION",
+		"============================================================================*/",
+		"#if (FXAA_GREEN_AS_LUMA == 0)",
+		"    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }",
+		"#else",
+		"    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }",
+		"#endif",
+		"",
+		"",
+		"",
+		"",
+		"/*============================================================================",
+		"",
+		"                             FXAA3 QUALITY - PC",
+		"",
+		"============================================================================*/",
+		"#if (FXAA_PC == 1)",
+		"/*--------------------------------------------------------------------------*/",
+		"FxaaFloat4 FxaaPixelShader(",
+		"    //",
+		"    // Use noperspective interpolation here (turn off perspective interpolation).",
+		"    // {xy} = center of pixel",
+		"    FxaaFloat2 pos,",
+		"    //",
+		"    // Used only for FXAA Console, and not used on the 360 version.",
+		"    // Use noperspective interpolation here (turn off perspective interpolation).",
+		"    // {xy_} = upper left of pixel",
+		"    // {_zw} = lower right of pixel",
+		"    FxaaFloat4 fxaaConsolePosPos,",
+		"    //",
+		"    // Input color texture.",
+		"    // {rgb_} = color in linear or perceptual color space",
+		"    // if (FXAA_GREEN_AS_LUMA == 0)",
+		"    //     {__a} = luma in perceptual color space (not linear)",
+		"    FxaaTex tex,",
+		"    //",
+		"    // Only used on the optimized 360 version of FXAA Console.",
+		"    // For everything but 360, just use the same input here as for \"tex\".",
+		"    // For 360, same texture, just alias with a 2nd sampler.",
+		"    // This sampler needs to have an exponent bias of -1.",
+		"    FxaaTex fxaaConsole360TexExpBiasNegOne,",
+		"    //",
+		"    // Only used on the optimized 360 version of FXAA Console.",
+		"    // For everything but 360, just use the same input here as for \"tex\".",
+		"    // For 360, same texture, just alias with a 3nd sampler.",
+		"    // This sampler needs to have an exponent bias of -2.",
+		"    FxaaTex fxaaConsole360TexExpBiasNegTwo,",
+		"    //",
+		"    // Only used on FXAA Quality.",
+		"    // This must be from a constant/uniform.",
+		"    // {x_} = 1.0/screenWidthInPixels",
+		"    // {_y} = 1.0/screenHeightInPixels",
+		"    FxaaFloat2 fxaaQualityRcpFrame,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // This must be from a constant/uniform.",
+		"    // This effects sub-pixel AA quality and inversely sharpness.",
+		"    //   Where N ranges between,",
+		"    //     N = 0.50 (default)",
+		"    //     N = 0.33 (sharper)",
+		"    // {x__} = -N/screenWidthInPixels",
+		"    // {_y_} = -N/screenHeightInPixels",
+		"    // {_z_} =  N/screenWidthInPixels",
+		"    // {__w} =  N/screenHeightInPixels",
+		"    FxaaFloat4 fxaaConsoleRcpFrameOpt,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // Not used on 360, but used on PS3 and PC.",
+		"    // This must be from a constant/uniform.",
+		"    // {x__} = -2.0/screenWidthInPixels",
+		"    // {_y_} = -2.0/screenHeightInPixels",
+		"    // {_z_} =  2.0/screenWidthInPixels",
+		"    // {__w} =  2.0/screenHeightInPixels",
+		"    FxaaFloat4 fxaaConsoleRcpFrameOpt2,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.",
+		"    // This must be from a constant/uniform.",
+		"    // {x__} =  8.0/screenWidthInPixels",
+		"    // {_y_} =  8.0/screenHeightInPixels",
+		"    // {_z_} = -4.0/screenWidthInPixels",
+		"    // {__w} = -4.0/screenHeightInPixels",
+		"    FxaaFloat4 fxaaConsole360RcpFrameOpt2,",
+		"    //",
+		"    // Only used on FXAA Quality.",
+		"    // This used to be the FXAA_QUALITY_SUBPIX define.",
+		"    // It is here now to allow easier tuning.",
+		"    // Choose the amount of sub-pixel aliasing removal.",
+		"    // This can effect sharpness.",
+		"    //   1.00 - upper limit (softer)",
+		"    //   0.75 - default amount of filtering",
+		"    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)",
+		"    //   0.25 - almost off",
+		"    //   0.00 - completely off",
+		"    FxaaFloat fxaaQualitySubpix,",
+		"    //",
+		"    // Only used on FXAA Quality.",
+		"    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.",
+		"    // It is here now to allow easier tuning.",
+		"    // The minimum amount of local contrast required to apply algorithm.",
+		"    //   0.333 - too little (faster)",
+		"    //   0.250 - low quality",
+		"    //   0.166 - default",
+		"    //   0.125 - high quality",
+		"    //   0.063 - overkill (slower)",
+		"    FxaaFloat fxaaQualityEdgeThreshold,",
+		"    //",
+		"    // Only used on FXAA Quality.",
+		"    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.",
+		"    // It is here now to allow easier tuning.",
+		"    // Trims the algorithm from processing darks.",
+		"    //   0.0833 - upper limit (default, the start of visible unfiltered edges)",
+		"    //   0.0625 - high quality (faster)",
+		"    //   0.0312 - visible limit (slower)",
+		"    // Special notes when using FXAA_GREEN_AS_LUMA,",
+		"    //   Likely want to set this to zero.",
+		"    //   As colors that are mostly not-green",
+		"    //   will appear very dark in the green channel!",
+		"    //   Tune by looking at mostly non-green content,",
+		"    //   then start at zero and increase until aliasing is a problem.",
+		"    FxaaFloat fxaaQualityEdgeThresholdMin,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.",
+		"    // It is here now to allow easier tuning.",
+		"    // This does not effect PS3, as this needs to be compiled in.",
+		"    //   Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.",
+		"    //   Due to the PS3 being ALU bound,",
+		"    //   there are only three safe values here: 2 and 4 and 8.",
+		"    //   These options use the shaders ability to a free *|/ by 2|4|8.",
+		"    // For all other platforms can be a non-power of two.",
+		"    //   8.0 is sharper (default!!!)",
+		"    //   4.0 is softer",
+		"    //   2.0 is really soft (good only for vector graphics inputs)",
+		"    FxaaFloat fxaaConsoleEdgeSharpness,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.",
+		"    // It is here now to allow easier tuning.",
+		"    // This does not effect PS3, as this needs to be compiled in.",
+		"    //   Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.",
+		"    //   Due to the PS3 being ALU bound,",
+		"    //   there are only two safe values here: 1/4 and 1/8.",
+		"    //   These options use the shaders ability to a free *|/ by 2|4|8.",
+		"    // The console setting has a different mapping than the quality setting.",
+		"    // Other platforms can use other values.",
+		"    //   0.125 leaves less aliasing, but is softer (default!!!)",
+		"    //   0.25 leaves more aliasing, and is sharper",
+		"    FxaaFloat fxaaConsoleEdgeThreshold,",
+		"    //",
+		"    // Only used on FXAA Console.",
+		"    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.",
+		"    // It is here now to allow easier tuning.",
+		"    // Trims the algorithm from processing darks.",
+		"    // The console setting has a different mapping than the quality setting.",
+		"    // This only applies when FXAA_EARLY_EXIT is 1.",
+		"    // This does not apply to PS3,",
+		"    // PS3 was simplified to avoid more shader instructions.",
+		"    //   0.06 - faster but more aliasing in darks",
+		"    //   0.05 - default",
+		"    //   0.04 - slower and less aliasing in darks",
+		"    // Special notes when using FXAA_GREEN_AS_LUMA,",
+		"    //   Likely want to set this to zero.",
+		"    //   As colors that are mostly not-green",
+		"    //   will appear very dark in the green channel!",
+		"    //   Tune by looking at mostly non-green content,",
+		"    //   then start at zero and increase until aliasing is a problem.",
+		"    FxaaFloat fxaaConsoleEdgeThresholdMin,",
+		"    //",
+		"    // Extra constants for 360 FXAA Console only.",
+		"    // Use zeros or anything else for other platforms.",
+		"    // These must be in physical constant registers and NOT immediates.",
+		"    // Immediates will result in compiler un-optimizing.",
+		"    // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)",
+		"    FxaaFloat4 fxaaConsole360ConstDir",
+		") {",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat2 posM;",
+		"    posM.x = pos.x;",
+		"    posM.y = pos.y;",
+		"    #if (FXAA_GATHER4_ALPHA == 1)",
+		"        #if (FXAA_DISCARD == 0)",
+		"            FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
+		"            #if (FXAA_GREEN_AS_LUMA == 0)",
+		"                #define lumaM rgbyM.w",
+		"            #else",
+		"                #define lumaM rgbyM.y",
+		"            #endif",
+		"        #endif",
+		"        #if (FXAA_GREEN_AS_LUMA == 0)",
+		"            FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);",
+		"            FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));",
+		"        #else",
+		"            FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);",
+		"            FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));",
+		"        #endif",
+		"        #if (FXAA_DISCARD == 1)",
+		"            #define lumaM luma4A.w",
+		"        #endif",
+		"        #define lumaE luma4A.z",
+		"        #define lumaS luma4A.x",
+		"        #define lumaSE luma4A.y",
+		"        #define lumaNW luma4B.w",
+		"        #define lumaN luma4B.z",
+		"        #define lumaW luma4B.x",
+		"    #else",
+		"        FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
+		"        #if (FXAA_GREEN_AS_LUMA == 0)",
+		"            #define lumaM rgbyM.w",
+		"        #else",
+		"            #define lumaM rgbyM.y",
+		"        #endif",
+		"        #if (FXAA_GLSL_100 == 1)",
+		"          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));",
+		"        #else",
+		"          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));",
+		"        #endif",
+		"    #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat maxSM = max(lumaS, lumaM);",
+		"    FxaaFloat minSM = min(lumaS, lumaM);",
+		"    FxaaFloat maxESM = max(lumaE, maxSM);",
+		"    FxaaFloat minESM = min(lumaE, minSM);",
+		"    FxaaFloat maxWN = max(lumaN, lumaW);",
+		"    FxaaFloat minWN = min(lumaN, lumaW);",
+		"    FxaaFloat rangeMax = max(maxWN, maxESM);",
+		"    FxaaFloat rangeMin = min(minWN, minESM);",
+		"    FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;",
+		"    FxaaFloat range = rangeMax - rangeMin;",
+		"    FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);",
+		"    FxaaBool earlyExit = range < rangeMaxClamped;",
+		"/*--------------------------------------------------------------------------*/",
+		"    if(earlyExit)",
+		"        #if (FXAA_DISCARD == 1)",
+		"            FxaaDiscard;",
+		"        #else",
+		"            return rgbyM;",
+		"        #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"    #if (FXAA_GATHER4_ALPHA == 0)",
+		"        #if (FXAA_GLSL_100 == 1)",
+		"          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));",
+		"        #else",
+		"          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));",
+		"          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
+		"        #endif",
+		"    #else",
+		"        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));",
+		"        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
+		"    #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat lumaNS = lumaN + lumaS;",
+		"    FxaaFloat lumaWE = lumaW + lumaE;",
+		"    FxaaFloat subpixRcpRange = 1.0/range;",
+		"    FxaaFloat subpixNSWE = lumaNS + lumaWE;",
+		"    FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;",
+		"    FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat lumaNESE = lumaNE + lumaSE;",
+		"    FxaaFloat lumaNWNE = lumaNW + lumaNE;",
+		"    FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;",
+		"    FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat lumaNWSW = lumaNW + lumaSW;",
+		"    FxaaFloat lumaSWSE = lumaSW + lumaSE;",
+		"    FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);",
+		"    FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);",
+		"    FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;",
+		"    FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;",
+		"    FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;",
+		"    FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;",
+		"    FxaaFloat lengthSign = fxaaQualityRcpFrame.x;",
+		"    FxaaBool horzSpan = edgeHorz >= edgeVert;",
+		"    FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;",
+		"/*--------------------------------------------------------------------------*/",
+		"    if(!horzSpan) lumaN = lumaW;",
+		"    if(!horzSpan) lumaS = lumaE;",
+		"    if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;",
+		"    FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat gradientN = lumaN - lumaM;",
+		"    FxaaFloat gradientS = lumaS - lumaM;",
+		"    FxaaFloat lumaNN = lumaN + lumaM;",
+		"    FxaaFloat lumaSS = lumaS + lumaM;",
+		"    FxaaBool pairN = abs(gradientN) >= abs(gradientS);",
+		"    FxaaFloat gradient = max(abs(gradientN), abs(gradientS));",
+		"    if(pairN) lengthSign = -lengthSign;",
+		"    FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat2 posB;",
+		"    posB.x = posM.x;",
+		"    posB.y = posM.y;",
+		"    FxaaFloat2 offNP;",
+		"    offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;",
+		"    offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;",
+		"    if(!horzSpan) posB.x += lengthSign * 0.5;",
+		"    if( horzSpan) posB.y += lengthSign * 0.5;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat2 posN;",
+		"    posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;",
+		"    posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;",
+		"    FxaaFloat2 posP;",
+		"    posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;",
+		"    posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;",
+		"    FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;",
+		"    FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));",
+		"    FxaaFloat subpixE = subpixC * subpixC;",
+		"    FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));",
+		"/*--------------------------------------------------------------------------*/",
+		"    if(!pairN) lumaNN = lumaSS;",
+		"    FxaaFloat gradientScaled = gradient * 1.0/4.0;",
+		"    FxaaFloat lumaMM = lumaM - lumaNN * 0.5;",
+		"    FxaaFloat subpixF = subpixD * subpixE;",
+		"    FxaaBool lumaMLTZero = lumaMM < 0.0;",
+		"/*--------------------------------------------------------------------------*/",
+		"    lumaEndN -= lumaNN * 0.5;",
+		"    lumaEndP -= lumaNN * 0.5;",
+		"    FxaaBool doneN = abs(lumaEndN) >= gradientScaled;",
+		"    FxaaBool doneP = abs(lumaEndP) >= gradientScaled;",
+		"    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;",
+		"    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;",
+		"    FxaaBool doneNP = (!doneN) || (!doneP);",
+		"    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;",
+		"    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;",
+		"/*--------------------------------------------------------------------------*/",
+		"    if(doneNP) {",
+		"        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"        doneN = abs(lumaEndN) >= gradientScaled;",
+		"        doneP = abs(lumaEndP) >= gradientScaled;",
+		"        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;",
+		"        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;",
+		"        doneNP = (!doneN) || (!doneP);",
+		"        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;",
+		"        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;",
+		"/*--------------------------------------------------------------------------*/",
+		"        #if (FXAA_QUALITY_PS > 3)",
+		"        if(doneNP) {",
+		"            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"            doneN = abs(lumaEndN) >= gradientScaled;",
+		"            doneP = abs(lumaEndP) >= gradientScaled;",
+		"            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;",
+		"            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;",
+		"            doneNP = (!doneN) || (!doneP);",
+		"            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;",
+		"            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;",
+		"/*--------------------------------------------------------------------------*/",
+		"            #if (FXAA_QUALITY_PS > 4)",
+		"            if(doneNP) {",
+		"                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                doneN = abs(lumaEndN) >= gradientScaled;",
+		"                doneP = abs(lumaEndP) >= gradientScaled;",
+		"                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;",
+		"                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;",
+		"                doneNP = (!doneN) || (!doneP);",
+		"                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;",
+		"                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;",
+		"/*--------------------------------------------------------------------------*/",
+		"                #if (FXAA_QUALITY_PS > 5)",
+		"                if(doneNP) {",
+		"                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                    doneN = abs(lumaEndN) >= gradientScaled;",
+		"                    doneP = abs(lumaEndP) >= gradientScaled;",
+		"                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;",
+		"                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;",
+		"                    doneNP = (!doneN) || (!doneP);",
+		"                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;",
+		"                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;",
+		"/*--------------------------------------------------------------------------*/",
+		"                    #if (FXAA_QUALITY_PS > 6)",
+		"                    if(doneNP) {",
+		"                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                        doneN = abs(lumaEndN) >= gradientScaled;",
+		"                        doneP = abs(lumaEndP) >= gradientScaled;",
+		"                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;",
+		"                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;",
+		"                        doneNP = (!doneN) || (!doneP);",
+		"                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;",
+		"                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;",
+		"/*--------------------------------------------------------------------------*/",
+		"                        #if (FXAA_QUALITY_PS > 7)",
+		"                        if(doneNP) {",
+		"                            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                            doneN = abs(lumaEndN) >= gradientScaled;",
+		"                            doneP = abs(lumaEndP) >= gradientScaled;",
+		"                            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;",
+		"                            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;",
+		"                            doneNP = (!doneN) || (!doneP);",
+		"                            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;",
+		"                            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;",
+		"/*--------------------------------------------------------------------------*/",
+		"    #if (FXAA_QUALITY_PS > 8)",
+		"    if(doneNP) {",
+		"        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"        doneN = abs(lumaEndN) >= gradientScaled;",
+		"        doneP = abs(lumaEndP) >= gradientScaled;",
+		"        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;",
+		"        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;",
+		"        doneNP = (!doneN) || (!doneP);",
+		"        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;",
+		"        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;",
+		"/*--------------------------------------------------------------------------*/",
+		"        #if (FXAA_QUALITY_PS > 9)",
+		"        if(doneNP) {",
+		"            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"            doneN = abs(lumaEndN) >= gradientScaled;",
+		"            doneP = abs(lumaEndP) >= gradientScaled;",
+		"            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;",
+		"            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;",
+		"            doneNP = (!doneN) || (!doneP);",
+		"            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;",
+		"            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;",
+		"/*--------------------------------------------------------------------------*/",
+		"            #if (FXAA_QUALITY_PS > 10)",
+		"            if(doneNP) {",
+		"                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                doneN = abs(lumaEndN) >= gradientScaled;",
+		"                doneP = abs(lumaEndP) >= gradientScaled;",
+		"                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;",
+		"                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;",
+		"                doneNP = (!doneN) || (!doneP);",
+		"                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;",
+		"                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;",
+		"/*--------------------------------------------------------------------------*/",
+		"                #if (FXAA_QUALITY_PS > 11)",
+		"                if(doneNP) {",
+		"                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                    doneN = abs(lumaEndN) >= gradientScaled;",
+		"                    doneP = abs(lumaEndP) >= gradientScaled;",
+		"                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;",
+		"                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;",
+		"                    doneNP = (!doneN) || (!doneP);",
+		"                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;",
+		"                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;",
+		"/*--------------------------------------------------------------------------*/",
+		"                    #if (FXAA_QUALITY_PS > 12)",
+		"                    if(doneNP) {",
+		"                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
+		"                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
+		"                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
+		"                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
+		"                        doneN = abs(lumaEndN) >= gradientScaled;",
+		"                        doneP = abs(lumaEndP) >= gradientScaled;",
+		"                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;",
+		"                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;",
+		"                        doneNP = (!doneN) || (!doneP);",
+		"                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;",
+		"                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;",
+		"/*--------------------------------------------------------------------------*/",
+		"                    }",
+		"                    #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"                }",
+		"                #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"            }",
+		"            #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"        }",
+		"        #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"    }",
+		"    #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"                        }",
+		"                        #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"                    }",
+		"                    #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"                }",
+		"                #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"            }",
+		"            #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"        }",
+		"        #endif",
+		"/*--------------------------------------------------------------------------*/",
+		"    }",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat dstN = posM.x - posN.x;",
+		"    FxaaFloat dstP = posP.x - posM.x;",
+		"    if(!horzSpan) dstN = posM.y - posN.y;",
+		"    if(!horzSpan) dstP = posP.y - posM.y;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;",
+		"    FxaaFloat spanLength = (dstP + dstN);",
+		"    FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;",
+		"    FxaaFloat spanLengthRcp = 1.0/spanLength;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaBool directionN = dstN < dstP;",
+		"    FxaaFloat dst = min(dstN, dstP);",
+		"    FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;",
+		"    FxaaFloat subpixG = subpixF * subpixF;",
+		"    FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;",
+		"    FxaaFloat subpixH = subpixG * fxaaQualitySubpix;",
+		"/*--------------------------------------------------------------------------*/",
+		"    FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;",
+		"    FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);",
+		"    if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;",
+		"    if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;",
+		"    #if (FXAA_DISCARD == 1)",
+		"        return FxaaTexTop(tex, posM);",
+		"    #else",
+		"        return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);",
+		"    #endif",
+		"}",
+		"/*==========================================================================*/",
+		"#endif",
+		"",
+		"void main() {",
+		"  gl_FragColor = FxaaPixelShader(",
+		"    vUv,",
+		"    vec4(0.0),",
+		"    tDiffuse,",
+		"    tDiffuse,",
+		"    tDiffuse,",
+		"    resolution,",
+		"    vec4(0.0),",
+		"    vec4(0.0),",
+		"    vec4(0.0),",
+		"    0.75,",
+		"    0.166,",
+		"    0.0833,",
+		"    0.0,",
+		"    0.0,",
+		"    0.0,",
+		"    vec4(0.0)",
+		"  );",
+		"",
+		"  // TODO avoid querying texture twice for same texel",
+		"  gl_FragColor.a = texture2D(tDiffuse, vUv).a;",
+		"}"
+	].join( "\n" )
 
 };
 

+ 7 - 7
examples/jsm/shaders/FilmShader.js

@@ -72,25 +72,25 @@ var FilmShader = {
 
 		"void main() {",
 
-			// sample the source
+		// sample the source
 		"	vec4 cTextureScreen = texture2D( tDiffuse, vUv );",
 
-			// make some noise
+		// make some noise
 		"	float dx = rand( vUv + time );",
 
-			// add noise
+		// add noise
 		"	vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );",
 
-			// get us a sine and cosine
+		// get us a sine and cosine
 		"	vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );",
 
-			// add scanlines
+		// add scanlines
 		"	cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;",
 
-			// interpolate between source and result by intensity
+		// interpolate between source and result by intensity
 		"	cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );",
 
-			// convert to grayscale if desired
+		// convert to grayscale if desired
 		"	if( grayscale ) {",
 
 		"		cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );",

+ 5 - 5
examples/jsm/shaders/HalftoneShader.js

@@ -29,14 +29,14 @@ var HalftoneShader = {
 
 	vertexShader: [
 
-    "varying vec2 vUV;",
+		"varying vec2 vUV;",
 
-    "void main() {",
+		"void main() {",
 
-      "vUV = uv;",
-      "gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);",
+		"	vUV = uv;",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);",
 
-    "}"
+		"}"
 
 	].join( "\n" ),
 

+ 2 - 2
examples/jsm/shaders/HueSaturationShader.js

@@ -45,7 +45,7 @@ var HueSaturationShader = {
 
 		"	gl_FragColor = texture2D( tDiffuse, vUv );",
 
-			// hue
+		// hue
 		"	float angle = hue * 3.14159265;",
 		"	float s = sin(angle), c = cos(angle);",
 		"	vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
@@ -56,7 +56,7 @@ var HueSaturationShader = {
 		"		dot(gl_FragColor.rgb, weights.yzx)",
 		"	);",
 
-			// saturation
+		// saturation
 		"	float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
 		"	if (saturation > 0.0) {",
 		"		gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",

+ 2 - 2
examples/jsm/shaders/LuminosityHighPassShader.js

@@ -35,7 +35,7 @@ var LuminosityHighPassShader = {
 
 		"}"
 
-	].join("\n"),
+	].join( "\n" ),
 
 	fragmentShader: [
 
@@ -63,7 +63,7 @@ var LuminosityHighPassShader = {
 
 		"}"
 
-	].join("\n")
+	].join( "\n" )
 
 };
 

+ 229 - 229
examples/jsm/shaders/OceanShaders.js

@@ -26,18 +26,18 @@ import {
 	Vector2
 } from "../../../build/three.module.js";
 
-var OceanShaders = {}
-OceanShaders[ 'ocean_sim_vertex' ] = {
+var OceanShaders = {};
+OceanShaders[ "ocean_sim_vertex" ] = {
 	vertexShader: [
-		'varying vec2 vUV;',
+		"varying vec2 vUV;",
 
-		'void main (void) {',
-			'vUV = position.xy * 0.5 + 0.5;',
-			'gl_Position = vec4(position, 1.0 );',
-		'}'
-	].join( '\n' )
+		"void main (void) {",
+		"	vUV = position.xy * 0.5 + 0.5;",
+		"	gl_Position = vec4(position, 1.0 );",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_subtransform' ] = {
+OceanShaders[ "ocean_subtransform" ] = {
 	uniforms: {
 		"u_input": { value: null },
 		"u_transformSize": { value: 512.0 },
@@ -46,131 +46,131 @@ OceanShaders[ 'ocean_subtransform' ] = {
 	fragmentShader: [
 		//GPU FFT using a Stockham formulation
 
-		'precision highp float;',
-		'#include <common>',
+		"precision highp float;",
+		"#include <common>",
 
-		'uniform sampler2D u_input;',
-		'uniform float u_transformSize;',
-		'uniform float u_subtransformSize;',
+		"uniform sampler2D u_input;",
+		"uniform float u_transformSize;",
+		"uniform float u_subtransformSize;",
 
-		'varying vec2 vUV;',
+		"varying vec2 vUV;",
 
-		'vec2 multiplyComplex (vec2 a, vec2 b) {',
-			'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);',
-		'}',
+		"vec2 multiplyComplex (vec2 a, vec2 b) {",
+		"	return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);",
+		"}",
 
-		'void main (void) {',
-			'#ifdef HORIZONTAL',
-			'float index = vUV.x * u_transformSize - 0.5;',
-			'#else',
-			'float index = vUV.y * u_transformSize - 0.5;',
-			'#endif',
+		"void main (void) {",
+		"	#ifdef HORIZONTAL",
+		"	float index = vUV.x * u_transformSize - 0.5;",
+		"	#else",
+		"	float index = vUV.y * u_transformSize - 0.5;",
+		"	#endif",
 
-			'float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);',
+		"	float evenIndex = floor(index / u_subtransformSize) * (u_subtransformSize * 0.5) + mod(index, u_subtransformSize * 0.5);",
 
-			//transform two complex sequences simultaneously
-			'#ifdef HORIZONTAL',
-			'vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;',
-			'vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;',
-			'#else',
-			'vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;',
-			'vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;',
-			'#endif',
+		//transform two complex sequences simultaneously
+		"	#ifdef HORIZONTAL",
+		"	vec4 even = texture2D(u_input, vec2(evenIndex + 0.5, gl_FragCoord.y) / u_transformSize).rgba;",
+		"	vec4 odd = texture2D(u_input, vec2(evenIndex + u_transformSize * 0.5 + 0.5, gl_FragCoord.y) / u_transformSize).rgba;",
+		"	#else",
+		"	vec4 even = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + 0.5) / u_transformSize).rgba;",
+		"	vec4 odd = texture2D(u_input, vec2(gl_FragCoord.x, evenIndex + u_transformSize * 0.5 + 0.5) / u_transformSize).rgba;",
+		"	#endif",
 
-			'float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);',
-			'vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));',
+		"	float twiddleArgument = -2.0 * PI * (index / u_subtransformSize);",
+		"	vec2 twiddle = vec2(cos(twiddleArgument), sin(twiddleArgument));",
 
-			'vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);',
-			'vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);',
+		"	vec2 outputA = even.xy + multiplyComplex(twiddle, odd.xy);",
+		"	vec2 outputB = even.zw + multiplyComplex(twiddle, odd.zw);",
 
-			'gl_FragColor = vec4(outputA, outputB);',
-		'}'
-	].join( '\n' )
+		"	gl_FragColor = vec4(outputA, outputB);",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_initial_spectrum' ] = {
+OceanShaders[ "ocean_initial_spectrum" ] = {
 	uniforms: {
 		"u_wind": { value: new Vector2( 10.0, 10.0 ) },
 		"u_resolution": { value: 512.0 },
 		"u_size": { value: 250.0 }
 	},
 	vertexShader: [
-		'void main (void) {',
-			'gl_Position = vec4(position, 1.0);',
-		'}'
-	].join( '\n' ),
+		"void main (void) {",
+		"	gl_Position = vec4(position, 1.0);",
+		"}"
+	].join( "\n" ),
 	fragmentShader: [
-		'precision highp float;',
-		'#include <common>',
+		"precision highp float;",
+		"#include <common>",
 
-		'const float G = 9.81;',
-		'const float KM = 370.0;',
-		'const float CM = 0.23;',
+		"const float G = 9.81;",
+		"const float KM = 370.0;",
+		"const float CM = 0.23;",
 
-		'uniform vec2 u_wind;',
-		'uniform float u_resolution;',
-		'uniform float u_size;',
+		"uniform vec2 u_wind;",
+		"uniform float u_resolution;",
+		"uniform float u_size;",
 
-		'float omega (float k) {',
-			'return sqrt(G * k * (1.0 + pow2(k / KM)));',
-		'}',
+		"float omega (float k) {",
+		"	return sqrt(G * k * (1.0 + pow2(k / KM)));",
+		"}",
 
-		'#if __VERSION__ == 100',
-		'float tanh (float x) {',
-			'return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));',
-		'}',
-		'#endif',
+		"#if __VERSION__ == 100",
+		"float tanh (float x) {",
+		"	return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));",
+		"}",
+		"#endif",
 
-		'void main (void) {',
-			'vec2 coordinates = gl_FragCoord.xy - 0.5;',
+		"void main (void) {",
+		"	vec2 coordinates = gl_FragCoord.xy - 0.5;",
 
-			'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;',
-			'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;',
+		"	float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;",
+		"	float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;",
 
-			'vec2 K = (2.0 * PI * vec2(n, m)) / u_size;',
-			'float k = length(K);',
+		"	vec2 K = (2.0 * PI * vec2(n, m)) / u_size;",
+		"	float k = length(K);",
 
-			'float l_wind = length(u_wind);',
+		"	float l_wind = length(u_wind);",
 
-			'float Omega = 0.84;',
-			'float kp = G * pow2(Omega / l_wind);',
+		"	float Omega = 0.84;",
+		"	float kp = G * pow2(Omega / l_wind);",
 
-			'float c = omega(k) / k;',
-			'float cp = omega(kp) / kp;',
+		"	float c = omega(k) / k;",
+		"	float cp = omega(kp) / kp;",
 
-			'float Lpm = exp(-1.25 * pow2(kp / k));',
-			'float gamma = 1.7;',
-			'float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));',
-			'float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));',
-			'float Jp = pow(gamma, Gamma);',
-			'float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));',
-			'float alphap = 0.006 * sqrt(Omega);',
-			'float Bl = 0.5 * alphap * cp / c * Fp;',
+		"	float Lpm = exp(-1.25 * pow2(kp / k));",
+		"	float gamma = 1.7;",
+		"	float sigma = 0.08 * (1.0 + 4.0 * pow(Omega, -3.0));",
+		"	float Gamma = exp(-pow2(sqrt(k / kp) - 1.0) / 2.0 * pow2(sigma));",
+		"	float Jp = pow(gamma, Gamma);",
+		"	float Fp = Lpm * Jp * exp(-Omega / sqrt(10.0) * (sqrt(k / kp) - 1.0));",
+		"	float alphap = 0.006 * sqrt(Omega);",
+		"	float Bl = 0.5 * alphap * cp / c * Fp;",
 
-			'float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);',
-			'float uStar = 0.41 * l_wind / log(10.0 / z0);',
-			'float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));',
-			'float Fm = exp(-0.25 * pow2(k / KM - 1.0));',
-			'float Bh = 0.5 * alpham * CM / c * Fm * Lpm;',
+		"	float z0 = 0.000037 * pow2(l_wind) / G * pow(l_wind / cp, 0.9);",
+		"	float uStar = 0.41 * l_wind / log(10.0 / z0);",
+		"	float alpham = 0.01 * ((uStar < CM) ? (1.0 + log(uStar / CM)) : (1.0 + 3.0 * log(uStar / CM)));",
+		"	float Fm = exp(-0.25 * pow2(k / KM - 1.0));",
+		"	float Bh = 0.5 * alpham * CM / c * Fm * Lpm;",
 
-			'float a0 = log(2.0) / 4.0;',
-			'float am = 0.13 * uStar / CM;',
-			'float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));',
+		"	float a0 = log(2.0) / 4.0;",
+		"	float am = 0.13 * uStar / CM;",
+		"	float Delta = tanh(a0 + 4.0 * pow(c / cp, 2.5) + am * pow(CM / c, 2.5));",
 
-			'float cosPhi = dot(normalize(u_wind), normalize(K));',
+		"	float cosPhi = dot(normalize(u_wind), normalize(K));",
 
-			'float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));',
+		"	float S = (1.0 / (2.0 * PI)) * pow(k, -4.0) * (Bl + Bh) * (1.0 + Delta * (2.0 * cosPhi * cosPhi - 1.0));",
 
-			'float dk = 2.0 * PI / u_size;',
-			'float h = sqrt(S / 2.0) * dk;',
+		"	float dk = 2.0 * PI / u_size;",
+		"	float h = sqrt(S / 2.0) * dk;",
 
-			'if (K.x == 0.0 && K.y == 0.0) {',
-				'h = 0.0;', //no DC term
-			'}',
-			'gl_FragColor = vec4(h, 0.0, 0.0, 0.0);',
-		'}'
-	].join( '\n' )
+		"	if (K.x == 0.0 && K.y == 0.0) {",
+		"		h = 0.0;", //no DC term
+		"	}",
+		"	gl_FragColor = vec4(h, 0.0, 0.0, 0.0);",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_phase' ] = {
+OceanShaders[ "ocean_phase" ] = {
 	uniforms: {
 		"u_phases": { value: null },
 		"u_deltaTime": { value: null },
@@ -178,39 +178,39 @@ OceanShaders[ 'ocean_phase' ] = {
 		"u_size": { value: null }
 	},
 	fragmentShader: [
-		'precision highp float;',
-		'#include <common>',
+		"precision highp float;",
+		"#include <common>",
 
-		'const float G = 9.81;',
-		'const float KM = 370.0;',
+		"const float G = 9.81;",
+		"const float KM = 370.0;",
 
-		'varying vec2 vUV;',
+		"varying vec2 vUV;",
 
-		'uniform sampler2D u_phases;',
-		'uniform float u_deltaTime;',
-		'uniform float u_resolution;',
-		'uniform float u_size;',
+		"uniform sampler2D u_phases;",
+		"uniform float u_deltaTime;",
+		"uniform float u_resolution;",
+		"uniform float u_size;",
 
-		'float omega (float k) {',
-			'return sqrt(G * k * (1.0 + k * k / KM * KM));',
-		'}',
+		"float omega (float k) {",
+		"	return sqrt(G * k * (1.0 + k * k / KM * KM));",
+		"}",
 
-		'void main (void) {',
-			'float deltaTime = 1.0 / 60.0;',
-			'vec2 coordinates = gl_FragCoord.xy - 0.5;',
-			'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;',
-			'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;',
-			'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;',
+		"void main (void) {",
+		"	float deltaTime = 1.0 / 60.0;",
+		"	vec2 coordinates = gl_FragCoord.xy - 0.5;",
+		"	float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;",
+		"	float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;",
+		"	vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;",
 
-			'float phase = texture2D(u_phases, vUV).r;',
-			'float deltaPhase = omega(length(waveVector)) * u_deltaTime;',
-			'phase = mod(phase + deltaPhase, 2.0 * PI);',
+		"	float phase = texture2D(u_phases, vUV).r;",
+		"	float deltaPhase = omega(length(waveVector)) * u_deltaTime;",
+		"	phase = mod(phase + deltaPhase, 2.0 * PI);",
 
-			'gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);',
-		'}'
-	].join( '\n' )
+		"	gl_FragColor = vec4(phase, 0.0, 0.0, 0.0);",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_spectrum' ] = {
+OceanShaders[ "ocean_spectrum" ] = {
 	uniforms: {
 		"u_size": { value: null },
 		"u_resolution": { value: null },
@@ -219,96 +219,96 @@ OceanShaders[ 'ocean_spectrum' ] = {
 		"u_initialSpectrum": { value: null }
 	},
 	fragmentShader: [
-		'precision highp float;',
-		'#include <common>',
+		"precision highp float;",
+		"#include <common>",
 
-		'const float G = 9.81;',
-		'const float KM = 370.0;',
+		"const float G = 9.81;",
+		"const float KM = 370.0;",
 
-		'varying vec2 vUV;',
+		"varying vec2 vUV;",
 
-		'uniform float u_size;',
-		'uniform float u_resolution;',
-		'uniform float u_choppiness;',
-		'uniform sampler2D u_phases;',
-		'uniform sampler2D u_initialSpectrum;',
+		"uniform float u_size;",
+		"uniform float u_resolution;",
+		"uniform float u_choppiness;",
+		"uniform sampler2D u_phases;",
+		"uniform sampler2D u_initialSpectrum;",
 
-		'vec2 multiplyComplex (vec2 a, vec2 b) {',
-			'return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);',
-		'}',
+		"vec2 multiplyComplex (vec2 a, vec2 b) {",
+		"	return vec2(a[0] * b[0] - a[1] * b[1], a[1] * b[0] + a[0] * b[1]);",
+		"}",
 
-		'vec2 multiplyByI (vec2 z) {',
-			'return vec2(-z[1], z[0]);',
-		'}',
+		"vec2 multiplyByI (vec2 z) {",
+		"	return vec2(-z[1], z[0]);",
+		"}",
 
-		'float omega (float k) {',
-			'return sqrt(G * k * (1.0 + k * k / KM * KM));',
-		'}',
+		"float omega (float k) {",
+		"	return sqrt(G * k * (1.0 + k * k / KM * KM));",
+		"}",
 
-		'void main (void) {',
-			'vec2 coordinates = gl_FragCoord.xy - 0.5;',
-			'float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;',
-			'float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;',
-			'vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;',
+		"void main (void) {",
+		"	vec2 coordinates = gl_FragCoord.xy - 0.5;",
+		"	float n = (coordinates.x < u_resolution * 0.5) ? coordinates.x : coordinates.x - u_resolution;",
+		"	float m = (coordinates.y < u_resolution * 0.5) ? coordinates.y : coordinates.y - u_resolution;",
+		"	vec2 waveVector = (2.0 * PI * vec2(n, m)) / u_size;",
 
-			'float phase = texture2D(u_phases, vUV).r;',
-			'vec2 phaseVector = vec2(cos(phase), sin(phase));',
+		"	float phase = texture2D(u_phases, vUV).r;",
+		"	vec2 phaseVector = vec2(cos(phase), sin(phase));",
 
-			'vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;',
-			'vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;',
-			'h0Star.y *= -1.0;',
+		"	vec2 h0 = texture2D(u_initialSpectrum, vUV).rg;",
+		"	vec2 h0Star = texture2D(u_initialSpectrum, vec2(1.0 - vUV + 1.0 / u_resolution)).rg;",
+		"	h0Star.y *= -1.0;",
 
-			'vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));',
+		"	vec2 h = multiplyComplex(h0, phaseVector) + multiplyComplex(h0Star, vec2(phaseVector.x, -phaseVector.y));",
 
-			'vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;',
-			'vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;',
+		"	vec2 hX = -multiplyByI(h * (waveVector.x / length(waveVector))) * u_choppiness;",
+		"	vec2 hZ = -multiplyByI(h * (waveVector.y / length(waveVector))) * u_choppiness;",
 
-			//no DC term
-			'if (waveVector.x == 0.0 && waveVector.y == 0.0) {',
-				'h = vec2(0.0);',
-				'hX = vec2(0.0);',
-				'hZ = vec2(0.0);',
-			'}',
+		//no DC term
+		"	if (waveVector.x == 0.0 && waveVector.y == 0.0) {",
+		"		h = vec2(0.0);",
+		"		hX = vec2(0.0);",
+		"		hZ = vec2(0.0);",
+		"	}",
 
-			'gl_FragColor = vec4(hX + multiplyByI(h), hZ);',
-		'}'
-	].join( '\n' )
+		"	gl_FragColor = vec4(hX + multiplyByI(h), hZ);",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_normals' ] = {
+OceanShaders[ "ocean_normals" ] = {
 	uniforms: {
 		"u_displacementMap": { value: null },
 		"u_resolution": { value: null },
 		"u_size": { value: null }
 	},
 	fragmentShader: [
-		'precision highp float;',
+		"precision highp float;",
 
-		'varying vec2 vUV;',
+		"varying vec2 vUV;",
 
-		'uniform sampler2D u_displacementMap;',
-		'uniform float u_resolution;',
-		'uniform float u_size;',
+		"uniform sampler2D u_displacementMap;",
+		"uniform float u_resolution;",
+		"uniform float u_size;",
 
-		'void main (void) {',
-			'float texel = 1.0 / u_resolution;',
-			'float texelSize = u_size / u_resolution;',
+		"void main (void) {",
+		"	float texel = 1.0 / u_resolution;",
+		"	float texelSize = u_size / u_resolution;",
 
-			'vec3 center = texture2D(u_displacementMap, vUV).rgb;',
-			'vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;',
-			'vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;',
-			'vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;',
-			'vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;',
+		"	vec3 center = texture2D(u_displacementMap, vUV).rgb;",
+		"	vec3 right = vec3(texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(texel, 0.0)).rgb - center;",
+		"	vec3 left = vec3(-texelSize, 0.0, 0.0) + texture2D(u_displacementMap, vUV + vec2(-texel, 0.0)).rgb - center;",
+		"	vec3 top = vec3(0.0, 0.0, -texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, -texel)).rgb - center;",
+		"	vec3 bottom = vec3(0.0, 0.0, texelSize) + texture2D(u_displacementMap, vUV + vec2(0.0, texel)).rgb - center;",
 
-			'vec3 topRight = cross(right, top);',
-			'vec3 topLeft = cross(top, left);',
-			'vec3 bottomLeft = cross(left, bottom);',
-			'vec3 bottomRight = cross(bottom, right);',
+		"	vec3 topRight = cross(right, top);",
+		"	vec3 topLeft = cross(top, left);",
+		"	vec3 bottomLeft = cross(left, bottom);",
+		"	vec3 bottomRight = cross(bottom, right);",
 
-			'gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);',
-		'}'
-	].join( '\n' )
+		"	gl_FragColor = vec4(normalize(topRight + topLeft + bottomLeft + bottomRight), 1.0);",
+		"}"
+	].join( "\n" )
 };
-OceanShaders[ 'ocean_main' ] = {
+OceanShaders[ "ocean_main" ] = {
 	uniforms: {
 		"u_displacementMap": { value: null },
 		"u_normalMap": { value: null },
@@ -323,57 +323,57 @@ OceanShaders[ 'ocean_main' ] = {
 		"u_exposure": { value: null }
 	},
 	vertexShader: [
-		'precision highp float;',
-
-		'varying vec3 vPos;',
-		'varying vec2 vUV;',
-
-		'uniform mat4 u_projectionMatrix;',
-		'uniform mat4 u_viewMatrix;',
-		'uniform float u_size;',
-		'uniform float u_geometrySize;',
-		'uniform sampler2D u_displacementMap;',
-
-		'void main (void) {',
-			'vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);',
-			'vPos = newPos;',
-			'vUV = uv;',
-			'gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);',
-		'}'
-	].join( '\n' ),
+		"precision highp float;",
+
+		"varying vec3 vPos;",
+		"varying vec2 vUV;",
+
+		"uniform mat4 u_projectionMatrix;",
+		"uniform mat4 u_viewMatrix;",
+		"uniform float u_size;",
+		"uniform float u_geometrySize;",
+		"uniform sampler2D u_displacementMap;",
+
+		"void main (void) {",
+		"	vec3 newPos = position + texture2D(u_displacementMap, uv).rgb * (u_geometrySize / u_size);",
+		"	vPos = newPos;",
+		"	vUV = uv;",
+		"	gl_Position = u_projectionMatrix * u_viewMatrix * vec4(newPos, 1.0);",
+		"}"
+	].join( "\n" ),
 	fragmentShader: [
-		'precision highp float;',
+		"precision highp float;",
 
-		'varying vec3 vPos;',
-		'varying vec2 vUV;',
+		"varying vec3 vPos;",
+		"varying vec2 vUV;",
 
-		'uniform sampler2D u_displacementMap;',
-		'uniform sampler2D u_normalMap;',
-		'uniform vec3 u_cameraPosition;',
-		'uniform vec3 u_oceanColor;',
-		'uniform vec3 u_skyColor;',
-		'uniform vec3 u_sunDirection;',
-		'uniform float u_exposure;',
+		"uniform sampler2D u_displacementMap;",
+		"uniform sampler2D u_normalMap;",
+		"uniform vec3 u_cameraPosition;",
+		"uniform vec3 u_oceanColor;",
+		"uniform vec3 u_skyColor;",
+		"uniform vec3 u_sunDirection;",
+		"uniform float u_exposure;",
 
-		'vec3 hdr (vec3 color, float exposure) {',
-			'return 1.0 - exp(-color * exposure);',
-		'}',
+		"vec3 hdr (vec3 color, float exposure) {",
+		"	return 1.0 - exp(-color * exposure);",
+		"}",
 
-		'void main (void) {',
-			'vec3 normal = texture2D(u_normalMap, vUV).rgb;',
+		"void main (void) {",
+		"	vec3 normal = texture2D(u_normalMap, vUV).rgb;",
 
-			'vec3 view = normalize(u_cameraPosition - vPos);',
-			'float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);',
-			'vec3 sky = fresnel * u_skyColor;',
+		"	vec3 view = normalize(u_cameraPosition - vPos);",
+		"	float fresnel = 0.02 + 0.98 * pow(1.0 - dot(normal, view), 5.0);",
+		"	vec3 sky = fresnel * u_skyColor;",
 
-			'float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);',
-			'vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;',
+		"	float diffuse = clamp(dot(normal, normalize(u_sunDirection)), 0.0, 1.0);",
+		"	vec3 water = (1.0 - fresnel) * u_oceanColor * u_skyColor * diffuse;",
 
-			'vec3 color = sky + water;',
+		"	vec3 color = sky + water;",
 
-			'gl_FragColor = vec4(hdr(color, u_exposure), 1.0);',
-		'}'
-	].join( '\n' )
+		"	gl_FragColor = vec4(hdr(color, u_exposure), 1.0);",
+		"}"
+	].join( "\n" )
 };
 
 export { OceanShaders };

+ 22 - 22
examples/jsm/shaders/ParallaxShader.js

@@ -6,11 +6,11 @@
 var ParallaxShader = {
 	// Ordered from fastest to best quality.
 	modes: {
-		none:  'NO_PARALLAX',
-		basic: 'USE_BASIC_PARALLAX',
-		steep: 'USE_STEEP_PARALLAX',
-		occlusion: 'USE_OCLUSION_PARALLAX', // a.k.a. POM
-		relief: 'USE_RELIEF_PARALLAX'
+		none: "NO_PARALLAX",
+		basic: "USE_BASIC_PARALLAX",
+		steep: "USE_STEEP_PARALLAX",
+		occlusion: "USE_OCLUSION_PARALLAX", // a.k.a. POM
+		relief: "USE_RELIEF_PARALLAX"
 	},
 
 	uniforms: {
@@ -36,7 +36,7 @@ var ParallaxShader = {
 
 		"}"
 
-  ].join( "\n" ),
+	].join( "\n" ),
 
 	fragmentShader: [
 		"uniform sampler2D bumpMap;",
@@ -56,10 +56,10 @@ var ParallaxShader = {
 
 		"		float initialHeight = texture2D( bumpMap, vUv ).r;",
 
-				// No Offset Limitting: messy, floating output at grazing angles.
-				//"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;",
+		// No Offset Limitting: messy, floating output at grazing angles.
+		//"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;",
 
-				// Offset Limiting
+		// Offset Limiting
 		"		vec2 texCoordOffset = parallaxScale * V.xy * initialHeight;",
 		"		return vUv - texCoordOffset;",
 
@@ -69,27 +69,27 @@ var ParallaxShader = {
 
 		"	vec2 parallaxMap( in vec3 V ) {",
 
-				// Determine number of layers from angle between V and N
+		// Determine number of layers from angle between V and N
 		"		float numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );",
 
 		"		float layerHeight = 1.0 / numLayers;",
 		"		float currentLayerHeight = 0.0;",
-				// Shift of texture coordinates for each iteration
+		// Shift of texture coordinates for each iteration
 		"		vec2 dtex = parallaxScale * V.xy / V.z / numLayers;",
 
 		"		vec2 currentTextureCoords = vUv;",
 
 		"		float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 
-				// while ( heightFromTexture > currentLayerHeight )
-				// Infinite loops are not well supported. Do a "large" finite
-				// loop, but not too large, as it slows down some compilers.
+		// while ( heightFromTexture > currentLayerHeight )
+		// Infinite loops are not well supported. Do a "large" finite
+		// loop, but not too large, as it slows down some compilers.
 		"		for ( int i = 0; i < 30; i += 1 ) {",
 		"			if ( heightFromTexture <= currentLayerHeight ) {",
 		"				break;",
 		"			}",
 		"			currentLayerHeight += layerHeight;",
-					// Shift texture coordinates along vector V
+		// Shift texture coordinates along vector V
 		"			currentTextureCoords -= dtex;",
 		"			heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 		"		}",
@@ -103,18 +103,18 @@ var ParallaxShader = {
 		"			vec2 deltaTexCoord = dtex / 2.0;",
 		"			float deltaHeight = layerHeight / 2.0;",
 
-					// Return to the mid point of previous layer
+		// Return to the mid point of previous layer
 		"			currentTextureCoords += deltaTexCoord;",
 		"			currentLayerHeight -= deltaHeight;",
 
-					// Binary search to increase precision of Steep Parallax Mapping
+		// Binary search to increase precision of Steep Parallax Mapping
 		"			const int numSearches = 5;",
 		"			for ( int i = 0; i < numSearches; i += 1 ) {",
 
 		"				deltaTexCoord /= 2.0;",
 		"				deltaHeight /= 2.0;",
 		"				heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
-						// Shift along or against vector V
+		// Shift along or against vector V
 		"				if( heightFromTexture > currentLayerHeight ) {", // Below the surface
 
 		"					currentTextureCoords -= deltaTexCoord;",
@@ -134,14 +134,14 @@ var ParallaxShader = {
 
 		"			vec2 prevTCoords = currentTextureCoords + dtex;",
 
-					// Heights for linear interpolation
+		// Heights for linear interpolation
 		"			float nextH = heightFromTexture - currentLayerHeight;",
 		"			float prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;",
 
-					// Proportions for linear interpolation
+		// Proportions for linear interpolation
 		"			float weight = nextH / ( nextH - prevH );",
 
-					// Interpolation of texture coordinates
+		// Interpolation of texture coordinates
 		"			return prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );",
 
 		"		#else", // NO_PARALLAX
@@ -179,7 +179,7 @@ var ParallaxShader = {
 
 		"}"
 
-  ].join( "\n" )
+	].join( "\n" )
 
 };
 

+ 20 - 20
examples/jsm/shaders/SAOShader.js

@@ -9,32 +9,32 @@ import {
 
 var SAOShader = {
 	defines: {
-		'NUM_SAMPLES': 7,
-		'NUM_RINGS': 4,
-		'NORMAL_TEXTURE': 0,
-		'DIFFUSE_TEXTURE': 0,
-		'DEPTH_PACKING': 1,
-		'PERSPECTIVE_CAMERA': 1
+		"NUM_SAMPLES": 7,
+		"NUM_RINGS": 4,
+		"NORMAL_TEXTURE": 0,
+		"DIFFUSE_TEXTURE": 0,
+		"DEPTH_PACKING": 1,
+		"PERSPECTIVE_CAMERA": 1
 	},
 	uniforms: {
 
-		'tDepth': { value: null },
-		'tDiffuse': { value: null },
-		'tNormal': { value: null },
-		'size': { value: new Vector2( 512, 512 ) },
+		"tDepth": { value: null },
+		"tDiffuse": { value: null },
+		"tNormal": { value: null },
+		"size": { value: new Vector2( 512, 512 ) },
 
-		'cameraNear': { value: 1 },
-		'cameraFar': { value: 100 },
-		'cameraProjectionMatrix': { value: new Matrix4() },
-		'cameraInverseProjectionMatrix': { value: new Matrix4() },
+		"cameraNear": { value: 1 },
+		"cameraFar": { value: 100 },
+		"cameraProjectionMatrix": { value: new Matrix4() },
+		"cameraInverseProjectionMatrix": { value: new Matrix4() },
 
-		'scale': { value: 1.0 },
-		'intensity': { value: 0.1 },
-		'bias': { value: 0.5 },
+		"scale": { value: 1.0 },
+		"intensity": { value: 0.1 },
+		"bias": { value: 0.5 },
 
-		'minResolution': { value: 0.0 },
-		'kernelRadius': { value: 100.0 },
-		'randomSeed': { value: 0.0 }
+		"minResolution": { value: 0.0 },
+		"kernelRadius": { value: 100.0 },
+		"randomSeed": { value: 0.0 }
 	},
 	vertexShader: [
 		"varying vec2 vUv;",

+ 212 - 212
examples/jsm/shaders/SMAAShader.js

@@ -33,18 +33,18 @@ var SMAAEdgesShader = {
 		"varying vec4 vOffset[ 3 ];",
 
 		"void SMAAEdgeDetectionVS( vec2 texcoord ) {",
-			"vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0,  1.0 );", // WebGL port note: Changed sign in W component
-			"vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4(  1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component
-			"vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0,  2.0 );", // WebGL port note: Changed sign in W component
+		"	vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0,  1.0 );", // WebGL port note: Changed sign in W component
+		"	vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4(  1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component
+		"	vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0,  2.0 );", // WebGL port note: Changed sign in W component
 		"}",
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"SMAAEdgeDetectionVS( vUv );",
+		"	SMAAEdgeDetectionVS( vUv );",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -58,60 +58,60 @@ var SMAAEdgesShader = {
 		"varying vec4 vOffset[ 3 ];",
 
 		"vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {",
-			"vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );",
+		"	vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );",
 
-			// Calculate color deltas:
-			"vec4 delta;",
-			"vec3 C = texture2D( colorTex, texcoord ).rgb;",
+		// Calculate color deltas:
+		"	vec4 delta;",
+		"	vec3 C = texture2D( colorTex, texcoord ).rgb;",
 
-			"vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;",
-			"vec3 t = abs( C - Cleft );",
-			"delta.x = max( max( t.r, t.g ), t.b );",
+		"	vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;",
+		"	vec3 t = abs( C - Cleft );",
+		"	delta.x = max( max( t.r, t.g ), t.b );",
 
-			"vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;",
-			"t = abs( C - Ctop );",
-			"delta.y = max( max( t.r, t.g ), t.b );",
+		"	vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;",
+		"	t = abs( C - Ctop );",
+		"	delta.y = max( max( t.r, t.g ), t.b );",
 
-			// We do the usual threshold:
-			"vec2 edges = step( threshold, delta.xy );",
+		// We do the usual threshold:
+		"	vec2 edges = step( threshold, delta.xy );",
 
-			// Then discard if there is no edge:
-			"if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )",
-				"discard;",
+		// Then discard if there is no edge:
+		"	if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )",
+		"		discard;",
 
-			// Calculate right and bottom deltas:
-			"vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;",
-			"t = abs( C - Cright );",
-			"delta.z = max( max( t.r, t.g ), t.b );",
+		// Calculate right and bottom deltas:
+		"	vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;",
+		"	t = abs( C - Cright );",
+		"	delta.z = max( max( t.r, t.g ), t.b );",
 
-			"vec3 Cbottom  = texture2D( colorTex, offset[1].zw ).rgb;",
-			"t = abs( C - Cbottom );",
-			"delta.w = max( max( t.r, t.g ), t.b );",
+		"	vec3 Cbottom  = texture2D( colorTex, offset[1].zw ).rgb;",
+		"	t = abs( C - Cbottom );",
+		"	delta.w = max( max( t.r, t.g ), t.b );",
 
-			// Calculate the maximum delta in the direct neighborhood:
-			"float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );",
+		// Calculate the maximum delta in the direct neighborhood:
+		"	float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );",
 
-			// Calculate left-left and top-top deltas:
-			"vec3 Cleftleft  = texture2D( colorTex, offset[2].xy ).rgb;",
-			"t = abs( C - Cleftleft );",
-			"delta.z = max( max( t.r, t.g ), t.b );",
+		// Calculate left-left and top-top deltas:
+		"	vec3 Cleftleft  = texture2D( colorTex, offset[2].xy ).rgb;",
+		"	t = abs( C - Cleftleft );",
+		"	delta.z = max( max( t.r, t.g ), t.b );",
 
-			"vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;",
-			"t = abs( C - Ctoptop );",
-			"delta.w = max( max( t.r, t.g ), t.b );",
+		"	vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;",
+		"	t = abs( C - Ctoptop );",
+		"	delta.w = max( max( t.r, t.g ), t.b );",
 
-			// Calculate the final maximum delta:
-			"maxDelta = max( max( maxDelta, delta.z ), delta.w );",
+		// Calculate the final maximum delta:
+		"	maxDelta = max( max( maxDelta, delta.z ), delta.w );",
 
-			// Local contrast adaptation in action:
-			"edges.xy *= step( 0.5 * maxDelta, delta.xy );",
+		// Local contrast adaptation in action:
+		"	edges.xy *= step( 0.5 * maxDelta, delta.xy );",
 
-			"return vec4( edges, 0.0, 0.0 );",
+		"	return vec4( edges, 0.0, 0.0 );",
 		"}",
 
 		"void main() {",
 
-			"gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );",
+		"	gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );",
 
 		"}"
 
@@ -148,24 +148,24 @@ var SMAAWeightsShader = {
 		"varying vec2 vPixcoord;",
 
 		"void SMAABlendingWeightCalculationVS( vec2 texcoord ) {",
-			"vPixcoord = texcoord / resolution;",
+		"	vPixcoord = texcoord / resolution;",
 
-			// We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
-			"vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components
-			"vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components
+		// We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
+		"	vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );", // WebGL port note: Changed sign in Y and W components
+		"	vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );", // WebGL port note: Changed sign in Y and W components
 
-			// And these for the searches, they indicate the ends of the loops:
-			"vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );",
+		// And these for the searches, they indicate the ends of the loops:
+		"	vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );",
 
 		"}",
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"SMAABlendingWeightCalculationVS( vUv );",
+		"	SMAABlendingWeightCalculationVS( vUv );",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -186,190 +186,190 @@ var SMAAWeightsShader = {
 
 		"#if __VERSION__ == 100",
 		"vec2 round( vec2 x ) {",
-			"return sign( x ) * floor( abs( x ) + 0.5 );",
+		"	return sign( x ) * floor( abs( x ) + 0.5 );",
 		"}",
 		"#endif",
 
 		"float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {",
-			// Not required if searchTex accesses are set to point:
-			// float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
-			// e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
-			//     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
-			"e.r = bias + e.r * scale;",
-			"return 255.0 * texture2D( searchTex, e, 0.0 ).r;",
+		// Not required if searchTex accesses are set to point:
+		// float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
+		// e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
+		//     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
+		"	e.r = bias + e.r * scale;",
+		"	return 255.0 * texture2D( searchTex, e, 0.0 ).r;",
 		"}",
 
 		"float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {",
-			/**
+		/**
 			* @PSEUDO_GATHER4
 			* This texcoord has been offset by (-0.25, -0.125) in the vertex shader to
 			* sample between edge, thus fetching four edges in a row.
 			* Sampling with different offsets in each direction allows to disambiguate
 			* which edges are active from the four fetched ones.
 			*/
-			"vec2 e = vec2( 0.0, 1.0 );",
+		"	vec2 e = vec2( 0.0, 1.0 );",
 
-			"for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
-				"e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
-				"texcoord -= vec2( 2.0, 0.0 ) * resolution;",
-				"if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;",
-			"}",
+		"	for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
+		"		e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
+		"		texcoord -= vec2( 2.0, 0.0 ) * resolution;",
+		"		if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;",
+		"	}",
 
-			// We correct the previous (-0.25, -0.125) offset we applied:
-			"texcoord.x += 0.25 * resolution.x;",
+		// We correct the previous (-0.25, -0.125) offset we applied:
+		"	texcoord.x += 0.25 * resolution.x;",
 
-			// The searches are bias by 1, so adjust the coords accordingly:
-			"texcoord.x += resolution.x;",
+		// The searches are bias by 1, so adjust the coords accordingly:
+		"	texcoord.x += resolution.x;",
 
-			// Disambiguate the length added by the last step:
-			"texcoord.x += 2.0 * resolution.x;", // Undo last step
-			"texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);",
+		// Disambiguate the length added by the last step:
+		"	texcoord.x += 2.0 * resolution.x;", // Undo last step
+		"	texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);",
 
-			"return texcoord.x;",
+		"	return texcoord.x;",
 		"}",
 
 		"float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {",
-			"vec2 e = vec2( 0.0, 1.0 );",
+		"	vec2 e = vec2( 0.0, 1.0 );",
 
-			"for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
-				"e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
-				"texcoord += vec2( 2.0, 0.0 ) * resolution;",
-				"if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;",
-			"}",
+		"	for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
+		"		e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
+		"		texcoord += vec2( 2.0, 0.0 ) * resolution;",
+		"		if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;",
+		"	}",
 
-			"texcoord.x -= 0.25 * resolution.x;",
-			"texcoord.x -= resolution.x;",
-			"texcoord.x -= 2.0 * resolution.x;",
-			"texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );",
+		"	texcoord.x -= 0.25 * resolution.x;",
+		"	texcoord.x -= resolution.x;",
+		"	texcoord.x -= 2.0 * resolution.x;",
+		"	texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );",
 
-			"return texcoord.x;",
+		"	return texcoord.x;",
 		"}",
 
 		"float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {",
-			"vec2 e = vec2( 1.0, 0.0 );",
+		"	vec2 e = vec2( 1.0, 0.0 );",
 
-			"for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
-				"e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
-				"texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign
-				"if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;",
-			"}",
+		"	for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
+		"		e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
+		"		texcoord += vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign
+		"		if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;",
+		"	}",
 
-			"texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y -= resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign
+		"	texcoord.y -= 0.25 * resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y -= resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y -= 2.0 * resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );", // WebGL port note: Changed sign
 
-			"return texcoord.y;",
+		"	return texcoord.y;",
 		"}",
 
 		"float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {",
-			"vec2 e = vec2( 1.0, 0.0 );",
+		"	vec2 e = vec2( 1.0, 0.0 );",
 
-			"for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
-				"e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
-				"texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign
-				"if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;",
-			"}",
+		"	for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {", // WebGL port note: Changed while to for
+		"		e = texture2D( edgesTex, texcoord, 0.0 ).rg;",
+		"		texcoord -= vec2( 0.0, 2.0 ) * resolution;", // WebGL port note: Changed sign
+		"		if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;",
+		"	}",
 
-			"texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y += resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign
-			"texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign
+		"	texcoord.y += 0.25 * resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y += resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y += 2.0 * resolution.y;", // WebGL port note: Changed sign
+		"	texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );", // WebGL port note: Changed sign
 
-			"return texcoord.y;",
+		"	return texcoord.y;",
 		"}",
 
 		"vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {",
-			// Rounding prevents precision errors of bilinear filtering:
-			"vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;",
+		// Rounding prevents precision errors of bilinear filtering:
+		"	vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;",
 
-			// We do a scale and bias for mapping to texel space:
-			"texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );",
+		// We do a scale and bias for mapping to texel space:
+		"	texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );",
 
-			// Move to proper place, according to the subpixel offset:
-			"texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;",
+		// Move to proper place, according to the subpixel offset:
+		"	texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;",
 
-			"return texture2D( areaTex, texcoord, 0.0 ).rg;",
+		"	return texture2D( areaTex, texcoord, 0.0 ).rg;",
 		"}",
 
 		"vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {",
-			"vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );",
+		"	vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );",
 
-			"vec2 e = texture2D( edgesTex, texcoord ).rg;",
+		"	vec2 e = texture2D( edgesTex, texcoord ).rg;",
 
-			"if ( e.g > 0.0 ) {", // Edge at north
-				"vec2 d;",
+		"	if ( e.g > 0.0 ) {", // Edge at north
+		"		vec2 d;",
 
-				// Find the distance to the left:
-				"vec2 coords;",
-				"coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );",
-				"coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)
-				"d.x = coords.x;",
+		// Find the distance to the left:
+		"		vec2 coords;",
+		"		coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );",
+		"		coords.y = offset[ 1 ].y;", // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)
+		"		d.x = coords.x;",
 
-				// Now fetch the left crossing edges, two at a time using bilinear
-				// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
-				// discern what value each edge has:
-				"float e1 = texture2D( edgesTex, coords, 0.0 ).r;",
+		// Now fetch the left crossing edges, two at a time using bilinear
+		// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
+		// discern what value each edge has:
+		"		float e1 = texture2D( edgesTex, coords, 0.0 ).r;",
 
-				// Find the distance to the right:
-				"coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );",
-				"d.y = coords.x;",
+		// Find the distance to the right:
+		"		coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );",
+		"		d.y = coords.x;",
 
-				// We want the distances to be in pixel units (doing this here allow to
-				// better interleave arithmetic and memory accesses):
-				"d = d / resolution.x - pixcoord.x;",
+		// We want the distances to be in pixel units (doing this here allow to
+		// better interleave arithmetic and memory accesses):
+		"		d = d / resolution.x - pixcoord.x;",
 
-				// SMAAArea below needs a sqrt, as the areas texture is compressed
-				// quadratically:
-				"vec2 sqrt_d = sqrt( abs( d ) );",
+		// SMAAArea below needs a sqrt, as the areas texture is compressed
+		// quadratically:
+		"		vec2 sqrt_d = sqrt( abs( d ) );",
 
-				// Fetch the right crossing edges:
-				"coords.y -= 1.0 * resolution.y;", // WebGL port note: Added
-				"float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;",
+		// Fetch the right crossing edges:
+		"		coords.y -= 1.0 * resolution.y;", // WebGL port note: Added
+		"		float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;",
 
-				// Ok, we know how this pattern looks like, now it is time for getting
-				// the actual area:
-				"weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );",
-			"}",
+		// Ok, we know how this pattern looks like, now it is time for getting
+		// the actual area:
+		"		weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );",
+		"	}",
 
-			"if ( e.r > 0.0 ) {", // Edge at west
-				"vec2 d;",
+		"	if ( e.r > 0.0 ) {", // Edge at west
+		"		vec2 d;",
 
-				// Find the distance to the top:
-				"vec2 coords;",
+		// Find the distance to the top:
+		"		vec2 coords;",
 
-				"coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );",
-				"coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x;
-				"d.x = coords.y;",
+		"		coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );",
+		"		coords.x = offset[ 0 ].x;", // offset[1].x = texcoord.x - 0.25 * resolution.x;
+		"		d.x = coords.y;",
 
-				// Fetch the top crossing edges:
-				"float e1 = texture2D( edgesTex, coords, 0.0 ).g;",
+		// Fetch the top crossing edges:
+		"		float e1 = texture2D( edgesTex, coords, 0.0 ).g;",
 
-				// Find the distance to the bottom:
-				"coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );",
-				"d.y = coords.y;",
+		// Find the distance to the bottom:
+		"		coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );",
+		"		d.y = coords.y;",
 
-				// We want the distances to be in pixel units:
-				"d = d / resolution.y - pixcoord.y;",
+		// We want the distances to be in pixel units:
+		"		d = d / resolution.y - pixcoord.y;",
 
-				// SMAAArea below needs a sqrt, as the areas texture is compressed
-				// quadratically:
-				"vec2 sqrt_d = sqrt( abs( d ) );",
+		// SMAAArea below needs a sqrt, as the areas texture is compressed
+		// quadratically:
+		"		vec2 sqrt_d = sqrt( abs( d ) );",
 
-				// Fetch the bottom crossing edges:
-				"coords.y -= 1.0 * resolution.y;", // WebGL port note: Added
-				"float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;",
+		// Fetch the bottom crossing edges:
+		"		coords.y -= 1.0 * resolution.y;", // WebGL port note: Added
+		"		float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;",
 
-				// Get the area for this direction:
-				"weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );",
-			"}",
+		// Get the area for this direction:
+		"		weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );",
+		"	}",
 
-			"return weights;",
+		"	return weights;",
 		"}",
 
 		"void main() {",
 
-			"gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );",
+		"	gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );",
 
 		"}"
 
@@ -395,17 +395,17 @@ var SMAABlendShader = {
 		"varying vec4 vOffset[ 2 ];",
 
 		"void SMAANeighborhoodBlendingVS( vec2 texcoord ) {",
-			"vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component
-			"vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component
+		"	vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );", // WebGL port note: Changed sign in W component
+		"	vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );", // WebGL port note: Changed sign in W component
 		"}",
 
 		"void main() {",
 
-			"vUv = uv;",
+		"	vUv = uv;",
 
-			"SMAANeighborhoodBlendingVS( vUv );",
+		"	SMAANeighborhoodBlendingVS( vUv );",
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 		"}"
 
@@ -421,49 +421,49 @@ var SMAABlendShader = {
 		"varying vec4 vOffset[ 2 ];",
 
 		"vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {",
-			// Fetch the blending weights for current pixel:
-			"vec4 a;",
-			"a.xz = texture2D( blendTex, texcoord ).xz;",
-			"a.y = texture2D( blendTex, offset[ 1 ].zw ).g;",
-			"a.w = texture2D( blendTex, offset[ 1 ].xy ).a;",
-
-			// Is there any blending weight with a value greater than 0.0?
-			"if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {",
-				"return texture2D( colorTex, texcoord, 0.0 );",
-			"} else {",
-				// Up to 4 lines can be crossing a pixel (one through each edge). We
-				// favor blending by choosing the line with the maximum weight for each
-				// direction:
-				"vec2 offset;",
-				"offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right
-				"offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs
-
-				// Then we go in the direction that has the maximum weight:
-				"if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical
-					"offset.y = 0.0;",
-				"} else {",
-					"offset.x = 0.0;",
-				"}",
-
-				// Fetch the opposite color and lerp by hand:
-				"vec4 C = texture2D( colorTex, texcoord, 0.0 );",
-				"texcoord += sign( offset ) * resolution;",
-				"vec4 Cop = texture2D( colorTex, texcoord, 0.0 );",
-				"float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );",
-
-				// WebGL port note: Added gamma correction
-				"C.xyz = pow(C.xyz, vec3(2.2));",
-				"Cop.xyz = pow(Cop.xyz, vec3(2.2));",
-				"vec4 mixed = mix(C, Cop, s);",
-				"mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));",
-
-				"return mixed;",
-			"}",
+		// Fetch the blending weights for current pixel:
+		"	vec4 a;",
+		"	a.xz = texture2D( blendTex, texcoord ).xz;",
+		"	a.y = texture2D( blendTex, offset[ 1 ].zw ).g;",
+		"	a.w = texture2D( blendTex, offset[ 1 ].xy ).a;",
+
+		// Is there any blending weight with a value greater than 0.0?
+		"	if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {",
+		"		return texture2D( colorTex, texcoord, 0.0 );",
+		"	} else {",
+		// Up to 4 lines can be crossing a pixel (one through each edge). We
+		// favor blending by choosing the line with the maximum weight for each
+		// direction:
+		"		vec2 offset;",
+		"		offset.x = a.a > a.b ? a.a : -a.b;", // left vs. right
+		"		offset.y = a.g > a.r ? -a.g : a.r;", // top vs. bottom // WebGL port note: Changed signs
+
+		// Then we go in the direction that has the maximum weight:
+		"		if ( abs( offset.x ) > abs( offset.y )) {", // horizontal vs. vertical
+		"			offset.y = 0.0;",
+		"		} else {",
+		"			offset.x = 0.0;",
+		"		}",
+
+		// Fetch the opposite color and lerp by hand:
+		"		vec4 C = texture2D( colorTex, texcoord, 0.0 );",
+		"		texcoord += sign( offset ) * resolution;",
+		"		vec4 Cop = texture2D( colorTex, texcoord, 0.0 );",
+		"		float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );",
+
+		// WebGL port note: Added gamma correction
+		"		C.xyz = pow(C.xyz, vec3(2.2));",
+		"		Cop.xyz = pow(Cop.xyz, vec3(2.2));",
+		"		vec4 mixed = mix(C, Cop, s);",
+		"		mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));",
+
+		"		return mixed;",
+		"	}",
 		"}",
 
 		"void main() {",
 
-			"gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );",
+		"	gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );",
 
 		"}"
 

+ 8 - 8
examples/jsm/shaders/SobelOperatorShader.js

@@ -44,44 +44,44 @@ var SobelOperatorShader = {
 
 		"	vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );",
 
-			// kernel definition (in glsl matrices are filled in column-major order)
+		// kernel definition (in glsl matrices are filled in column-major order)
 
 		"	const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );", // x direction kernel
 		"	const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );", // y direction kernel
 
-			// fetch the 3x3 neighbourhood of a fragment
+		// fetch the 3x3 neighbourhood of a fragment
 
-			// first column
+		// first column
 
 		"	float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;",
 		"	float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1,  0 ) ).r;",
 		"	float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1,  1 ) ).r;",
 
-			// second column
+		// second column
 
 		"	float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2(  0, -1 ) ).r;",
 		"	float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2(  0,  0 ) ).r;",
 		"	float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2(  0,  1 ) ).r;",
 
-			// third column
+		// third column
 
 		"	float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2(  1, -1 ) ).r;",
 		"	float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2(  1,  0 ) ).r;",
 		"	float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2(  1,  1 ) ).r;",
 
-			// gradient value in x direction
+		// gradient value in x direction
 
 		"	float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ",
 		"		Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ",
 		"		Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ",
 
-			// gradient value in y direction
+		// gradient value in y direction
 
 		"	float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ",
 		"		Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ",
 		"		Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ",
 
-			// magnitute of the total gradient
+		// magnitute of the total gradient
 
 		"	float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );",
 

+ 12 - 12
examples/jsm/shaders/TerrainShader.js

@@ -150,7 +150,7 @@ var TerrainShader = {
 		"	vec3 totalDiffuseLight = vec3( 0.0 );",
 		"	vec3 totalSpecularLight = vec3( 0.0 );",
 
-			// point lights
+		// point lights
 
 		"	#if NUM_POINT_LIGHTS > 0",
 
@@ -176,7 +176,7 @@ var TerrainShader = {
 
 		"	#endif",
 
-			// directional lights
+		// directional lights
 
 		"	#if NUM_DIR_LIGHTS > 0",
 
@@ -200,7 +200,7 @@ var TerrainShader = {
 
 		"	#endif",
 
-			// hemisphere lights
+		// hemisphere lights
 
 		"	#if NUM_HEMI_LIGHTS > 0",
 
@@ -211,14 +211,14 @@ var TerrainShader = {
 
 		"			vec3 lVector = hemisphereLightDirection[ i ];",
 
-					// diffuse
+		// diffuse
 
 		"			float dotProduct = dot( normal, lVector );",
 		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
 
 		"			totalDiffuseLight += mix( hemisphereLights[ i ].groundColor, hemisphereLights[ i ].skyColor, hemiDiffuseWeight );",
 
-					// specular (sky light)
+		// specular (sky light)
 
 		"			float hemiSpecularWeight = 0.0;",
 
@@ -226,7 +226,7 @@ var TerrainShader = {
 		"			float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
 		"			hemiSpecularWeight += specularTex.r * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
 
-					// specular (ground light)
+		// specular (ground light)
 
 		"			vec3 lVectorGround = -lVector;",
 
@@ -244,7 +244,7 @@ var TerrainShader = {
 
 		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
-			ShaderChunk[ "fog_fragment" ],
+		ShaderChunk[ "fog_fragment" ],
 
 		"}"
 
@@ -280,20 +280,20 @@ var TerrainShader = {
 
 		"	vNormal = normalize( normalMatrix * normal );",
 
-			// tangent and binormal vectors
+		// tangent and binormal vectors
 
 		"	vTangent = normalize( normalMatrix * tangent.xyz );",
 
 		"	vBinormal = cross( vNormal, vTangent ) * tangent.w;",
 		"	vBinormal = normalize( vBinormal );",
 
-			// texture coordinates
+		// texture coordinates
 
 		"	vUv = uv;",
 
 		"	vec2 uvBase = uv * uRepeatBase;",
 
-			// displacement mapping
+		// displacement mapping
 
 		"	#ifdef VERTEX_TEXTURES",
 
@@ -318,8 +318,8 @@ var TerrainShader = {
 		"	vec3 normalTex = texture2D( tNormal, uvBase ).xyz * 2.0 - 1.0;",
 		"	vNormal = normalMatrix * normalTex;",
 
-			ShaderChunk[ "shadowmap_vertex" ],
-			ShaderChunk[ "fog_vertex" ],
+		ShaderChunk[ "shadowmap_vertex" ],
+		ShaderChunk[ "fog_vertex" ],
 
 		"}"
 

+ 3 - 3
examples/jsm/shaders/ToneMapShader.js

@@ -50,16 +50,16 @@ var ToneMapShader = {
 
 		"vec3 ToneMap( vec3 vColor ) {",
 		"	#ifdef ADAPTED_LUMINANCE",
-				// Get the calculated average luminance
+		// Get the calculated average luminance
 		"		float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;",
 		"	#else",
 		"		float fLumAvg = averageLuminance;",
 		"	#endif",
 
-			// Calculate the luminance of the current pixel
+		// Calculate the luminance of the current pixel
 		"	float fLumPixel = linearToRelativeLuminance( vColor );",
 
-			// Apply the modified operator (Eq. 4)
+		// Apply the modified operator (Eq. 4)
 		"	float fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );",
 
 		"	float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);",

+ 1 - 1
examples/jsm/shaders/TriangleBlurShader.js

@@ -53,7 +53,7 @@ var TriangleBlurShader = {
 
 		"	float total = 0.0;",
 
-			// randomize the lookup values to hide the fixed number of samples
+		// randomize the lookup values to hide the fixed number of samples
 
 		"	float offset = rand( vUv );",
 

+ 1 - 1
examples/jsm/shaders/VignetteShader.js

@@ -42,7 +42,7 @@ var VignetteShader = {
 
 		"void main() {",
 
-			// Eskil's vignette
+		// Eskil's vignette
 
 		"	vec4 texel = texture2D( tDiffuse, vUv );",
 		"	vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",

+ 311 - 311
examples/jsm/shaders/VolumeShader.js

@@ -13,319 +13,319 @@ import {
 
 var VolumeRenderShader1 = {
 	uniforms: {
-				"u_size": { value: new Vector3( 1, 1, 1 ) },
-				"u_renderstyle": { value: 0 },
-				"u_renderthreshold": { value: 0.5 },
-				"u_clim": { value: new Vector2( 1, 1 ) },
-				"u_data": { value: null },
-				"u_cmdata": { value: null }
-		},
-		vertexShader: [
-				'varying vec4 v_nearpos;',
-				'varying vec4 v_farpos;',
-				'varying vec3 v_position;',
-
-				'mat4 inversemat(mat4 m) {',
-						// Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl
-						// This function is licenced by the MIT license to Mikola Lysenko
-						'float',
-						'a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],',
-						'a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],',
-						'a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],',
-						'a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],',
-
-						'b00 = a00 * a11 - a01 * a10,',
-						'b01 = a00 * a12 - a02 * a10,',
-						'b02 = a00 * a13 - a03 * a10,',
-						'b03 = a01 * a12 - a02 * a11,',
-						'b04 = a01 * a13 - a03 * a11,',
-						'b05 = a02 * a13 - a03 * a12,',
-						'b06 = a20 * a31 - a21 * a30,',
-						'b07 = a20 * a32 - a22 * a30,',
-						'b08 = a20 * a33 - a23 * a30,',
-						'b09 = a21 * a32 - a22 * a31,',
-						'b10 = a21 * a33 - a23 * a31,',
-						'b11 = a22 * a33 - a23 * a32,',
-
-						'det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;',
-
-				'return mat4(',
-						'a11 * b11 - a12 * b10 + a13 * b09,',
-						'a02 * b10 - a01 * b11 - a03 * b09,',
-						'a31 * b05 - a32 * b04 + a33 * b03,',
-						'a22 * b04 - a21 * b05 - a23 * b03,',
-						'a12 * b08 - a10 * b11 - a13 * b07,',
-						'a00 * b11 - a02 * b08 + a03 * b07,',
-						'a32 * b02 - a30 * b05 - a33 * b01,',
-						'a20 * b05 - a22 * b02 + a23 * b01,',
-						'a10 * b10 - a11 * b08 + a13 * b06,',
-						'a01 * b08 - a00 * b10 - a03 * b06,',
-						'a30 * b04 - a31 * b02 + a33 * b00,',
-						'a21 * b02 - a20 * b04 - a23 * b00,',
-						'a11 * b07 - a10 * b09 - a12 * b06,',
-						'a00 * b09 - a01 * b07 + a02 * b06,',
-						'a31 * b01 - a30 * b03 - a32 * b00,',
-						'a20 * b03 - a21 * b01 + a22 * b00) / det;',
-				'}',
-
-
-				'void main() {',
-						// Prepare transforms to map to "camera view". See also:
-						// https://threejs.org/docs/#api/renderers/webgl/WebGLProgram
-						'mat4 viewtransformf = viewMatrix;',
-						'mat4 viewtransformi = inversemat(viewMatrix);',
-
-						// Project local vertex coordinate to camera position. Then do a step
-						// backward (in cam coords) to the near clipping plane, and project back. Do
-						// the same for the far clipping plane. This gives us all the information we
-						// need to calculate the ray and truncate it to the viewing cone.
-						'vec4 position4 = vec4(position, 1.0);',
-						'vec4 pos_in_cam = viewtransformf * position4;',
-
-						// Intersection of ray and near clipping plane (z = -1 in clip coords)
-						'pos_in_cam.z = -pos_in_cam.w;',
-						'v_nearpos = viewtransformi * pos_in_cam;',
-
-						// Intersection of ray and far clipping plane (z = +1 in clip coords)
-						'pos_in_cam.z = pos_in_cam.w;',
-						'v_farpos = viewtransformi * pos_in_cam;',
-
-						// Set varyings and output pos
-						'v_position = position;',
-						'gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;',
-				'}',
-		].join( '\n' ),
+		"u_size": { value: new Vector3( 1, 1, 1 ) },
+		"u_renderstyle": { value: 0 },
+		"u_renderthreshold": { value: 0.5 },
+		"u_clim": { value: new Vector2( 1, 1 ) },
+		"u_data": { value: null },
+		"u_cmdata": { value: null }
+	},
+	vertexShader: [
+		"		varying vec4 v_nearpos;",
+		"		varying vec4 v_farpos;",
+		"		varying vec3 v_position;",
+
+		"		mat4 inversemat(mat4 m) {",
+		// Taken from https://github.com/stackgl/glsl-inverse/blob/master/index.glsl
+		// This function is licenced by the MIT license to Mikola Lysenko
+		"				float",
+		"				a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],",
+		"				a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],",
+		"				a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],",
+		"				a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],",
+
+		"				b00 = a00 * a11 - a01 * a10,",
+		"				b01 = a00 * a12 - a02 * a10,",
+		"				b02 = a00 * a13 - a03 * a10,",
+		"				b03 = a01 * a12 - a02 * a11,",
+		"				b04 = a01 * a13 - a03 * a11,",
+		"				b05 = a02 * a13 - a03 * a12,",
+		"				b06 = a20 * a31 - a21 * a30,",
+		"				b07 = a20 * a32 - a22 * a30,",
+		"				b08 = a20 * a33 - a23 * a30,",
+		"				b09 = a21 * a32 - a22 * a31,",
+		"				b10 = a21 * a33 - a23 * a31,",
+		"				b11 = a22 * a33 - a23 * a32,",
+
+		"				det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;",
+
+		"		return mat4(",
+		"				a11 * b11 - a12 * b10 + a13 * b09,",
+		"				a02 * b10 - a01 * b11 - a03 * b09,",
+		"				a31 * b05 - a32 * b04 + a33 * b03,",
+		"				a22 * b04 - a21 * b05 - a23 * b03,",
+		"				a12 * b08 - a10 * b11 - a13 * b07,",
+		"				a00 * b11 - a02 * b08 + a03 * b07,",
+		"				a32 * b02 - a30 * b05 - a33 * b01,",
+		"				a20 * b05 - a22 * b02 + a23 * b01,",
+		"				a10 * b10 - a11 * b08 + a13 * b06,",
+		"				a01 * b08 - a00 * b10 - a03 * b06,",
+		"				a30 * b04 - a31 * b02 + a33 * b00,",
+		"				a21 * b02 - a20 * b04 - a23 * b00,",
+		"				a11 * b07 - a10 * b09 - a12 * b06,",
+		"				a00 * b09 - a01 * b07 + a02 * b06,",
+		"				a31 * b01 - a30 * b03 - a32 * b00,",
+		"				a20 * b03 - a21 * b01 + a22 * b00) / det;",
+		"		}",
+
+
+		"		void main() {",
+		// Prepare transforms to map to "camera view". See also:
+		// https://threejs.org/docs/#api/renderers/webgl/WebGLProgram
+		"				mat4 viewtransformf = viewMatrix;",
+		"				mat4 viewtransformi = inversemat(viewMatrix);",
+
+		// Project local vertex coordinate to camera position. Then do a step
+		// backward (in cam coords) to the near clipping plane, and project back. Do
+		// the same for the far clipping plane. This gives us all the information we
+		// need to calculate the ray and truncate it to the viewing cone.
+		"				vec4 position4 = vec4(position, 1.0);",
+		"				vec4 pos_in_cam = viewtransformf * position4;",
+
+		// Intersection of ray and near clipping plane (z = -1 in clip coords)
+		"				pos_in_cam.z = -pos_in_cam.w;",
+		"				v_nearpos = viewtransformi * pos_in_cam;",
+
+		// Intersection of ray and far clipping plane (z = +1 in clip coords)
+		"				pos_in_cam.z = pos_in_cam.w;",
+		"				v_farpos = viewtransformi * pos_in_cam;",
+
+		// Set varyings and output pos
+		"				v_position = position;",
+		"				gl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;",
+		"		}",
+	].join( "\n" ),
 	fragmentShader: [
-				'precision highp float;',
-				'precision mediump sampler3D;',
-
-				'uniform vec3 u_size;',
-				'uniform int u_renderstyle;',
-				'uniform float u_renderthreshold;',
-				'uniform vec2 u_clim;',
-
-				'uniform sampler3D u_data;',
-				'uniform sampler2D u_cmdata;',
-
-				'varying vec3 v_position;',
-				'varying vec4 v_nearpos;',
-				'varying vec4 v_farpos;',
-
-				// The maximum distance through our rendering volume is sqrt(3).
-				'const int MAX_STEPS = 887;	// 887 for 512^3, 1774 for 1024^3',
-				'const int REFINEMENT_STEPS = 4;',
-				'const float relative_step_size = 1.0;',
-				'const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);',
-				'const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);',
-				'const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);',
-				'const float shininess = 40.0;',
-
-				'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',
-				'void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);',
-
-				'float sample1(vec3 texcoords);',
-				'vec4 apply_colormap(float val);',
-				'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);',
-
-
-				'void main() {',
-						// Normalize clipping plane info
-						'vec3 farpos = v_farpos.xyz / v_farpos.w;',
-						'vec3 nearpos = v_nearpos.xyz / v_nearpos.w;',
-
-						// Calculate unit vector pointing in the view direction through this fragment.
-						'vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);',
-
-						// Compute the (negative) distance to the front surface or near clipping plane.
-						// v_position is the back face of the cuboid, so the initial distance calculated in the dot
-						// product below is the distance from near clip plane to the back of the cuboid
-						'float distance = dot(nearpos - v_position, view_ray);',
-						'distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,',
-																				'(u_size.x - 0.5 - v_position.x) / view_ray.x));',
-						'distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,',
-																				'(u_size.y - 0.5 - v_position.y) / view_ray.y));',
-						'distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,',
-																				'(u_size.z - 0.5 - v_position.z) / view_ray.z));',
-
-																				// Now we have the starting position on the front surface
-						'vec3 front = v_position + view_ray * distance;',
-
-						// Decide how many steps to take
-						'int nsteps = int(-distance / relative_step_size + 0.5);',
-						'if ( nsteps < 1 )',
-								'discard;',
-
-						// Get starting location and step vector in texture coordinates
-						'vec3 step = ((v_position - front) / u_size) / float(nsteps);',
-						'vec3 start_loc = front / u_size;',
-
-						// For testing: show the number of steps. This helps to establish
-						// whether the rays are correctly oriented
-						//'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);',
-						//'return;',
-
-						'if (u_renderstyle == 0)',
-								'cast_mip(start_loc, step, nsteps, view_ray);',
-						'else if (u_renderstyle == 1)',
-								'cast_iso(start_loc, step, nsteps, view_ray);',
-
-						'if (gl_FragColor.a < 0.05)',
-								'discard;',
-				'}',
-
-
-				'float sample1(vec3 texcoords) {',
-						'/* Sample float value from a 3D texture. Assumes intensity data. */',
-						'return texture(u_data, texcoords.xyz).r;',
-				'}',
-
-
-				'vec4 apply_colormap(float val) {',
-						'val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);',
-						'return texture2D(u_cmdata, vec2(val, 0.5));',
-				'}',
-
-
-				'void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {',
-
-						'float max_val = -1e6;',
-						'int max_i = 100;',
-						'vec3 loc = start_loc;',
-
-						// Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with
-						// non-constant expression. So we use a hard-coded max, and an additional condition
-						// inside the loop.
-						'for (int iter=0; iter<MAX_STEPS; iter++) {',
-								'if (iter >= nsteps)',
-										'break;',
-								// Sample from the 3D texture
-								'float val = sample1(loc);',
-								// Apply MIP operation
-								'if (val > max_val) {',
-										'max_val = val;',
-										'max_i = iter;',
-								'}',
-								// Advance location deeper into the volume
-								'loc += step;',
-						'}',
-
-						// Refine location, gives crispier images
-						'vec3 iloc = start_loc + step * (float(max_i) - 0.5);',
-						'vec3 istep = step / float(REFINEMENT_STEPS);',
-						'for (int i=0; i<REFINEMENT_STEPS; i++) {',
-								'max_val = max(max_val, sample1(iloc));',
-								'iloc += istep;',
-						'}',
-
-						// Resolve final color
-						'gl_FragColor = apply_colormap(max_val);',
-				'}',
-
-
-				'void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {',
-
-						'gl_FragColor = vec4(0.0);	// init transparent',
-						'vec4 color3 = vec4(0.0);	// final color',
-						'vec3 dstep = 1.5 / u_size;	// step to sample derivative',
-						'vec3 loc = start_loc;',
-
-						'float low_threshold = u_renderthreshold - 0.02 * (u_clim[1] - u_clim[0]);',
-
-						// Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with
-						// non-constant expression. So we use a hard-coded max, and an additional condition
-						// inside the loop.
-						'for (int iter=0; iter<MAX_STEPS; iter++) {',
-								'if (iter >= nsteps)',
-										'break;',
-
-										// Sample from the 3D texture
-								'float val = sample1(loc);',
-
-								'if (val > low_threshold) {',
-								// Take the last interval in smaller steps
-										'vec3 iloc = loc - 0.5 * step;',
-										'vec3 istep = step / float(REFINEMENT_STEPS);',
-										'for (int i=0; i<REFINEMENT_STEPS; i++) {',
-												'val = sample1(iloc);',
-												'if (val > u_renderthreshold) {',
-														'gl_FragColor = add_lighting(val, iloc, dstep, view_ray);',
-														'return;',
-												'}',
-												'iloc += istep;',
-										'}',
-								'}',
-
-								// Advance location deeper into the volume
-								'loc += step;',
-						'}',
-				'}',
-
-
-				'vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)',
-				'{',
-						// Calculate color by incorporating lighting
-
-						// View direction
-						'vec3 V = normalize(view_ray);',
-
-						// calculate normal vector from gradient
-						'vec3 N;',
-						'float val1, val2;',
-						'val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));',
-						'val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));',
-						'N[0] = val1 - val2;',
-						'val = max(max(val1, val2), val);',
-						'val1 = sample1(loc + vec3(0.0, -step[1], 0.0));',
-						'val2 = sample1(loc + vec3(0.0, +step[1], 0.0));',
-						'N[1] = val1 - val2;',
-						'val = max(max(val1, val2), val);',
-						'val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));',
-						'val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));',
-						'N[2] = val1 - val2;',
-						'val = max(max(val1, val2), val);',
-
-						'float gm = length(N); // gradient magnitude',
-						'N = normalize(N);',
-
-						// Flip normal so it points towards viewer
-						'float Nselect = float(dot(N, V) > 0.0);',
-						'N = (2.0 * Nselect - 1.0) * N;	// ==	Nselect * N - (1.0-Nselect)*N;',
-
-						// Init colors
-						'vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);',
-						'vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);',
-						'vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);',
-
-						// note: could allow multiple lights
-						'for (int i=0; i<1; i++)',
-						'{',
+		"		precision highp float;",
+		"		precision mediump sampler3D;",
+
+		"		uniform vec3 u_size;",
+		"		uniform int u_renderstyle;",
+		"		uniform float u_renderthreshold;",
+		"		uniform vec2 u_clim;",
+
+		"		uniform sampler3D u_data;",
+		"		uniform sampler2D u_cmdata;",
+
+		"		varying vec3 v_position;",
+		"		varying vec4 v_nearpos;",
+		"		varying vec4 v_farpos;",
+
+		// The maximum distance through our rendering volume is sqrt(3).
+		"		const int MAX_STEPS = 887;	// 887 for 512^3, 1774 for 1024^3",
+		"		const int REFINEMENT_STEPS = 4;",
+		"		const float relative_step_size = 1.0;",
+		"		const vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);",
+		"		const vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);",
+		"		const vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);",
+		"		const float shininess = 40.0;",
+
+		"		void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);",
+		"		void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);",
+
+		"		float sample1(vec3 texcoords);",
+		"		vec4 apply_colormap(float val);",
+		"		vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);",
+
+
+		"		void main() {",
+		// Normalize clipping plane info
+		"				vec3 farpos = v_farpos.xyz / v_farpos.w;",
+		"				vec3 nearpos = v_nearpos.xyz / v_nearpos.w;",
+
+		// Calculate unit vector pointing in the view direction through this fragment.
+		"				vec3 view_ray = normalize(nearpos.xyz - farpos.xyz);",
+
+		// Compute the (negative) distance to the front surface or near clipping plane.
+		// v_position is the back face of the cuboid, so the initial distance calculated in the dot
+		// product below is the distance from near clip plane to the back of the cuboid
+		"				float distance = dot(nearpos - v_position, view_ray);",
+		"				distance = max(distance, min((-0.5 - v_position.x) / view_ray.x,",
+		"																		(u_size.x - 0.5 - v_position.x) / view_ray.x));",
+		"				distance = max(distance, min((-0.5 - v_position.y) / view_ray.y,",
+		"																		(u_size.y - 0.5 - v_position.y) / view_ray.y));",
+		"				distance = max(distance, min((-0.5 - v_position.z) / view_ray.z,",
+		"																		(u_size.z - 0.5 - v_position.z) / view_ray.z));",
+
+		// Now we have the starting position on the front surface
+		"				vec3 front = v_position + view_ray * distance;",
+
+		// Decide how many steps to take
+		"				int nsteps = int(-distance / relative_step_size + 0.5);",
+		"				if ( nsteps < 1 )",
+		"						discard;",
+
+		// Get starting location and step vector in texture coordinates
+		"				vec3 step = ((v_position - front) / u_size) / float(nsteps);",
+		"				vec3 start_loc = front / u_size;",
+
+		// For testing: show the number of steps. This helps to establish
+		// whether the rays are correctly oriented
+		//'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);',
+		//'return;',
+
+		"				if (u_renderstyle == 0)",
+		"						cast_mip(start_loc, step, nsteps, view_ray);",
+		"				else if (u_renderstyle == 1)",
+		"						cast_iso(start_loc, step, nsteps, view_ray);",
+
+		"				if (gl_FragColor.a < 0.05)",
+		"						discard;",
+		"		}",
+
+
+		"		float sample1(vec3 texcoords) {",
+		"				/* Sample float value from a 3D texture. Assumes intensity data. */",
+		"				return texture(u_data, texcoords.xyz).r;",
+		"		}",
+
+
+		"		vec4 apply_colormap(float val) {",
+		"				val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);",
+		"				return texture2D(u_cmdata, vec2(val, 0.5));",
+		"		}",
+
+
+		"		void cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {",
+
+		"				float max_val = -1e6;",
+		"				int max_i = 100;",
+		"				vec3 loc = start_loc;",
+
+		// Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with
+		// non-constant expression. So we use a hard-coded max, and an additional condition
+		// inside the loop.
+		"				for (int iter=0; iter<MAX_STEPS; iter++) {",
+		"						if (iter >= nsteps)",
+		"								break;",
+		// Sample from the 3D texture
+		"						float val = sample1(loc);",
+		// Apply MIP operation
+		"						if (val > max_val) {",
+		"								max_val = val;",
+		"								max_i = iter;",
+		"						}",
+		// Advance location deeper into the volume
+		"						loc += step;",
+		"				}",
+
+		// Refine location, gives crispier images
+		"				vec3 iloc = start_loc + step * (float(max_i) - 0.5);",
+		"				vec3 istep = step / float(REFINEMENT_STEPS);",
+		"				for (int i=0; i<REFINEMENT_STEPS; i++) {",
+		"						max_val = max(max_val, sample1(iloc));",
+		"						iloc += istep;",
+		"				}",
+
+		// Resolve final color
+		"				gl_FragColor = apply_colormap(max_val);",
+		"		}",
+
+
+		"		void cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {",
+
+		"				gl_FragColor = vec4(0.0);	// init transparent",
+		"				vec4 color3 = vec4(0.0);	// final color",
+		"				vec3 dstep = 1.5 / u_size;	// step to sample derivative",
+		"				vec3 loc = start_loc;",
+
+		"				float low_threshold = u_renderthreshold - 0.02 * (u_clim[1] - u_clim[0]);",
+
+		// Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with
+		// non-constant expression. So we use a hard-coded max, and an additional condition
+		// inside the loop.
+		"				for (int iter=0; iter<MAX_STEPS; iter++) {",
+		"						if (iter >= nsteps)",
+		"								break;",
+
+		// Sample from the 3D texture
+		"						float val = sample1(loc);",
+
+		"						if (val > low_threshold) {",
+		// Take the last interval in smaller steps
+		"								vec3 iloc = loc - 0.5 * step;",
+		"								vec3 istep = step / float(REFINEMENT_STEPS);",
+		"								for (int i=0; i<REFINEMENT_STEPS; i++) {",
+		"										val = sample1(iloc);",
+		"										if (val > u_renderthreshold) {",
+		"												gl_FragColor = add_lighting(val, iloc, dstep, view_ray);",
+		"												return;",
+		"										}",
+		"										iloc += istep;",
+		"								}",
+		"						}",
+
+		// Advance location deeper into the volume
+		"						loc += step;",
+		"				}",
+		"		}",
+
+
+		"		vec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)",
+		"		{",
+		// Calculate color by incorporating lighting
+
+		// View direction
+		"				vec3 V = normalize(view_ray);",
+
+		// calculate normal vector from gradient
+		"				vec3 N;",
+		"				float val1, val2;",
+		"				val1 = sample1(loc + vec3(-step[0], 0.0, 0.0));",
+		"				val2 = sample1(loc + vec3(+step[0], 0.0, 0.0));",
+		"				N[0] = val1 - val2;",
+		"				val = max(max(val1, val2), val);",
+		"				val1 = sample1(loc + vec3(0.0, -step[1], 0.0));",
+		"				val2 = sample1(loc + vec3(0.0, +step[1], 0.0));",
+		"				N[1] = val1 - val2;",
+		"				val = max(max(val1, val2), val);",
+		"				val1 = sample1(loc + vec3(0.0, 0.0, -step[2]));",
+		"				val2 = sample1(loc + vec3(0.0, 0.0, +step[2]));",
+		"				N[2] = val1 - val2;",
+		"				val = max(max(val1, val2), val);",
+
+		"				float gm = length(N); // gradient magnitude",
+		"				N = normalize(N);",
+
+		// Flip normal so it points towards viewer
+		"				float Nselect = float(dot(N, V) > 0.0);",
+		"				N = (2.0 * Nselect - 1.0) * N;	// ==	Nselect * N - (1.0-Nselect)*N;",
+
+		// Init colors
+		"				vec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);",
+		"				vec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);",
+		"				vec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);",
+
+		// note: could allow multiple lights
+		"				for (int i=0; i<1; i++)",
+		"				{",
 								 // Get light direction (make sure to prevent zero devision)
-								'vec3 L = normalize(view_ray);	//lightDirs[i];',
-								'float lightEnabled = float( length(L) > 0.0 );',
-								'L = normalize(L + (1.0 - lightEnabled));',
-
-								// Calculate lighting properties
-								'float lambertTerm = clamp(dot(N, L), 0.0, 1.0);',
-								'vec3 H = normalize(L+V); // Halfway vector',
-								'float specularTerm = pow(max(dot(H, N), 0.0), shininess);',
-
-								// Calculate mask
-								'float mask1 = lightEnabled;',
-
-								// Calculate colors
-								'ambient_color +=	mask1 * ambient_color;	// * gl_LightSource[i].ambient;',
-								'diffuse_color +=	mask1 * lambertTerm;',
-								'specular_color += mask1 * specularTerm * specular_color;',
-						'}',
-
-						// Calculate final color by componing different components
-						'vec4 final_color;',
-						'vec4 color = apply_colormap(val);',
-						'final_color = color * (ambient_color + diffuse_color) + specular_color;',
-						'final_color.a = color.a;',
-						'return final_color;',
-				'}',
-	].join( '\n' )
+		"						vec3 L = normalize(view_ray);	//lightDirs[i];",
+		"						float lightEnabled = float( length(L) > 0.0 );",
+		"						L = normalize(L + (1.0 - lightEnabled));",
+
+		// Calculate lighting properties
+		"						float lambertTerm = clamp(dot(N, L), 0.0, 1.0);",
+		"						vec3 H = normalize(L+V); // Halfway vector",
+		"						float specularTerm = pow(max(dot(H, N), 0.0), shininess);",
+
+		// Calculate mask
+		"						float mask1 = lightEnabled;",
+
+		// Calculate colors
+		"						ambient_color +=	mask1 * ambient_color;	// * gl_LightSource[i].ambient;",
+		"						diffuse_color +=	mask1 * lambertTerm;",
+		"						specular_color += mask1 * specularTerm * specular_color;",
+		"				}",
+
+		// Calculate final color by componing different components
+		"				vec4 final_color;",
+		"				vec4 color = apply_colormap(val);",
+		"				final_color = color * (ambient_color + diffuse_color) + specular_color;",
+		"				final_color.a = color.a;",
+		"				return final_color;",
+		"		}",
+	].join( "\n" )
 };
 
 export { VolumeRenderShader1 };

+ 38 - 38
examples/jsm/shaders/WaterRefractionShader.js

@@ -9,23 +9,23 @@ var WaterRefractionShader = {
 
 	uniforms: {
 
-		'color': {
+		"color": {
 			value: null
 		},
 
-		'time': {
+		"time": {
 			value: 0
 		},
 
-		'tDiffuse': {
+		"tDiffuse": {
 			value: null
 		},
 
-		'tDudv': {
+		"tDudv": {
 			value: null
 		},
 
-		'textureMatrix': {
+		"textureMatrix": {
 			value: null
 		}
 
@@ -33,68 +33,68 @@ var WaterRefractionShader = {
 
 	vertexShader: [
 
-		'uniform mat4 textureMatrix;',
+		"uniform mat4 textureMatrix;",
 
-		'varying vec2 vUv;',
-		'varying vec4 vUvRefraction;',
+		"varying vec2 vUv;",
+		"varying vec4 vUvRefraction;",
 
-		'void main() {',
+		"void main() {",
 
-		'	vUv = uv;',
+		"	vUv = uv;",
 
-		'	vUvRefraction = textureMatrix * vec4( position, 1.0 );',
+		"	vUvRefraction = textureMatrix * vec4( position, 1.0 );",
 
-		'	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
+		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
-		'}'
+		"}"
 
-	].join( '\n' ),
+	].join( "\n" ),
 
 	fragmentShader: [
 
-		'uniform vec3 color;',
-		'uniform float time;',
-		'uniform sampler2D tDiffuse;',
-		'uniform sampler2D tDudv;',
+		"uniform vec3 color;",
+		"uniform float time;",
+		"uniform sampler2D tDiffuse;",
+		"uniform sampler2D tDudv;",
 
-		'varying vec2 vUv;',
-		'varying vec4 vUvRefraction;',
+		"varying vec2 vUv;",
+		"varying vec4 vUvRefraction;",
 
-		'float blendOverlay( float base, float blend ) {',
+		"float blendOverlay( float base, float blend ) {",
 
-		'	return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );',
+		"	return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );",
 
-		'}',
+		"}",
 
-		'vec3 blendOverlay( vec3 base, vec3 blend ) {',
+		"vec3 blendOverlay( vec3 base, vec3 blend ) {",
 
-		'	return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );',
+		"	return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );",
 
-		'}',
+		"}",
 
-		'void main() {',
+		"void main() {",
 
-		' float waveStrength = 0.1;',
-		' float waveSpeed = 0.03;',
+		" float waveStrength = 0.1;",
+		" float waveSpeed = 0.03;",
 
 		// simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s)
 
-		'	vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;',
-		'	distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );',
-		'	vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;',
+		"	vec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;",
+		"	distortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );",
+		"	vec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;",
 
 		// new uv coords
 
-		' vec4 uv = vec4( vUvRefraction );',
-		' uv.xy += distortion;',
+		" vec4 uv = vec4( vUvRefraction );",
+		" uv.xy += distortion;",
 
-		'	vec4 base = texture2DProj( tDiffuse, uv );',
+		"	vec4 base = texture2DProj( tDiffuse, uv );",
 
-		'	gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );',
+		"	gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );",
 
-		'}'
+		"}"
 
-	].join( '\n' )
+	].join( "\n" )
 };
 
 export { WaterRefractionShader };