I'm following [this tutorial][1] for making 3D perlin noise, but decided to have a go at compute shaders and use that for the calculations.
![alt text][2]
This part of the code takes the values i0 and i1 which are used to retrieve a value from hash[]. This is an array with random values, the retrieved value is then used to get either 1 or -1 from gradients1D. So it basically choses pseudo randomly between 1 and -1.
The problem is that g0 and g1 both return 1 for some reason. I can only see the resultes on the tecture generated with the compute shaders so I'm wondering if anyone has hints on debugging compute shaders or sees what I'm doing wrong.
![alt text][3]
Above is the original c# code, note that the "*0.5 +0.5" bit in my code is also in the original, just somewhere else.
[1]: https://catlikecoding.com/unity/tutorials/noise/
[2]: /storage/temp/138945-knipsel.png
[3]: /storage/temp/138946-knipsel4.png
↧