I am struggling to get the next simple algorithm working in the Samsung Galaxy SIII
float rand(vec2 co)
{
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
....
vec3 color = texture2D(u_texture, v_texcoord);
gl_FragColor.rgb = color + vec3(rand(gl_FragCoord.xy + time / 1000.0));
....
The code generates perfectly the expected noise in Samsung Galaxy S1 and Google Nexus S. But it fails completely in the new smartphone which uses ARM's Mali-400/MP4.
Anyone can spot anything wrong with this algorithm? Or maybe understand why could it fail?
Your problem likely comes from taking the sin
of a big number. The result of this depends on the exact implementation of sin
, which is not available. Obviously the sin
function used by the Mali chip has more predictable results with big numbers than the others.
It seems to me that you should use an actual noise function, not this thing. At least it will have predictable results across hardware.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With