浏览代码

avoid converting to linear space in shader

Trevor Baron 7 年之前
父节点
当前提交
b4e49da8e7
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      src/PostProcess/babylon.extractHighlightsPostProcess.ts
  2. 1 1
      src/Shaders/extractHighlights.fragment.fx

+ 1 - 1
src/PostProcess/babylon.extractHighlightsPostProcess.ts

@@ -17,7 +17,7 @@ module BABYLON {
                 if(this._inputPostProcess){
                 if(this._inputPostProcess){
                     effect.setTextureFromPostProcess("textureSampler", this._inputPostProcess);
                     effect.setTextureFromPostProcess("textureSampler", this._inputPostProcess);
                 }
                 }
-                effect.setFloat('threshold', this.threshold);
+                effect.setFloat('threshold', Math.pow(this.threshold, BABYLON.ToGammaSpace));
             })
             })
         }
         }
     }
     }

+ 1 - 1
src/Shaders/extractHighlights.fragment.fx

@@ -8,6 +8,6 @@ uniform float threshold;
 void main(void) 
 void main(void) 
 {
 {
 	gl_FragColor = texture2D(textureSampler, vUV);
 	gl_FragColor = texture2D(textureSampler, vUV);
-	float luma = getLuminance(toLinearSpace(gl_FragColor.rgb));
+	float luma = getLuminance(gl_FragColor.rgb);
 	gl_FragColor.rgb = step(threshold, luma) * gl_FragColor.rgb;
 	gl_FragColor.rgb = step(threshold, luma) * gl_FragColor.rgb;
 }
 }