- Home /
Shader shows odd Simplex Noise behavior on Android
I'm using a 3D Simplex noise generator from this repo, which is essentially an HLSL port of Ashima's WebGL noise.
My implementation is simple, I'm using the snoise()
function to create a 3D simplex noise in the range of [-1, 1]
, then I use it to distort my vertex positions:
float noiseDisp = snoise(IN.vertex * _Chaos + _Time);
float4 newPos = IN.vertex * (1.0 + noiseDisp * 0.2);
OUT.position = UnityObjectToClipPos(newPos);
The result in the Unity Editor is a subtly distorted sphere:
The problem is when I export and build to Android devices, my subtle distortion goes wild, and the output of snoise()
goes from being within the [-1, 1]
range to something like [-40, 40]
.
Is there a known cause for Android devices to handle this type of procedurally-generated noise differently than the default Unity Editor? My guess is that the noise function ends in return 42.0 * float4(grad, dot(m4, px));
and that's why the range is 40x larger in Android, even though the result should be the same on both platforms. Why is Android handling it differently? If anybody knows of known causes for this, or could point me in the right direction, I'd appreciate it!