Reputation: 25
So I have been trying to use the power of compute shaders to speed up the process of generating simplex noise for my map terrain generation in unity. The problem is that for the game to work it requires everything to be deterministic in order to prevent desync in its lockstep simulation. To do this I need to use some sort of fixed point math in order to avoid the nondeterministic mess that is floats :( . Wondered if anyone could help with this as can't seem to figure out how to achieve this in a reasonable run time
Upvotes: 0
Views: 1385
Reputation: 3629
There is a fixed
datatype you can use in shaders. Its value ranges from -2.0 to 2.0, stepping at exactly 1/256th. This should do it.
If the range does not work for you you'll have to make do with integers, which aren't supported on older platforms (even though they are emulated using floating points internally, which is not what you want).
See https://docs.unity3d.com/Manual/SL-DataTypesAndPrecision.html
Upvotes: 0