Browse Source

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 8 years ago
parent
commit
57b95155ac

+ 0 - 57
Playground/scripts/hdr rendering pipeline.js

@@ -1,57 +0,0 @@
-var createScene = function () {
-    var scene = new BABYLON.Scene(engine);
-    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
-    var material = new BABYLON.StandardMaterial("kosh", scene);
-    var sphere = BABYLON.Mesh.CreateSphere("Sphere1", 32, 3, scene);
-    var light = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(-17.6, 18.8, -49.9), scene);
-
-    camera.setPosition(new BABYLON.Vector3(-15, 3, 0));
-    camera.attachControl(canvas, true);
-
-    // Sphere material
-    material.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", scene);
-    material.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    material.emissiveColor = new BABYLON.Color3(0.5, 0.5, 0.5);
-    material.alpha = 0.2;
-    material.specularPower = 16;
-
-    // Fresnel
-    material.reflectionFresnelParameters = new BABYLON.FresnelParameters();
-    material.reflectionFresnelParameters.bias = 0.1;
-
-    material.emissiveFresnelParameters = new BABYLON.FresnelParameters();
-    material.emissiveFresnelParameters.bias = 0.6;
-    material.emissiveFresnelParameters.power = 4;
-    material.emissiveFresnelParameters.leftColor = BABYLON.Color3.White();
-    material.emissiveFresnelParameters.rightColor = BABYLON.Color3.Black();
-
-    material.opacityFresnelParameters = new BABYLON.FresnelParameters();
-    material.opacityFresnelParameters.leftColor = BABYLON.Color3.White();
-    material.opacityFresnelParameters.rightColor = BABYLON.Color3.Black();
-
-    sphere.material = material;
-
-    // Skybox
-    var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene);
-    var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
-    skyboxMaterial.backFaceCulling = false;
-    skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/TropicalSunnyDay", scene);
-    skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
-    skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
-    skyboxMaterial.disableLighting = true;
-    skybox.material = skyboxMaterial;
-
-    var hdr = new BABYLON.HDRRenderingPipeline("hdr", scene, 1.0, null, [camera]);
-    hdr.brightThreshold = 0.5;
-    hdr.gaussCoeff = 0.4;
-    hdr.gaussMean = 1.0;
-    hdr.gaussStandDev = 10.0;
-    hdr.minimumLuminance = 0.5;
-    hdr.luminanceDecreaseRate = 0.5;
-    hdr.luminanceIncreaserate = 0.5;
-    hdr.exposure = 1.0;
-    hdr.gaussMultiplier = 4;
-
-    return scene;
-}

+ 0 - 1
Playground/scripts/scripts.txt

@@ -24,7 +24,6 @@ sound on mesh
 ssao rendering pipeline
 ssao 2
 volumetric Light Scattering
-hdr Rendering Pipeline
 refraction and Reflection
 pbr
 instanced bones

+ 1 - 3
Tools/Gulp/config.json

@@ -675,7 +675,6 @@
                 "../../src/PostProcess/babylon.ssaoRenderingPipeline.js",
                 "../../src/PostProcess/babylon.ssao2RenderingPipeline.js",
                 "../../src/PostProcess/babylon.lensRenderingPipeline.js",
-                "../../src/PostProcess/babylon.hdrRenderingPipeline.js",
                 "../../src/PostProcess/babylon.standardRenderingPipeline.js"
             ],
             "dependUpon" : [
@@ -689,8 +688,7 @@
                 "chromaticAberration.fragment",
                 "lensHighlights.fragment",
                 "depthOfField.fragment",
-                "standard.fragment",
-                "hdr.fragment"
+                "standard.fragment"
             ]
         },
         "bones" : 

+ 2 - 0
dist/preview release/what's new.md

@@ -109,6 +109,8 @@
   - `createCompoundImpostor` has been removed. Use PhysicsImpostor parent/child instead
 - ActionManager:
   - `LongPressDelay` and `DragMovementThreshold` are now respectively Scene.LongPressDelay and Scene.DragMovementThreshold
