Open jovensun opened 2 years ago
Converting mod directly to fmod can cause problems, such as the toy below. https://www.shadertoy.com/view/XsXXDn
GLSL mod is x - y * floor(x/y) HLSL fmod isx - y * trunc(x/y) CG fmod is
x - y * floor(x/y)
x - y * trunc(x/y)
float2 fmod(float2 a, float2 b) { float2 c = frac(abs(a/b))*abs(b); return (a < 0) ? -c : c; /* if ( a < 0 ) c = 0-c */ }
https://forum.unity.com/threads/translating-a-glsl-shader-noise-algorithm-to-hlsl-cg.485750/#post-3164874 https://developer.download.nvidia.cn/cg/fmod.html
Converting mod directly to fmod can cause problems, such as the toy below. https://www.shadertoy.com/view/XsXXDn
GLSL mod is
x - y * floor(x/y)
HLSL fmod isx - y * trunc(x/y)
CG fmod ishttps://forum.unity.com/threads/translating-a-glsl-shader-noise-algorithm-to-hlsl-cg.485750/#post-3164874 https://developer.download.nvidia.cn/cg/fmod.html