Page MenuHome

Geometry Nodes: Using "Input-Value"-node with "Attribute-Math-Divide"-node leads to incorrect results in following "Attribute-Math-Modulo"-node
Needs Triage, NormalPublic

Description

System Information
Operating system: Windows 10 Pro
Graphics card: Geforce GTX 960

Blender Version
Broken: 2.93.0 Beta fa8d566c3b12
Worked: none, saw the problem in the three latest 2.93 Alpha versions I tested, as well

Short description of error
The modulo function of the "Attribute-Math"-node leads to incorrect results when applied to a non-rounded division result - even when the division result doesn't have a fractional part. This behaviour only occurs, when one or both float-sockets of the preceding "Attribut-Math-Divide"-node are connected to "Input-Value"-nodes.

Example: (0.004[from value node] / 0.1) mod 2.000 = 2.000 (very wrong!)

Exact steps for others to reproduce the error
Create a simple geometry node tree on an empty mesh:

  • Mesh-Primitives: Line with just one point
  • Input-Value-Node: set the Value to 0.400
  • Attribute Math: Divide (Input Value) / 0.100 => "divRes"
  • Attribute Math: Modulo "divRes" mod 2.000 => "mod"

The spreadsheet shows the attribute "mod" having the value "2.000". It should be 0.000.
If you insert an "Attribute-Math-Round"-node to round "divRes", the modulo value changes to the correct result.
If you disconnect the "Input-Value"-node and enter the value "0.400" directly, the result is also correct.

Screenshot with and without rounding:

Blend-File:

Event Timeline

Maybe this is a floating point thing:

  • 0.4 / 0.1 = 3.999... -> shows up in spreadsheet as 4.000
  • 3.999... % 2 = 1.999.... -> shows up in spreadsheet as 2.000
  • round(3.999...) = 4.0000001
  • 4.0000001 % 2 = 2.00...

Maybe this is a floating point thing:

  • 0.4 / 0.1 = 3.999... -> shows up in spreadsheet as 4.000
  • 3.999... % 2 = 1.999.... -> shows up in spreadsheet as 2.000
  • round(3.999...) = 4.0000001
  • 4.0000001 % 2 = 2.00...

I guess, you mean:

  • 4.0000001 % 2 = 0.0000001 -> shows up as 0.000

This could be what's happening, but why is it only happening when using an "Input-Value"-node in front of the "Attribute-Math-Divide"-node?