From 86235bb4a36b9b1e3e2f81f6b54d8b9e96837cc6 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 23 Jul 2018 15:15:05 +0200 Subject: [PATCH 1/2] Float math in alpha calculation causes some punch-through textures to have alpha noise. --- core/rend/gles/gles.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 64c8f406a..48fa1ce1e 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -336,7 +336,11 @@ void main() \n\ } \n\ #endif\n\ #if cp_AlphaTest == 1 \n\ - if (cp_AlphaTestValue>color.a) discard;\n\ + color.a = round(color.a * 255.0) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ + if (cp_AlphaTestValue>color.a) \n\ + discard;\n\ + else \n\ + color.a = 1.0; \n\ #endif \n\ //color.rgb=vec3(vtx_xyz.z/255.0);\n" #ifndef GLES From 2e08d7a6c9b038cd27d1335d87cb7915e6c35b95 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 23 Jul 2018 20:55:53 +0200 Subject: [PATCH 2/2] round() not available in GLES2. Using floor() instead --- core/rend/gles/gles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 48fa1ce1e..f650daf9d 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -336,7 +336,7 @@ void main() \n\ } \n\ #endif\n\ #if cp_AlphaTest == 1 \n\ - color.a = round(color.a * 255.0) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ + color.a = floor(color.a * 255.0 + 0.5) / 255.0; // Fixes noised cars in Jet Grind Radio \n\ if (cp_AlphaTestValue>color.a) \n\ discard;\n\ else \n\