opengl es 2.0 - GLSL noise function on devices with no high precision fragment shader -
i'm looking noise function wich working on none highp fragment shader.
what 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 = 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 working fine on device supports high point fragmentshader precision. on device nexus 7 not working.
i tried shader repository: webgl-noise not working.
result on highp supporting fragment shader (looking fine):
result on nexus 7 2012:
Comments
Post a Comment