Ver Fonte

move fog_fragment after encoding, the reason is the background/fog colors are not encoded and we need to get perfect blends.

Ben Houston há 9 anos atrás
pai
commit
c47accd046

+ 3 - 3
src/renderers/shaders/ShaderChunk/fog_fragment.glsl

@@ -19,7 +19,7 @@
 		float fogFactor = smoothstep( fogNear, fogFar, depth );
 		float fogFactor = smoothstep( fogNear, fogFar, depth );
 
 
 	#endif
 	#endif
-	
-	outgoingLight = mix( outgoingLight, fogColor, fogFactor );
 
 
-#endif
+	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
+
+#endif

+ 2 - 2
src/renderers/shaders/ShaderLib/linedashed_frag.glsl

@@ -27,8 +27,8 @@ void main() {
 
 
 	outgoingLight = diffuseColor.rgb; // simple shader
 	outgoingLight = diffuseColor.rgb; // simple shader
 
 
-	#include <fog_fragment>
-
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }

+ 2 - 1
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl

@@ -41,8 +41,9 @@ void main() {
 	vec3 outgoingLight = reflectedLight.indirectDiffuse;
 	vec3 outgoingLight = reflectedLight.indirectDiffuse;
 
 
 	#include <envmap_fragment>
 	#include <envmap_fragment>
-	#include <fog_fragment>
 
 
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }

+ 2 - 1
src/renderers/shaders/ShaderLib/meshlambert_frag.glsl

@@ -68,8 +68,9 @@ void main() {
 	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;
 	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveLight;
 
 
 	#include <envmap_fragment>
 	#include <envmap_fragment>
-	#include <fog_fragment>
 
 
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }

+ 2 - 2
src/renderers/shaders/ShaderLib/meshphong_frag.glsl

@@ -53,8 +53,8 @@ void main() {
 
 
 	#include <envmap_fragment>
 	#include <envmap_fragment>
 
 
-	#include <fog_fragment>
-
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }

+ 2 - 2
src/renderers/shaders/ShaderLib/meshstandard_frag.glsl

@@ -64,8 +64,8 @@ void main() {
 
 
 	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;
 	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;
 
 
-	#include <fog_fragment>
-
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }

+ 2 - 2
src/renderers/shaders/ShaderLib/points_frag.glsl

@@ -20,8 +20,8 @@ void main() {
 
 
 	outgoingLight = diffuseColor.rgb;
 	outgoingLight = diffuseColor.rgb;
 
 
-	#include <fog_fragment>
-
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );
 
 
+	#include <fog_fragment>
+
 }
 }