Fix T67623 Eevee: Modulo node making unexpected/inconsistent behaviour

This was a precision error. Using a more robust approach
This commit is contained in:
2019-08-07 13:08:28 +02:00
parent be4063dbbb
commit 3e27dd5b55

View File

@@ -383,12 +383,10 @@ void math_modulo(float val1, float val2, out float outval)
outval = 0.0;
}
else {
outval = mod(val1, val2);
/* change sign to match C convention, mod in GLSL will take absolute for negative numbers,
* see https://www.opengl.org/sdk/docs/man/html/mod.xhtml */
outval = sign(val1) * mod(abs(val1), val2);
}
/* change sign to match C convention, mod in GLSL will take absolute for negative numbers,
* see https://www.opengl.org/sdk/docs/man/html/mod.xhtml */
outval = (val1 > 0.0) ? outval : outval - val2;
}
void math_abs(float val1, out float outval)