Vertex color interpolation is incorrect #90223

Closed
opened 2021-07-27 06:36:56 +02:00 by Cici · 9 comments
Contributor

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71

Blender Version
Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: 84da05a8b8
Worked: 2.79, in vertex paint mode and blender internal render, but not in cycles render or cycles material preview

Short description of error
Vertex colours are interpolated incorrectly, they seem to be interpolated as sRGB rather than linear. This goes for Eevee, Cycles, viewport render, and grease pencil vertex colours.
Note that this is NOT vertices having the wrong colours! This is the colours in-between the vertices being wrong

Expected results:
(2.79 vertex paint mode)
image.png
(2.79 blender internal material preview)
image.png
(Interpolation between two colours using a gradient texture, correcting both colour's gamma before and after)
image.png
(Similar setup in Krita)
image.png

Actual (incorrect) results:
(vertex colours in all render views)
image.png
(same gradient and colours except mixed without correction)
image.png

There is no way around this, short of just painting the linear colours yourself and then gamma correcting them in-material. My only suggestion is something along the lines of vertex colours having their own colour space option dropdown in the same way images do, so vertex colours can be used for a non-visual purpose in addition to being correctly interpolated for visual purposes.
errcol.blend

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71 **Blender Version** Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: `84da05a8b8` Worked: 2.79, in vertex paint mode and blender internal render, but not in cycles render or cycles material preview **Short description of error** Vertex colours are interpolated incorrectly, they seem to be interpolated as sRGB rather than linear. This goes for Eevee, Cycles, viewport render, and grease pencil vertex colours. Note that this is NOT vertices having the wrong colours! This is the colours in-between the vertices being wrong Expected results: (2.79 vertex paint mode) ![image.png](https://archive.blender.org/developer/F10239838/image.png) (2.79 blender internal material preview) ![image.png](https://archive.blender.org/developer/F10239840/image.png) (Interpolation between two colours using a gradient texture, correcting both colour's gamma before and after) ![image.png](https://archive.blender.org/developer/F10239847/image.png) (Similar setup in Krita) ![image.png](https://archive.blender.org/developer/F10239856/image.png) Actual (incorrect) results: (vertex colours in all render views) ![image.png](https://archive.blender.org/developer/F10239849/image.png) (same gradient and colours except mixed without correction) ![image.png](https://archive.blender.org/developer/F10239851/image.png) There is no way around this, short of just painting the linear colours yourself and then gamma correcting them in-material. My only suggestion is something along the lines of vertex colours having their own colour space option dropdown in the same way images do, so vertex colours can be used for a non-visual purpose in addition to being correctly interpolated for visual purposes. [errcol.blend](https://archive.blender.org/developer/F10239860/errcol.blend)
Author
Contributor

Added subscriber: @Consta

Added subscriber: @Consta
Contributor

Added subscriber: @scurest

Added subscriber: @scurest

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Blender seems to do a simple vector interpolation representing RGB colors.

I'm not sure how it should be a color interpolation and what is that gamma correction.

Needs developer assistance.

Blender seems to do a simple vector interpolation representing RGB colors. I'm not sure how it should be a color interpolation and what is that gamma correction. Needs developer assistance.
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

Thank you for the report @constachymic.

Vertex colours are interpolated incorrectly, they seem to be interpolated as sRGB rather than linear.

You have this reversed, actually. But don’t fret, you are in good company.🤗

It is really easy to get these switched around when doing conversions — I do it all the time.

  • Tom Forsyth

I looked at this earlier but didn’t respond until now because I wanted to triple check to make sure I was giving you the correct information.

All gradient strips come from https:*blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/ which is under the very permissive WTFPL license.

johnnovak-gradient.png
Figure 7 — For each gradient-pair, the top gradient is a linear interpolation between two colours in linear space, then the result converted to sRGB (gamma-correct). The bottom gradients are the results of interpolating between the exact same colours but directly in sRGB space (gamma-incorrect)

The bottom gradient is Yellow to Cyan, which is close to the one you are using here. The top of each gradient strip is interpolated in a linear space, and the bottom is in sRGB space.
It is the sRGB that goes to a more saturated green in the middle of the strip, while the linear interpolation stays lighter.

linear-ramp32.png
Figure 1 — Evenly-spaced greyscale bars in terms of emitted light intensity

In the linear interpolated Figure 1, the middle of the strip isn't what we call middle grey. It is a lighter color.

gamma-ramp32.png
Figure 2 — Evenly-spaced greyscale bars in terms of perceptual light intensity

In order for the middle of the strip to be halfway in between black and white in our minds, an adjustment (here gamma 2.2) must be made.

Below is an image I made in Krita using the gradient tool, using Blender's OCIO config with the same settings as your file in Blender. Krita-LUT-Management-OCIO.png I saved it as a PNG with Force sRGB checked in the export settings. As you can see, it matches Blender's linear interpolation.
Krita-gradient-with-OCIO-force-sRGB.png

Now, you might prefer the look of the sRGB interpolation between certain colors, and that is a perfectly valid creative choice. You already have shown you know how to do this via gamma manipulation in the shader. Adding a dropdown for vertex colors is a feature request that would require a design and approval, which is out of scope of the bug tracker.

Thank you for the report @constachymic. >Vertex colours are interpolated incorrectly, they seem to be interpolated as sRGB rather than linear. You have this reversed, actually. But don’t fret, you are in good company.🤗 > [It is really easy to get these switched around when doing conversions — I do it all the time.](https://medium.com/@tomforsyth/the-srgb-learning-curve-773b7f68cf7a) > - Tom Forsyth I looked at this earlier but didn’t respond until now because I wanted to triple check to make sure I was giving you the correct information. All gradient strips come from https:*blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/ which is under the very permissive [WTFPL](http:*www.wtfpl.net/) license. > ![johnnovak-gradient.png](https://archive.blender.org/developer/F10247774/johnnovak-gradient.png) >Figure 7 — For each gradient-pair, the top gradient is a linear interpolation between two colours in linear space, then the result converted to sRGB (gamma-correct). The bottom gradients are the results of interpolating between the exact same colours but directly in sRGB space (gamma-incorrect) The bottom gradient is Yellow to Cyan, which is close to the one you are using here. The top of each gradient strip is interpolated in a linear space, and the bottom is in sRGB space. It is the sRGB that goes to a more saturated green in the middle of the strip, while the linear interpolation stays lighter. > ![linear-ramp32.png](https://archive.blender.org/developer/F10247796/linear-ramp32.png) >Figure 1 — Evenly-spaced greyscale bars in terms of emitted light intensity In the linear interpolated Figure 1, the middle of the strip isn't what we call middle grey. It is a lighter color. > ![gamma-ramp32.png](https://archive.blender.org/developer/F10247798/gamma-ramp32.png) >Figure 2 — Evenly-spaced greyscale bars in terms of perceptual light intensity In order for the middle of the strip to be halfway in between black and white in our minds, an adjustment (here gamma 2.2) must be made. Below is an image I made in Krita using the gradient tool, using Blender's OCIO config with the same settings as your file in Blender. ![Krita-LUT-Management-OCIO.png](https://archive.blender.org/developer/F10247850/Krita-LUT-Management-OCIO.png) I saved it as a PNG with `Force sRGB` checked in the export settings. As you can see, it matches Blender's linear interpolation. ![Krita-gradient-with-OCIO-force-sRGB.png](https://archive.blender.org/developer/F10247831/Krita-gradient-with-OCIO-force-sRGB.png) Now, you might prefer the look of the sRGB interpolation between certain colors, and that is a perfectly valid *creative* choice. You already have shown you know how to do this via gamma manipulation in the shader. Adding a dropdown for vertex colors is a feature request that would require a design and approval, which is out of scope of the bug tracker.

#91759 shed a light on this problem.
Eevee, Cycles, viewport render, grease pencil vertex colors consider Vertex Colors to be sRGB. However they are RGB.
The question to find out is: who is wrong?

The behavior in Blender 2.79 may be the deciding factor.

#91759 shed a light on this problem. Eevee, Cycles, viewport render, grease pencil vertex colors consider `Vertex Colors` to be `sRGB`. However they are `RGB`. The question to find out is: who is wrong? The behavior in Blender 2.79 may be the deciding factor.

Closed as duplicate of #91759

Closed as duplicate of #91759
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
4 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#90223
No description provided.