+- HDRRenderingPipeline:
+  - `HDRRenderingPipeline` has been removed because it is deprecated. It is now replaced by `StandardRenderingPipeline` which is more advanced. See [documentation](http://doc.babylonjs.com/tutorials/using_standard_rendering_pipeline)
  
 ## Canvas2D
 

+ 0 - 461
src/PostProcess/babylon.hdrRenderingPipeline.ts

@@ -1,461 +0,0 @@
-/// <reference path="RenderPipeline\babylon.postProcessRenderPipeline.ts" />
-
-module BABYLON {
-    export class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable {
-
-        /**
-        * Public members
-        */
-        
-        // Gaussian Blur
-        /**
-        * Gaussian blur coefficient
-        * @type {number}
-        */
-        public gaussCoeff: number = 0.3;
-        /**
-        * Gaussian blur mean
-        * @type {number}
-        */
-        public gaussMean: number = 1.0;
-        /**
-        * Gaussian blur standard deviation
-        * @type {number}
-        */
-        public gaussStandDev: number = 0.8;
-        /**
-        * Gaussian blur multiplier. Multiplies the blur effect
-        * @type {number}
-        */
-        public gaussMultiplier: number = 4.0;
-
-        // HDR
-        /**
-        * Exposure, controls the overall intensity of the pipeline
-        * @type {number}
-        */
-        public exposure: number = 1.0;
-        /**
-        * Minimum luminance that the post-process can output. Luminance is >= 0
-        * @type {number}
-        */
-        public minimumLuminance: number = 1.0;
-        /**
-        * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance
-        * @type {number}
-        */
-        public maximumLuminance: number = 1e20;
-        /**
-        * Increase rate for luminance: eye adaptation speed to dark
-        * @type {number}
-        */
-        public luminanceIncreaserate: number = 0.5;
-        /**
-        * Decrease rate for luminance: eye adaptation speed to bright
-        * @type {number}
-        */
-        public luminanceDecreaseRate: number = 0.5;
-
-        // Bright pass
-        /**
-        * Minimum luminance needed to compute HDR
-        * @type {number}
-        */
-        public brightThreshold: number = 0.8;
-
-        /**
-        * Private members
-        */
-        // Gaussian blur
-        private _guassianBlurHPostProcess: PostProcess;
-        private _guassianBlurVPostProcess: PostProcess;
-
-        // Bright pass
-        private _brightPassPostProcess: PostProcess;
-
-        // Texture adder
-        private _textureAdderPostProcess: PostProcess;
-
-        // Down Sampling
-        private _downSampleX4PostProcess: PostProcess;
-
-        // Original Post-process
-        private _originalPostProcess: PostProcess;
-
-        // HDR
-        private _hdrPostProcess: PostProcess;
-        private _hdrCurrentLuminance: number;
-        private _hdrOutputLuminance: number;
-
-        // Luminance generator
-        public static LUM_STEPS: number = 6;
-        private _downSamplePostProcesses: Array<PostProcess>;
-
-        // Global
-        private _scene: Scene;
-        private _needUpdate: boolean = true;
-
-        /**
-         * @constructor
-         * @param {string} name - The rendering pipeline name
-         * @param {BABYLON.Scene} scene - The scene linked to this pipeline
-         * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)
-         * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null.
-         * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to
-         */
-        constructor(name: string, scene: Scene, ratio: number, originalPostProcess: PostProcess = null, cameras?: Camera[]) {
-            super(scene.getEngine(), name);
-
-            this._scene = scene;
-
-            // Bright pass
-            this._createBrightPassPostProcess(scene, ratio);
-
-            // Down sample X4
-            this._createDownSampleX4PostProcess(scene, ratio);
-
-            // Create gaussian blur post-processes
-            this._createGaussianBlurPostProcess(scene, ratio);
-
-            // Texture adder
-            this._createTextureAdderPostProcess(scene, ratio);
-
-            // Luminance generator
-            this._createLuminanceGeneratorPostProcess(scene);
-
-            // HDR
-            this._createHDRPostProcess(scene, ratio);
-
-            // Pass postprocess
-            if (originalPostProcess === null) {
-                this._originalPostProcess = new PassPostProcess("hdr", ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
-            } else {
-                this._originalPostProcess = originalPostProcess;
-            }
-
-            // Configure pipeline
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRPassPostProcess",() => { return this._originalPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRBrightPass",() => { return this._brightPassPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRDownSampleX4",() => { return this._downSampleX4PostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRGaussianBlurH",() => { return this._guassianBlurHPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRGaussianBlurV",() => { return this._guassianBlurVPostProcess; }, true));
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRTextureAdder",() => { return this._textureAdderPostProcess; }, true));
-
-            var addDownSamplerPostProcess = (id: number) => {
-                this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRDownSampler" + id,() => { return this._downSamplePostProcesses[id]; }, true));
-            };
-            for (var i = HDRRenderingPipeline.LUM_STEPS - 1; i >= 0; i--) {
-                addDownSamplerPostProcess(i);
-            }
-
-            this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDR",() => { return this._hdrPostProcess; }, true));
-
-            // Finish
-            scene.postProcessRenderPipelineManager.addPipeline(this);
-
-            if (cameras !== null) {
-                scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);
-            }
-
-            this.update();
-        }
-
-        /**
-        * Tells the pipeline to update its post-processes
-        */
-        public update(): void {
-            this._needUpdate = true;
-        }
-
-        /**
-        * Returns the current calculated luminance
-        */
-        public getCurrentLuminance(): number {
-            return this._hdrCurrentLuminance;
-        }
-
-        /**
-        * Returns the currently drawn luminance
-        */
-        public getOutputLuminance(): number {
-            return this._hdrOutputLuminance;
-        }
-
-        /**
-        * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras
-        */
-        public dispose(): void {
-            for (var i = 0; i < this._scene.cameras.length; i++) {
-                var camera = this._scene.cameras[i];
-
-                this._originalPostProcess.dispose(camera);
-                this._brightPassPostProcess.dispose(camera);
-                this._downSampleX4PostProcess.dispose(camera);
-                this._guassianBlurHPostProcess.dispose(camera);
-                this._guassianBlurVPostProcess.dispose(camera);
-                this._textureAdderPostProcess.dispose(camera);
-
-                for (var j = HDRRenderingPipeline.LUM_STEPS - 1; j >= 0; j--) {
-                    this._downSamplePostProcesses[j].dispose(camera);
-                }
-
-                this._hdrPostProcess.dispose(camera);
-            }
-
-            this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);
-
-            super.dispose();
-        }
-
-        /**
-        * Creates the HDR post-process and computes the luminance adaptation
-        */
-        private _createHDRPostProcess(scene: Scene, ratio: number): void {
-            var hdrLastLuminance = 0.0;
-            this._hdrOutputLuminance = -1.0;
-            this._hdrCurrentLuminance = 1.0;
-            this._hdrPostProcess = new PostProcess("hdr", "hdr", ["exposure", "avgLuminance"], ["otherSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define HDR");
-
-            this._hdrPostProcess.onApply = (effect: Effect) => {
-                if (this._hdrOutputLuminance < 0.0) {
-                    this._hdrOutputLuminance = this._hdrCurrentLuminance;
-                }
-                else {
-                    var dt = (hdrLastLuminance - (hdrLastLuminance + scene.getEngine().getDeltaTime())) / 1000.0;
-
-                    if (this._hdrCurrentLuminance < this._hdrOutputLuminance + this.luminanceDecreaseRate * dt) {
-                        this._hdrOutputLuminance += this.luminanceDecreaseRate * dt;
-                    }
-                    else if (this._hdrCurrentLuminance > this._hdrOutputLuminance - this.luminanceIncreaserate * dt) {
-                        this._hdrOutputLuminance -= this.luminanceIncreaserate * dt;
-                    }
-                    else {
-                        this._hdrOutputLuminance = this._hdrCurrentLuminance;
-                    }
-                }
-
-                this._hdrOutputLuminance = MathTools.Clamp(this._hdrOutputLuminance, this.minimumLuminance, this.maximumLuminance);
-                hdrLastLuminance += scene.getEngine().getDeltaTime();
-
-                effect.setTextureFromPostProcess("textureSampler", this._textureAdderPostProcess);
-                effect.setTextureFromPostProcess("otherSampler", this._originalPostProcess);
-                effect.setFloat("exposure", this.exposure);
-                effect.setFloat("avgLuminance", this._hdrOutputLuminance);
-
-                this._needUpdate = false;
-            };
-
-        }
-
-        /**
-        * Texture Adder post-process
-        */
-        private _createTextureAdderPostProcess(scene: Scene, ratio: number): void {
-            this._textureAdderPostProcess = new PostProcess("hdr", "hdr", [], ["otherSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define TEXTURE_ADDER");
-
-            this._textureAdderPostProcess.onApply = (effect: Effect) => {
-                effect.setTextureFromPostProcess("otherSampler", this._originalPostProcess);
-            };
-        }
-
-        /**
-        * Down sample X4 post-process
-        */
-        private _createDownSampleX4PostProcess(scene: Scene, ratio: number): void {
-            var downSampleX4Offsets = new Array<number>(32);
-            this._downSampleX4PostProcess = new PostProcess("hdr", "hdr", ["dsOffsets"], [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DOWN_SAMPLE_X4");
-
-            this._downSampleX4PostProcess.onApply = (effect: Effect) => {
-                if (this._needUpdate) {
-                    var id = 0;
-                    for (var i = -2; i < 2; i++) {
-                        for (var j = -2; j < 2; j++) {
-                            downSampleX4Offsets[id] = (i + 0.5) * (1.0 / this._downSampleX4PostProcess.width);
-                            downSampleX4Offsets[id + 1] = (j + 0.5) * (1.0 / this._downSampleX4PostProcess.height);
-                            id += 2;
-                        }
-                    }
-                }
-
-                effect.setArray2("dsOffsets", downSampleX4Offsets);
-            };
-        }
-
-        /**
-        * Bright pass post-process
-        */
-        private _createBrightPassPostProcess(scene: Scene, ratio: number): void {
-            var brightOffsets = new Array<number>(8);
-
-            var brightPassCallback = (effect: Effect) => {
-                if (this._needUpdate) {
-                    var sU = (1.0 / this._brightPassPostProcess.width);
-                    var sV = (1.0 / this._brightPassPostProcess.height);
-
-                    brightOffsets[0] = -0.5 * sU;
-                    brightOffsets[1] = 0.5 * sV;
-                    brightOffsets[2] = 0.5 * sU;
-                    brightOffsets[3] = 0.5 * sV;
-                    brightOffsets[4] = -0.5 * sU;
-                    brightOffsets[5] = -0.5 * sV;
-                    brightOffsets[6] = 0.5 * sU;
-                    brightOffsets[7] = -0.5 * sV;
-                }
-
-                effect.setArray2("dsOffsets", brightOffsets);
-                effect.setFloat("brightThreshold", this.brightThreshold);
-            };
-
-            this._brightPassPostProcess = new PostProcess("hdr", "hdr", ["dsOffsets", "brightThreshold"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define BRIGHT_PASS");
-            this._brightPassPostProcess.onApply = brightPassCallback;
-        }
-
-        /**
-        * Luminance generator. Creates the luminance post-process and down sample post-processes
-        */
-        private _createLuminanceGeneratorPostProcess(scene: Scene): void {
-            var lumSteps: number = HDRRenderingPipeline.LUM_STEPS;
-            var luminanceOffsets = new Array<number>(8);
-            var downSampleOffsets = new Array<number>(18);
-            var halfDestPixelSize: number;
-            this._downSamplePostProcesses = new Array<PostProcess>(lumSteps);
-
-            // Utils for luminance
-            var luminanceUpdateSourceOffsets = (width: number, height: number) => {
-                var sU = (1.0 / width);
-                var sV = (1.0 / height);
-
-                luminanceOffsets[0] = -0.5 * sU;
-                luminanceOffsets[1] = 0.5 * sV;
-                luminanceOffsets[2] = 0.5 * sU;
-                luminanceOffsets[3] = 0.5 * sV;
-                luminanceOffsets[4] = -0.5 * sU;
-                luminanceOffsets[5] = -0.5 * sV;
-                luminanceOffsets[6] = 0.5 * sU;
-                luminanceOffsets[7] = -0.5 * sV;
-            };
-
-            var luminanceUpdateDestOffsets = (width: number, height: number) => {
-                var id = 0;
-                for (var x = -1; x < 2; x++) {
-                    for (var y = -1; y < 2; y++) {
-                        downSampleOffsets[id] = (x) / width;
-                        downSampleOffsets[id + 1] = (y) / height;
-                        id += 2;
-                    }
-                }
-            };
-
-            // Luminance callback
-            var luminanceCallback = (effect: Effect) => {
-                if (this._needUpdate) {
-                    luminanceUpdateSourceOffsets(this._textureAdderPostProcess.width, this._textureAdderPostProcess.height);
-                }
-
-                effect.setTextureFromPostProcess("textureSampler", this._textureAdderPostProcess);
-                effect.setArray2("lumOffsets", luminanceOffsets);
-            }
-
-            // Down sample callbacks
-            var downSampleCallback = (indice: number) => {
-                var i = indice;
-                return (effect: Effect) => {
-                    luminanceUpdateSourceOffsets(this._downSamplePostProcesses[i].width, this._downSamplePostProcesses[i].height);
-                    luminanceUpdateDestOffsets(this._downSamplePostProcesses[i].width, this._downSamplePostProcesses[i].height);
-                    halfDestPixelSize = 0.5 / this._downSamplePostProcesses[i].width;
-
-                    effect.setTextureFromPostProcess("textureSampler", this._downSamplePostProcesses[i + 1]);
-                    effect.setFloat("halfDestPixelSize", halfDestPixelSize);
-                    effect.setArray2("dsOffsets", downSampleOffsets);
-                }
-            };
-
-            var downSampleAfterRenderCallback = (effect: Effect) => {
-                // Unpack result
-                var pixel = scene.getEngine().readPixels(0, 0, 1, 1);
-                var bit_shift = new Vector4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
-                this._hdrCurrentLuminance = (pixel[0] * bit_shift.x + pixel[1] * bit_shift.y + pixel[2] * bit_shift.z + pixel[3] * bit_shift.w) / 100.0;
-            };
-
-            // Create luminance post-process
-            var ratio = { width: Math.pow(3, lumSteps - 1), height: Math.pow(3, lumSteps - 1) };
-            this._downSamplePostProcesses[lumSteps - 1] = new PostProcess("hdr", "hdr", ["lumOffsets"], [], ratio, null, Texture.NEAREST_SAMPLINGMODE, scene.getEngine(), false, "#define LUMINANCE_GENERATOR", Engine.TEXTURETYPE_FLOAT);
-            this._downSamplePostProcesses[lumSteps - 1].onApply = luminanceCallback;
-
-            // Create down sample post-processes
-            for (var i = lumSteps - 2; i >= 0; i--) {
-                var length = Math.pow(3, i);
-                ratio = { width: length, height: length };
-
-                var defines = "#define DOWN_SAMPLE\n";
-                if (i === 0) {
-                    defines += "#define FINAL_DOWN_SAMPLE\n"; // To pack the result
-                }
-
-                this._downSamplePostProcesses[i] = new PostProcess("hdr", "hdr", ["dsOffsets", "halfDestPixelSize"], [], ratio, null, Texture.NEAREST_SAMPLINGMODE, scene.getEngine(), false, defines, Engine.TEXTURETYPE_FLOAT);
-                this._downSamplePostProcesses[i].onApply = downSampleCallback(i);
-
-                if (i === 0) {
-                    this._downSamplePostProcesses[i].onAfterRender = downSampleAfterRenderCallback;
-                }
-            }
-        }
-
-        /**
-        * Gaussian blur post-processes. Horizontal and Vertical
-        */
-        private _createGaussianBlurPostProcess(scene: Scene, ratio: number): void {
-            var blurOffsetsW = new Array<number>(9);
-            var blurOffsetsH = new Array<number>(9);
-            var blurWeights = new Array<number>(9);
-            var uniforms: string[] = ["blurOffsets", "blurWeights", "multiplier"];
-
-            // Utils for gaussian blur
-            var calculateBlurOffsets = (height: boolean) => {
-                var lastOutputDimensions: any = {
-                    width: scene.getEngine().getRenderWidth(),
-                    height: scene.getEngine().getRenderHeight()
-                };
-
-                for (var i = 0; i < 9; i++) {
-                    var value = (i - 4.0) * (1.0 / (height === true ? lastOutputDimensions.height : lastOutputDimensions.width));
-                    if (height) {
-                        blurOffsetsH[i] = value;
-                    } else {
-                        blurOffsetsW[i] = value;
-                    }
-                }
-            };
-
-            var calculateWeights = () => {
-                var x: number = 0.0;
-
-                for (var i = 0; i < 9; i++) {
-                    x = (i - 4.0) / 4.0;
-                    blurWeights[i] = this.gaussCoeff * (1.0 / Math.sqrt(2.0 * Math.PI * this.gaussStandDev)) * Math.exp((-((x - this.gaussMean) * (x - this.gaussMean))) / (2.0 * this.gaussStandDev * this.gaussStandDev));
-                }
-            }
-
-            // Callback
-            var gaussianBlurCallback = (height: boolean) => {
-                return (effect: Effect) => {
-                    if (this._needUpdate) {
-                        calculateWeights();
-                        calculateBlurOffsets(height);
-                    }
-                    effect.setArray("blurOffsets", height ? blurOffsetsH : blurOffsetsW);
-                    effect.setArray("blurWeights", blurWeights);
-                    effect.setFloat("multiplier", this.gaussMultiplier);
-                };
-            };
-
-            // Create horizontal gaussian blur post-processes
-            this._guassianBlurHPostProcess = new PostProcess("hdr", "hdr", uniforms, [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define GAUSSIAN_BLUR_H");
-            this._guassianBlurHPostProcess.onApply = gaussianBlurCallback(false);
-
-            // Create vertical gaussian blur post-process
-            this._guassianBlurVPostProcess = new PostProcess("hdr", "hdr", uniforms, [], ratio / 4, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define GAUSSIAN_BLUR_V");
-            this._guassianBlurVPostProcess.onApply = gaussianBlurCallback(true);
-        }
-    }
-}

+ 0 - 163
src/Shaders/hdr.fragment.fx

@@ -1,163 +0,0 @@
-uniform sampler2D textureSampler;
-varying vec2 vUV;
-
-#if defined(GAUSSIAN_BLUR_H) || defined(GAUSSIAN_BLUR_V)
-uniform float blurOffsets[9];
-uniform float blurWeights[9];
-uniform float multiplier;
-
-void main(void) {
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-
-	for (int i = 0; i < 9; i++) {
-		#ifdef GAUSSIAN_BLUR_H
-		color += (texture2D(textureSampler, vUV + vec2(blurOffsets[i] * multiplier, 0.0)) * blurWeights[i]);
-		#else
-		color += (texture2D(textureSampler, vUV + vec2(0.0, blurOffsets[i] * multiplier)) * blurWeights[i]);
-		#endif
-	}
-
-	color.a = 1.0;
-	gl_FragColor = color;
-}
-#endif
-
-#if defined(TEXTURE_ADDER)
-uniform sampler2D otherSampler;
-
-void main() {
-	vec4 sum = texture2D(textureSampler, vUV) + texture2D(otherSampler, vUV);
-	sum.a = clamp(sum.a, 0.0, 1.0);
-
-	gl_FragColor = sum;
-}
-#endif
-
-#if defined(LUMINANCE_GENERATOR)
-uniform vec2 lumOffsets[4];
-
-void main() {
-	float average = 0.0;
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-	float maximum = -1e20;
-
-	for (int i = 0; i < 4; i++) {
-		color = texture2D(textureSampler, vUV + lumOffsets[i]);
-
-		float GreyValue = length(color.rgb);
-
-		maximum = max(maximum, GreyValue);
-		average += (0.25 * log(1e-5 + GreyValue));
-	}
-
-	average = exp(average);
-
-	gl_FragColor = vec4(average, maximum, 0.0, 1.0);
-
-}
-#endif
-
-#if defined(DOWN_SAMPLE)
-uniform vec2 dsOffsets[9];
-uniform float halfDestPixelSize;
-
-#ifdef FINAL_DOWN_SAMPLE
-vec4 pack(float value) {
-	const vec4 bit_shift = vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0);
-	const vec4 bit_mask = vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
-
-	vec4 res = fract(value * bit_shift);
-	res -= res.xxyz * bit_mask;
-
-	return res;
-}
-#endif
-
-void main() {
-	vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
-	float average = 0.0;
-
-	for (int i = 0; i < 9; i++) {
-		color = texture2D(textureSampler, vUV + vec2(halfDestPixelSize, halfDestPixelSize) + dsOffsets[i]);
-		average += color.r;
-	}
-
-	average /= 9.0;
-
-	#ifndef FINAL_DOWN_SAMPLE
-	gl_FragColor = vec4(average, average, 0.0, 1.0);
-	#else
-	gl_FragColor = pack(average);
-	#endif
-}
-#endif
-
-#if defined(BRIGHT_PASS)
-uniform vec2 dsOffsets[4];
-uniform float brightThreshold;
-
-void main() {
-	vec4 average = vec4(0.0, 0.0, 0.0, 0.0);
-
-	average = texture2D(textureSampler, vUV + vec2(dsOffsets[0].x, dsOffsets[0].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[1].x, dsOffsets[1].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[2].x, dsOffsets[2].y));
-	average += texture2D(textureSampler, vUV + vec2(dsOffsets[3].x, dsOffsets[3].y));
-
-	average *= 0.25;
-
-	float luminance = length(average.rgb);
-
-	if (luminance < brightThreshold) {
-		average = vec4(0.0, 0.0, 0.0, 1.0);
-	}
-
-	gl_FragColor = average;
-}
-#endif
-
-#if defined(DOWN_SAMPLE_X4)
-uniform vec2 dsOffsets[16];
-
-void main() {
-	vec4 average = vec4(0.0, 0.0, 0.0, 0.0);
-
-	average = texture2D(textureSampler, vUV + dsOffsets[0]);
-	average += texture2D(textureSampler, vUV + dsOffsets[1]);
-	average += texture2D(textureSampler, vUV + dsOffsets[2]);
-	average += texture2D(textureSampler, vUV + dsOffsets[3]);
-	average += texture2D(textureSampler, vUV + dsOffsets[4]);
-	average += texture2D(textureSampler, vUV + dsOffsets[5]);
-	average += texture2D(textureSampler, vUV + dsOffsets[6]);
-	average += texture2D(textureSampler, vUV + dsOffsets[7]);
-	average += texture2D(textureSampler, vUV + dsOffsets[8]);
-	average += texture2D(textureSampler, vUV + dsOffsets[9]);
-	average += texture2D(textureSampler, vUV + dsOffsets[10]);
-	average += texture2D(textureSampler, vUV + dsOffsets[11]);
-	average += texture2D(textureSampler, vUV + dsOffsets[12]);
-	average += texture2D(textureSampler, vUV + dsOffsets[13]);
-	average += texture2D(textureSampler, vUV + dsOffsets[14]);
-	average += texture2D(textureSampler, vUV + dsOffsets[15]);
-
-	average /= 16.0;
-
-	gl_FragColor = average;
-}
-#endif
-
-#if defined(HDR)
-uniform sampler2D otherSampler;
-
-uniform float exposure;
-uniform float avgLuminance;
-
-void main() {
-	vec4 color = texture2D(textureSampler, vUV) + texture2D(otherSampler, vUV);
-	vec4 adjustedColor = color / avgLuminance * exposure;
-
-	color = adjustedColor;
-	color.a = 1.0;
-
-	gl_FragColor = color;
-}
-#endif