Math nodes output incorrect results. Unstable calculation #95164
Labels
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#95164
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Linux-5.16.2-1-MANJARO-x86_64-with-glibc2.33 64 Bits
Graphics card: Mesa Intel(R) HD Graphics 4600 (HSW GT2) Intel 4.6 (Core Profile) Mesa 21.3.4
Blender Version
Broken: version: 3.1.0 Alpha, branch: makepkg (modified), commit date: 2022-01-22 08:57, hash:
dde997086c
Worked: (newest version of Blender that worked as expected)
Short description of error
When I try divide a value to another value in Math.Divide it lets an unstable result. Floating Inexact calculation result with integer values.
For example: 100/10=10 but 600/60 != 10 Why!?
Exact steps for others to reproduce the error
Download example file and play with Math.Divide
math-divide.blend
Added subscriber: @Wovchick
In Python for example always result equals 10:
Added subscriber: @CharlieJolly
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @PratikPB2123
It Interesting. The problem happens only when used EEVEE render but when used Cycles, Math Node calculate correct!
2022-01-24_04-37-56.mov
Added subscriber: @deadpin
I'm actually not able to reproduce this issue. Since this only occurs with Eevee for you, it's most likely some sort of OpenGL quirk -- maybe Mesa related, maybe Intel hardware related, maybe our usage of the API. Unsure who's really at fault though.
@PratikPB2123 Are you also on intel?
Here's a few examples from my system:
Operating system: Windows-10-10.0.19042-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1070 with Max-Q Design/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.39
Added subscriber: @MarcoHoo-3
Does the input area collapse your decimal places?
No
Weird... ok, my older AMD system also shows the problem (Cycles remains correct though). Alright, let's tag Eevee and Viewport still since it's most likely something related to OpenGL since Cycles is ok.
This comment was removed by @Wovchick
I can reproduce this issue using "Greater than" operator.
I guess system give us like 10.0000001 or 9.9999999 (long decimal places that we can't see) when calculating "divide" . If we round the anwser up ro down, we can get the exact number.
bandicam 2022-01-24 10-57-15-912.mp4
System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.09
Blender Version
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2022-01-23 00:09, hash:
5c4a5fd40d
This comment was removed by @Wovchick
P.S. My previous video was of low quality. I'm Sorry
2022-01-24_06-37-38.mov
There is something that we must pay attention to.
Use custom properties and driver to see more detail:
When we input a number by typing on the keyboard, or, if we adjust the number though the increase and decrease button on the node, we may get the offset value like 10.0000001 most of the time (long decimal places that we can't see, again). And that may probably destroy our nodebased calculation.
bandicam 2022-01-24 14-58-07-476.mp4
Useful information below.
These two video tells us the reason why we can't get the exact result. When we input 60, that's not the exact 60 to system. It's 60.00000XXXX to system, maybe.
bandicam 2022-01-24 16-07-38-316.mp4
bandicam 2022-01-24 16-15-09-012.mp4
Thank you @MarcoHoo-3! It interesting calculation with drivers!
Also additional information:
2022-01-24_15-13-55.mov
Please to up priority because the problem affect doesn't only with EEVEE but even has in Cycles.
2022-01-26_02-40-52.mov
math.blend
Node Math.Divide output incorrect result. Unstable resultto Math nodes output incorrect results. Unstable calculationNo, in general you cannot rely on exact math when using floating point numbers. Here is your example above in standard C code: https://godbolt.org/z/s9xf11Ybb
Notice that the result is 5.9999990463 unfortunately. Floating point math can also behave slightly different based on if it's executed on the GPU (like with OpenGL) or otherwise.
No more videos about this are necessary. The report has been triaged and awaiting developer input on if there's anything that could improve the situation in certain circumstances. Probably not though.
Ok. But why I get different result between EEVVEE and Cycles?
Additionally, for C++ or C enough a simple multiply
0.56 * 10.0
that not to get5.6
but when you multiply0.56 * 100.0
you will get56.0
exactly! LolIn Java, Python for example, you will get
5.6
for floating operation0.56 * 10.0
.Floating point precision changes on the size of the numbers involved. What is displayed is not always the same as the underlying number. So in Python and Java you are seeing a rounded number for display.
I can see from a user perspective it is totally illogical!
Actually I was wrong. Sorry. You will get
5.6000000000000005
in Python and5.59999990463256800000
в Java.C++:
https://www.exploringbinary.com/the-answer-is-one-unless-you-use-floating-point/
IEEE 754
For example:
When you input a constant from keyboard, Python remember it as
0.5600000000000001
, so the comparison works. So what actually happens is this:And so here is True, and here is False:
The constant is less than multiply. In C++ something similar happens.
Added subscriber: @Jeroen-Bakker
Changed status from 'Confirmed' to: 'Archived'
Although interesting; floating point precision issues are not considered a bug.
Note that python doesn't use floats, but doubles and therefore has a higher precision.
The comparison is done on your GPU and with the way how the AMD/Intel driver optimizes the code. On older GPU more precision can be lost for performance reasons (fastmath operations or to reduce the physical space of sillicon).
Adding more precision in software (if possible) could lead to less performant shaders. I prefer to trade off performance vs precision towards performance especially in a rasterizer like Eevee.
The work around is to use a falloff in stead of a less than. I would prefer if this research would continue on devtalk or user forum.
Thanks you all for the detailed research and effort!