C
Cone
Guest
Hello! I made a basic shader that creates a ripple effect, and while it looks really nice on Windows, when I test things out on Android, the shader goes out the window. It works similarly, but it looks as if the shader pauses every few frames, and the effect looks a lot choppier.
I'm guessing it might be to do with the way Android converts screen coordinates and that the shader might be working off of scaled up screen coordinates, or that float precision on Android is a lot lower.
In fact, if I add a floor() function around the (rip.y * 1440.0) and (time * 0.06) in the code below, the pausing and choppiness can be replicated on Windows. Either way, I really don't want to resort to the old draw_sprite_part_ext in a for loop method, as that's horribly slower and just nastier. Is there anyone that can help me figure out a way to get this working correctly? I would appreciate it!
I'm guessing it might be to do with the way Android converts screen coordinates and that the shader might be working off of scaled up screen coordinates, or that float precision on Android is a lot lower.
In fact, if I add a floor() function around the (rip.y * 1440.0) and (time * 0.06) in the code below, the pausing and choppiness can be replicated on Windows. Either way, I really don't want to resort to the old draw_sprite_part_ext in a for loop method, as that's horribly slower and just nastier. Is there anyone that can help me figure out a way to get this working correctly? I would appreciate it!
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float time; // Incremented by 1 every frame;
void main()
{
vec2 rip= v_vTexcoord;
rip.x = rip.x + (sin((rip.y * 1440.0) + (time * 0.06)) * 0.0005);
// rip.x = rip.x + (sin(floor(rip.y * 1440.0) + floor(time * 0.06)) * 0.0005); //It looks like this on Android!!
gl_FragColor = texture2D(gm_BaseTexture, rip);
}