Mod() in MathMix and MathCombine gives unexpected results

Hi there,

I noticed that mod behaves strangely both in the MathMix and MathCombine POPs, as well as the GLSL POP. It evaluates differently if using built-in attributes, hard-typed values, or uniforms. It might be a larger issue with how GLSL compiles the operator, but here a detailed breakdown of the problem to see if there’s a fix for it.

Build: Windows11, 31582

modBug.tox (12.9 KB)

Best,
Darien

Hello @Darien.Brito

Thank you for reporting the problem. I’m able to replicate the issue. We’ll have a look.

Hello @Darien.Brito

This issue is now fixed in the latest build we released (2025.31760). When using mod() in shaders, there were inconsistencies between Nvidia and AMD when handling integers stored in floating-point variables—even when the values could be represented without precision loss. Internally, we now cast to double to avoid this oddity.

1 Like

Hi @Guillaume.L,

Great, thanks! Odd one indeed.

I’ve checked and it’s all correct now on 31760, except for the case when one passes one of the operands for mod as a uniform. See attached tox:

modBugUniforms.tox (9.2 KB)

I’m on an NVIDIA RTX 4090

Yeah, the fix is for Math Mix and Math Combine. If you call mod() manually in a shader, you’ll have to cast to avoid the odd GLSL problem.

1 Like

Gotcha! Thanks @Guillaume.L !