I'm looking for a noise function wich is working on a none highp fragment shader.
What I have tried:
//http://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl
float snoise(vec2 co)
{
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
//http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
float snoise(vec2 co)
{
float a = 12.9898;
float b = 78.233;
float c = 43758.5453;
float dt= dot(co.xy ,vec2(a,b));
float sn= mod(dt,3.14);
return fract(sin(sn) * c);
}
Main:
void main()
{
vec4 texCol = texture2D(uTexDiffuse, vTexCoord.xy);
float n = snoise(vec2(vTexCoord.x*cos(uTime),vTexCoord.y*sin(uTime)));
gl_FragColor = texCol;
gl_FragColor.rgb *= n;
}
both are working fine on a device which supports high point fragmentshader precision. But on a device like the nexus 7 this is not working.
I also tried the shader from this repository: webgl-noise But even they are not working.
Result on highp supporting fragment shader (looking fine):
Result on Nexus 7 2012: