Maniphest T102273

Mix Color node math precision issue
Closed, Archived

Assigned To
None
Authored By
Serge Lyatin (SergeL)
Nov 4 2022, 3:14 PM
Tags
  • BF Blender
Subscribers
Charlie Jolly (charlie)
Iliya Katueshenock (Moder)
Serge Lyatin (SergeL)

Description

System Information
Operating system: win10
Graphics card: 1050 ti

Blender Version
Broken: 3.4, 3.3.2

Short description of error
Mix Color operations are very useful because of factor option, but precision sometimes is off. Multiply operation produces strange rounding for some integers: 13, 104, 111 and more.

Exact steps for others to reproduce the error

From scratch:

  • Add GN tree with Mix Color multiply operation
  • With integers plugged into color sockets calculate following: 13*1 -> output is 12

Event Timeline

Serge Lyatin (SergeL) created this task.Nov 4 2022, 3:14 PM
Charlie Jolly (charlie) added a subscriber: Charlie Jolly (charlie).Nov 4 2022, 7:08 PM
Iliya Katueshenock (Moder) closed this task as Archived.EditedNov 6 2022, 12:36 PM
Iliya Katueshenock (Moder) added a subscriber: Iliya Katueshenock (Moder).

Hello. Thanks for the report. In this example, there is no bug. You see, the transformation goes like this: Color -> Float -> Int.

static int32_t color_to_int(const ColorGeometry4f &a)
{
  return int(rgb_to_grayscale(a));
}

And why your float 13 is not int 13:

This error is not a bug. This is due to the specificity of computer science, but not mathematics, and the fix cannot be obtained.
This was also the reason for report T101730.