Jelajahi Sumber

On OpenGL ES offset the skybox slightly in front of the far plane to avoid clipping artifacts from inaccuracy. Closes #517.

Lasse Öörni 11 tahun lalu
induk
melakukan
b6e854eb27
1 mengubah file dengan 5 tambahan dan 0 penghapusan
  1. 5 0
      Bin/CoreData/Shaders/GLSL/Skybox.glsl

+ 5 - 0
Bin/CoreData/Shaders/GLSL/Skybox.glsl

@@ -10,7 +10,12 @@ void VS()
     vec3 worldPos = GetWorldPos(modelMatrix);
     gl_Position = GetClipPos(worldPos);
 
+    #ifndef GL_ES
     gl_Position.z = gl_Position.w;
+    #else
+    // On OpenGL ES force Z slightly in front of far plane to avoid clipping artifacts due to inaccuracy
+    gl_Position.z = 0.999 * gl_Position.w;
+    #endif
     vTexCoord = iPos.xyz;
 }