Comments and answers for "Mathf.Repeat in ShaderLab?"
http://answers.unity.com/questions/1494854/mathfrepeat-in-shaderlab.html
The latest comments and answers for the question "Mathf.Repeat in ShaderLab?"Answer by Bunny83
http://answers.unity.com/answers/1495087/view.html
There are several solutions:
- [fmod][1]
- [frac][2]
- [modf][3]
- [floor][4]
Note while fmod and modf directly returns the remainder, frac has to be used like this:
num = frac(num/range) * range;
floor could be used like this:
num /= range;
num = (num - floor(num)) * range;
Though fmod would be the simplest implementation
num = fmod(num, range);
[1]: http://developer.download.nvidia.com/cg/fmod.html
[2]: http://developer.download.nvidia.com/cg/frac.html
[3]: http://developer.download.nvidia.com/cg/modf.html
[4]: http://developer.download.nvidia.com/cg/floor.htmlTue, 17 Apr 2018 11:58:33 GMTBunny83