Quellcode durchsuchen

remove grain from imageprocessing now that it has been separated

Trevor Baron vor 7 Jahren
Ursprung
Commit
f04a29233c

+ 0 - 1
src/Materials/Background/babylon.backgroundMaterial.ts

@@ -83,7 +83,6 @@
         public SAMPLER3DBGRMAP = false;
         public IMAGEPROCESSINGPOSTPROCESS = false;
         public EXPOSURE = false;
-        public GRAIN = false;
 
         // Reflection.
         public REFLECTION = false;

+ 0 - 1
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -120,7 +120,6 @@
         public SAMPLER3DBGRMAP = false;
         public IMAGEPROCESSINGPOSTPROCESS = false;
         public EXPOSURE = false;
-        public GRAIN = false;
 
         public USEPHYSICALLIGHTFALLOFF = false;
         public TWOSIDEDLIGHTING = false;

+ 1 - 64
src/Materials/babylon.imageProcessingConfiguration.ts

@@ -18,10 +18,6 @@ module BABYLON {
         SAMPLER3DGREENDEPTH: boolean;
         SAMPLER3DBGRMAP: boolean;
         IMAGEPROCESSINGPOSTPROCESS: boolean;
-        /** 
-         * If the grain should be performed in the image processing shader.
-         */
-        GRAIN: boolean;
     }
 
     /**
@@ -221,57 +217,6 @@ module BABYLON {
         public vignetteCameraFov = 0.5;
 
         @serialize()
-        private _grainEnabled = false;
-
-        /**
-         * If the grain effect should be enabled.
-         */
-        public get grainEnabled(): boolean {
-            return this._grainEnabled;
-        }
-        public set grainEnabled(value: boolean) {
-            if (this._grainEnabled === value) {
-                return;
-            }
-
-            this._grainEnabled = value;
-            this._updateParameters();
-        }
-
-        @serialize()
-        private _grainIntensity = 30;
-        /**
-         * Amount of grain to be applied by the grain effect.
-         */
-        public get grainIntensity(): number {
-            return this._grainIntensity;
-        }
-        public set grainIntensity(value: number) {
-            if (this._grainIntensity === value) {
-                return;
-            }
-            this._grainIntensity = value;
-        }
-
-        @serialize()
-        private _grainAnimated = false;
-
-        /**
-         * If the grain effect should be animated.
-         */
-        public get grainAnimated(): boolean {
-            return this._grainAnimated;
-        }
-        public set grainAnimated(value: boolean) {
-            if (this._grainAnimated === value) {
-                return;
-            }
-
-            this._grainAnimated = value;
-            this._updateParameters();
-        }
-
-        @serialize()
         private _vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;
         /**
          * Gets the vignette blend mode allowing different kind of effect.
@@ -391,10 +336,6 @@ module BABYLON {
             if (defines.COLORCURVES) {
                 ColorCurves.PrepareUniforms(uniforms);
             }
-            if (defines.GRAIN){
-                uniforms.push("grainVarianceAmount");
-                uniforms.push("grainAnimatedSeed");
-            }
         }
 
         /**
@@ -442,8 +383,7 @@ module BABYLON {
             defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;
             defines.SAMPLER3DBGRMAP = this.colorGradingBGR;
             defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;
-            defines.GRAIN = this.grainEnabled;
-            defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING || defines.GRAIN;
+            defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING;
         }
 
         /**
@@ -501,9 +441,6 @@ module BABYLON {
                     this.colorGradingTexture.level // weight
                 );
             }
-
-            effect.setFloat("grainVarianceAmount", this.grainIntensity);
-            effect.setFloat("grainAnimatedSeed", this.grainAnimated ? Math.random() + 1 : 1);
         }
 
         /**

+ 0 - 1
src/Materials/babylon.standardMaterial.ts

@@ -88,7 +88,6 @@ module BABYLON {
         public SAMPLER3DBGRMAP = false;
         public IMAGEPROCESSINGPOSTPROCESS = false;
         public EXPOSURE = false;
-        public GRAIN = false;
 
         constructor() {
             super();

+ 0 - 40
src/PostProcess/babylon.imageProcessingPostProcess.ts

@@ -272,45 +272,6 @@
             this.imageProcessingConfiguration.vignetteEnabled = value;
         }
 
-        /**
-         * Gets wether the grain effect is enabled.
-         */
-        public get grainEnabled(): boolean {
-            return this.imageProcessingConfiguration.grainEnabled;
-        }
-        /**
-         * Sets wether the grain effect is enabled.
-         */
-        public set grainEnabled(value: boolean) {
-            this.imageProcessingConfiguration.grainEnabled = value;
-        }
-
-        /**
-         * Gets the grain effect's intensity.
-         */
-        public get grainIntensity(): number {
-            return this.imageProcessingConfiguration.grainIntensity;
-        }
-        /**
-         * Sets the grain effect's intensity.
-         */
-        public set grainIntensity(value: number) {
-            this.imageProcessingConfiguration.grainIntensity = value;
-        }
-
-        /**
-         * Gets wether the grain effect is animated.
-         */
-        public get grainAnimated(): boolean {
-            return this.imageProcessingConfiguration.grainAnimated;
-        }
-        /**
-         * Sets wether the grain effect is animated.
-         */
-        public set grainAnimated(value: boolean) {
-            this.imageProcessingConfiguration.grainAnimated = value;
-        }
-
         @serialize()
         private _fromLinearSpace = true;
         /**
@@ -349,7 +310,6 @@
             SAMPLER3DBGRMAP: false,
             IMAGEPROCESSINGPOSTPROCESS: false,
             EXPOSURE: false,
-            GRAIN: false,
         }
 
         constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, imageProcessingConfiguration?: ImageProcessingConfiguration) {

+ 0 - 5
src/Shaders/ShadersInclude/imageProcessingDeclaration.fx

@@ -25,9 +25,4 @@
 		uniform sampler2D txColorTransform;
 	#endif
 	uniform vec4 colorTransformSettings;
-#endif
-
-#ifdef GRAIN
-	uniform float grainVarianceAmount;
-	uniform float grainAnimatedSeed;
 #endif

+ 3 - 5
src/Shaders/background.fragment.fx

@@ -287,11 +287,9 @@ vec4 color = vec4(finalColor, finalAlpha);
     color.rgb *= color.a;
 #endif
 
-#ifndef GRAIN // Do not apply noise multiple times
-    #ifdef NOISE
-        color.rgb += dither(vPositionW.xy, 0.5);
-        color = max(color, 0.0);
-    #endif
+#ifdef NOISE
+    color.rgb += dither(vPositionW.xy, 0.5);
+    color = max(color, 0.0);
 #endif
 
     gl_FragColor = color;

+ 0 - 12
src/Shaders/imageProcessing.fragment.fx

@@ -18,18 +18,6 @@ void main(void)
 		result.rgb = toLinearSpace(result.rgb);
 	#endif
 
-	#ifdef GRAIN
-		vec2 seed = vUV*(grainAnimatedSeed);
-		float grain = dither(seed, grainVarianceAmount);
-
-		// Add less grain when luminance is high or low
-		float lum = getLuminance(result.rgb);
-		float grainAmount = (cos(-PI + (lum*PI*2.))+1.)/2.;
-		result.rgb += grain * grainAmount;
-
-		result.rgb = max(result.rgb, 0.0);
-	#endif
-
 	result = applyImageProcessing(result);
 #else
 	// In case where the input is in linear space we at least need to put it back in gamma.