division in materials custom node (HLSL) is bad

BOBtheROSS
Tue, 07 Apr 2026 14:48:55 +0000
Asset Creation

The custom node seems to be worse than the build in division node.
Is this expected behaviour?

problem:

for var1 = 3.0 the HLSL code return var1/trunc(var1); does not return 1.0, but ~0.99999995 (the next lower value to 1.0 in a 32bit float)

important factors:

affects division in custom node (HLSL)

the divisor a.k.a. denominator must be fed by a material parameter, not a constant

affected float values: 3, 6, 7, 12, 13, 14, 15, 24, 26, 28, 30, 37, 41, 45, 47, 48, … (same with negative values)

1 post - 1 participant