Geometry Nodes: Using "Input-Value"-node with "Attribute-Math-Divide"-node leads to incorrect results in following "Attribute-Math-Modulo"-node #87564

Closed
opened 2021-04-16 16:06:23 +02:00 by Christian · 6 comments

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

Blender Version
Broken: 2.93.0 Beta fa8d566c3b
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:
division-input-value-problem.jpg

Blend-File:
geo-modulo-bug.blend

**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: ![division-input-value-problem.jpg](https://archive.blender.org/developer/F9935975/division-input-value-problem.jpg) Blend-File: [geo-modulo-bug.blend](https://archive.blender.org/developer/F9935978/geo-modulo-bug.blend)
Author

Added subscriber: @ChristianFrey

Added subscriber: @ChristianFrey

Added subscriber: @victorlouis

Added subscriber: @victorlouis

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...
Author

In #87564#1147646, @victorlouis wrote:
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?

> In #87564#1147646, @victorlouis wrote: > 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?
Author

I just tried the latest version (2.93-beta-release.c36938297753).

The problem seems to be fixed, now:
divModOk.png

So I guess, the ticket can be closed.
Shall/can I do this myself?

I just tried the latest version (2.93-beta-release.c36938297753). The problem seems to be fixed, now: ![divModOk.png](https://archive.blender.org/developer/F10148086/divModOk.png) So I guess, the ticket can be closed. Shall/can I do this myself?
Member

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Ankit Meel self-assigned this 2021-06-15 13:19:36 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#87564
No description provided.