This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

random number with mali 400 mp

Note: This was originally posted on 22nd November 2012 at http://forums.arm.com

I am having no success into generating random noise with the MALI 400 MP GPU, the code I'm using is next which works with all the other GPU vendors I've tried.
On this specific GPU will return just a few cross screen dotted thin lines with a wide space between them, instead of the expected random noise.

float rand(vec2 co)
{
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

void main()
{
vec3 color  = texture2D(u_texture, v_texcoord);
vec3 noise =  vec3( rand(gl_FragCoord.st / 1000.0) );
gl_FragColor = vec4(color + noise, 1.0);
}


Is there something to take into account in this specific GPU hardware?

Thanks
Parents
  • Note: This was originally posted on 27th November 2012 at http://forums.arm.com

    This is the new approach I did to get a simple compact noise function, but yet no results. Any help on what am I doing wrong for this specific GPU model?


    varying vec2 v_texcoord;
    uniform sampler2D u_texture;

    float fractFp16(in float value)
    {
        float exponent = min(ceil(-log2(value + 1.4013e-045) - 1.0), 127.0);
        float scaled = value * pow(2.0, exponent);
        float result = fract(scaled * 65536.0) + ((exponent + 1.0) / 65536.0);
        return result;
    }
    vec3 noise(in float variation, in float intensity)
    {
        float value = sin(fractFp16(variation * 0.180654321));
        value = fractFp16(value);
        return vec3(value) / intensity;
    }
    void main()
    {
        vec3 color = texture2D(u_texture, v_texcoord).rgb; 
        vec3 noise_factor = noise(length(color), 3.0);
        color += noise_factor;
        gl_FragColor = vec4(color, 1.0);
    }
Reply
  • Note: This was originally posted on 27th November 2012 at http://forums.arm.com

    This is the new approach I did to get a simple compact noise function, but yet no results. Any help on what am I doing wrong for this specific GPU model?


    varying vec2 v_texcoord;
    uniform sampler2D u_texture;

    float fractFp16(in float value)
    {
        float exponent = min(ceil(-log2(value + 1.4013e-045) - 1.0), 127.0);
        float scaled = value * pow(2.0, exponent);
        float result = fract(scaled * 65536.0) + ((exponent + 1.0) / 65536.0);
        return result;
    }
    vec3 noise(in float variation, in float intensity)
    {
        float value = sin(fractFp16(variation * 0.180654321));
        value = fractFp16(value);
        return vec3(value) / intensity;
    }
    void main()
    {
        vec3 color = texture2D(u_texture, v_texcoord).rgb; 
        vec3 noise_factor = noise(length(color), 3.0);
        color += noise_factor;
        gl_FragColor = vec4(color, 1.0);
    }
Children
No data