-
-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
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 is x - y * trunc(x/y)
CG fmod is
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels