Rounding error in ColorRamp node #74198
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
9 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#74198
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: Windows 10
Graphics card: GeForce GTX 1080 8K
Blender Version
Broken: 2.83.4,
a322b43e3d
, 2020-02-24Short description of error
In the Cycles implementation of the ColorRamp node, marker positions seem to be rounded to the next higher multiple of 1/255, leading to unexpected output, especially when set to 'Constant' interpolation.
EDIT: Happens in EEVEE too, but only when there are two or more markers set on the ColorRamp, and with multiples of 1/256.
Exact steps for others to reproduce the error
rounding error.blend
0.2197
(> 56/255)0.2235
(< 57/255)The node will output the red color from the left of the spectrum, even though the input value is greater than the yellow marker's position.
This only occurs in Cycles, EEVEE correctly outputs yellow.As a side note, 0.2335 should be rounded up to 0.234 when displayed with three decimals, but isn't.
EDIT: To reproduce in EEVEE:
0.5001
0.5039
(As with Cycles)
Added subscriber: @DustInCompetent
#101205 was marked as duplicate of this issue
#100694 was marked as duplicate of this issue
#91769 was marked as duplicate of this issue
Added subscriber: @TheOldBen
Changed status from 'Needs Triage' to: 'Confirmed'
Can reproduce with sample file and from scratch.
Changed status from 'Confirmed' to: 'Needs Triage'
Rounding error in Cycles ColorRamp nodeto Rounding error in ColorRamp nodeChanged status from 'Needs Triage' to: 'Confirmed'
Can confirm, using 2.83.4
Not sure if this is a "known issue", either. I could not find it in the tracker at any rate.
Added subscriber: @CharlieJolly
Color Ramps are converted to a texture and then sampled from a 256 px wide image, this low resolution is prone to sampling errors and is not exact. There is an optimisation in Eevee when there are only two stops which explains why it breaks after adding another stop. See the following thread from twitter: https://twitter.com/BartekMoniewski/status/1229063557330984960
Added subscribers: @RMK-1, @PratikPB2123, @SteffenD
Added subscriber: @jgilhutton
Is there any updates on this one? Or should we asume this is how the node will work for ever? I'm asking with scripting purposes in mind.
If we inspect the color ramp visually, we won't take long before we realise there's something wrong; but problem comes when we deal with the colorramp node factor input via scripting.
The real issue here is that the user/programmer will expect and trust that the input factor on the colorramp won't be rounded o the nearest 1/256 multiple. At least we could add an item to Blender's known limitations or something like that because this deviates from what's natural on the software.
Unfortunately in my case, I didn't realise of this issue until it was too late :(
Added subscribers: @Fluffies, @OmarEmaraDev, @deadpin, @scurest
Added subscriber: @akirabeta
Removed subscriber: @scurest
A question for those still watching this: It's obvious the 255 vs 256 discrepancy between Cycles and Eevee should be fixed and of course documented. But what should the number be fixed to?
Using 255 or 256 for both would result in the least amount of visual change from prior versions. Going down to 250 would provide a more even/natural 0.004 step between each stop rather than 0.003906 but has lower resolution than before and might produce visually different results. The next highest resolution that would produce natural stops would be to use a resolution of 400. However this has downsides in both Cycles and Eevee with increased ramp calculation times, memory usage, and (maybe) sampling times in Cycles though it's hard to measure.
256, if anything. Increasing or decreasing it to some other "round" number doesn't solve the underlying issue, there would always be some case where it's not perfectly divisible, even if you set it to 240 or something.
Since the workaround is having an ugly staircase of Greater Than and RGB Mix nodes, I'd like to have a checkbox option in the Color Ramp node to explicitly enable stepless markers at the cost of reduced performance.
As an afterthought, maybe the width of the ramp texture could be made configurable too, if that'd be easier to implement and make less of a performance impact.