Bladeren bron

samples will not generate negative f error anymore

Nima 11 jaren geleden
bovenliggende
commit
ec13c4c36c
2 gewijzigde bestanden met toevoegingen van 2 en 2 verwijderingen
  1. 1 1
      examples/webgl_lights_hemisphere.html
  2. 1 1
      examples/webgl_materials_lightmap.html

+ 1 - 1
examples/webgl_lights_hemisphere.html

@@ -84,7 +84,7 @@
 			void main() {
 
 				float h = normalize( vWorldPosition + offset ).y;
-				gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( h, exponent ), 0.0 ) ), 1.0 );
+				gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h , 0.0), exponent ), 0.0 ) ), 1.0 );
 
 			}
 

+ 1 - 1
examples/webgl_materials_lightmap.html

@@ -58,7 +58,7 @@
 			void main() {
 
 				float h = normalize( vWorldPosition + offset ).y;
-				gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( h, exponent ), 0.0 ) ), 1.0 );
+				gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h, 0.0 ), exponent ), 0.0 ) ), 1.0 );
 
 			}