I am currently developing a Ren’Py game and I am testing it on an S23 and an A51 Galaxy. However my S23 device has an issue displaying a shader correctly where the A51 does not. I mentioned the issue to the Ren’Py devs however they cannot reproduce the errors on their devices. We concluded it must be a device issue. Has anybody else that this issue on their S23 device?
opened 01:28AM - 20 Jul 24 UTC
closed 10:29PM - 20 Jul 24 UTC
I'm trying to create an animated shader ripple effect, with the ripples center d… etermined by mouse position.
The shader works correctly on the PC Build (Win10 64-bit) and on my old phone running on Android 13.
But on my new phone running on Android 14, the shader calculations "freeze" when you reach a certain distance from the center.
With "freeze" I mean the last calculated value after the certain distance remains the same for the rest of the shader.
```
renpy.register_shader("example.ripp",
variables="""
uniform vec2 u_mPos;
uniform sampler2D tex0;
uniform vec2 res0;
attribute vec4 a_position;
varying vec4 v_position;
attribute vec2 a_tex_coord;
varying vec2 v_tex_coord;
uniform float u_time;
uniform vec4 u_viewport;
uniform float u_t0;
""",
vertex_300="""
v_tex_coord = a_tex_coord;
v_position = a_position;
""",
fragment_300="""
vec2 cPos;
float cLength;
vec2 uv;
float A;
cPos = u_mPos;
A=1e-1;
cLength = distance(v_position.xy, cPos);
/*cLength = length(v_position.xy - cPos);*/
float phi = cLength*5e-1 - 0.0*(u_time-u_t0)*100.0;
uv = v_tex_coord + vec2(0.0, A*sin(cLength));
gl_FragColor = texture2D(tex0, uv, 0.0);
"""
)
```
I have tried multiple different ways of calculations to reach the proper effect on Android 14, but to no avail.
The code works as expected when you replace v_position with gl_FragCoord, but gl_FragCoord comes with alot of other issues (positioning, viewport size, window scaling, etc.). I have been able to deduce that the bug arises from the combination of v_position and the built-in math functions in openGL. I'm using Renpy 8.2.3. Ripples should fill the full viewport as it does on my PC and Android 13 phone, but ripples are limited to a certain area from the center point on my Android 14 phone, outside this area the rest of the texture just receives a constant offset.
Hello
Please create a support request in Samsung Developer support channel ( Developer Support | Samsung Developers )