Browse Source

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

Lasse Öörni 11 years ago
parent
commit
b6e854eb27
1 changed files with 5 additions and 0 deletions
  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);
     vec3 worldPos = GetWorldPos(modelMatrix);
     gl_Position = GetClipPos(worldPos);
     gl_Position = GetClipPos(worldPos);
 
 
+    #ifndef GL_ES
     gl_Position.z = gl_Position.w;
     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;
     vTexCoord = iPos.xyz;
 }
 }