We recently released our game on Google Play, and it is going great.
Though on devices with Mali T628 (Galaxy Tab S, Galaxy Note 3) there is an issue with texture coordinates..
Works fine on all other platforms.
I found a post here about there being an issue with mediump, but we are using highp in our shader.
I'm attaching a screen shot here, and the relevant shaders.
Any ideas what could go wrong?
This shader is for the environment (not working):
+++
Loaded vertex shader: bmxshaders/MultiTextureT0T2.vsh - ID: 4
precision highp float;
attribute vec4 a_position;
attribute vec2 a_texCoord0;
attribute vec2 a_texCoord2;
varying vec2 v_texCoord0;
varying vec2 v_texCoord2;
uniform mat4 u_matWVP;
void main()
{
gl_Position = u_matWVP * a_position;
v_texCoord0 = a_texCoord0;
v_texCoord2 = a_texCoord2;
}
---
Loaded pixel shader bmxshaders/MultiTextureT0s1d0T2s2d0.fsh - ID: 5
uniform sampler2D s_texture0;
uniform sampler2D s_texture2;
vec4 color0;
vec4 color1;
color0 = texture2D(s_texture0, v_texCoord0);
color1 = texture2D(s_texture2, v_texCoord2);
gl_FragColor = color0 * color1;
This shader is for the bike (seems to work fine):
Loaded vertex shader: bmxshaders/LightingSimpleDirNoScaleNormals.vsh - ID: 16
struct light
vec3 position;
vec4 ambient;
vec4 diffuse;
vec4 specular;
// only directional light is supported
};
const float c_zero = 0.0;
const float c_one = 1.0;
uniform light u_light0;
attribute vec3 a_normal;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
varying vec4 v_color;
uniform mat3 u_matWVNormals;
float ndotl;
vec3 n;
n = u_matWVNormals * a_normal;
v_color = vec4(0,0,0,1);
v_color += u_light0.ambient;
ndotl = max(dot(u_light0.position.xyz,n), c_zero);
v_color += (ndotl * u_light0.diffuse);
v_texCoord = a_texCoord;
Loaded pixel shader bmxshaders/Lighting.fsh - ID: 17
gl_FragColor = texture2D(s_texture0, v_texCoord) * v_color;
Hi olof,
I've taken a quick look at what's going on when running the game on a T628 device and can reproduce the issue. I think it could well be caused by the precision of your samplers in Shader 7, attached to Program 4.
Could you try declaring the uniform samplers as highp and see if it helps?
+ uniform highp sampler2D s_texture0;
+ uniform highp sampler2D s_texture2;
Cheers,
Rich
Hi Rich,
That's great!
Unfortunately, I still do not have a device to test with, but I added your proposed fix to version 1.14 which is currently making its way through Googles servers to be published.
It would be awesome if you could check if it makes a difference when the update comes through.
Olof
Awesome. Let me know when the fixed version go lives and I'll test if the change addresses the issue on device
Hi Olof,
I've downloaded the update from Google Play, version 1.14 as you said and run it on test devices. I can see the issue is still present though. I have completely uninstalled and reinstalled and can see it.
I have done some tracing of the application and can see that the source for shader 7 hasn't changed and so the samplers still aren't declared as highp. Could you double check that the updated version was definitely pushed to the play store?
Hi,
Sorry about that
The updated resources didn't get uploaded, I'll post here again when they are.
No Worries
Another update is out now, with the patched resources, hope it works better this time
Sorry for the delay in getting back to you. I have been able to download and test the latest version of the game from Google Play Store and can confirm that the changes made to the shaders haven't fixed the issues being experienced on any of the T6XX devices I have tested with. I have been able to test a number of fixes internally but haven't yet isolated the cause of the issue.
To help at our end are you able to provide any reproducer code which we can investigate, rendering just the crane for example, as I am a little limited just being able to modify shader source at run-time. If you would rather not share it here, please feel free to contact me privately where I can assist further.
In the meantime, I am actively continuing to look into the problem and will of course let you know if I have any news. Could I also suggest that, for performance reasons on other platforms, you revert the changes to the shader code in your public release as it doesn't fix the issue.
Many Thanks,
No problem, it's awesome that you are helping us! I think it might be a bit tricky for me to provide reproduction code, its running in an early version of our in house engine, and it might be hard to isolate the relevant parts. I'll look into what I can do and what I am allowed to share.
If you have any ideas of things to try, or debug outputs I could add, I could also provide you with special builds by mail or ftp, bypassing the Google Play store.
Thanks!
If you'd like to give me a PM I can give you details on how best to contact more directly through email and it will also help at my end with correspondence being logged to work tickets automatically. I can also give you feedback on what I've found so far.
Thanks,