Explorar o código

fixed pixel snap precision artifact

clayjohn %!s(int64=6) %!d(string=hai) anos
pai
achega
b804c491b7
Modificáronse 2 ficheiros con 6 adicións e 0 borrados
  1. 3 0
      drivers/gles2/shaders/canvas.glsl
  2. 3 0
      drivers/gles3/shaders/canvas.glsl

+ 3 - 0
drivers/gles2/shaders/canvas.glsl

@@ -162,6 +162,9 @@ VERTEX_SHADER_CODE
 
 #ifdef USE_PIXEL_SNAP
 	outvec.xy = floor(outvec + 0.5).xy;
+	// precision issue on some hardware creates artifacts within texture
+	// offset uv by a small amount to avoid
+	uv += 1e-5;
 #endif
 
 #ifdef USE_SKELETON

+ 3 - 0
drivers/gles3/shaders/canvas.glsl

@@ -173,6 +173,9 @@ VERTEX_SHADER_CODE
 
 #ifdef USE_PIXEL_SNAP
 	outvec.xy = floor(outvec + 0.5).xy;
+	// precision issue on some hardware creates artifacts within texture
+	// offset uv by a small amount to avoid
+	uv_interp += 1e-5;
 #endif
 
 #ifdef USE_SKELETON