Browse Source

Tweaked lighting pass in deferred shading example.

Much faster with "discard" (56 fps => 88 fps).
alteredq 12 years ago
parent
commit
1697a4d63d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      examples/webgl_lights_deferred_pointlights.html

+ 4 - 0
examples/webgl_lights_deferred_pointlights.html

@@ -292,12 +292,16 @@
 
 				"float z = texture2D( samplerDepth, texCoord ).x;"+
 
+				/*
 				"if ( z == 0.0 ) {"+
 
 					"gl_FragColor = vec4( vec3( 0.0 ), 1.0 );"+
 					"return;"+
 
 				"}"+
+				*/
+
+				"if ( z == 0.0 ) discard;"+
 
 				"float x = texCoord.x * 2.0 - 1.0;"+
 				"float y = texCoord.y * 2.0 - 1.0;"+