三星 Galaxy SIII (GLES) 中的噪声算法失败 [英] Noise Algorithm fails in Samsung Galaxy SIII (GLES)

查看:26
本文介绍了三星 Galaxy SIII (GLES) 中的噪声算法失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力让下一个简单算法在三星 Galaxy SIII 中运行

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));
....

该代码在三星 Galaxy S1 和 Google Nexus S 中完美地产生了预期的噪音.但在使用 ARM 的 Mali-400/MP4 的新智能手机中却完全失败了.

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?

推荐答案

你的问题可能来自于取一个大数的sin.其结果取决于 sin 的确切实现,这是不可用的.显然,Mali 芯片使用的 sin 函数在大数字时比其他函数具有更可预测的结果.

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.

这篇关于三星 Galaxy SIII (GLES) 中的噪声算法失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