GLSL - color conversion from RGB to Value uses unweighted average (like vector conversion) #45674

Closed
opened 2015-08-04 12:24:48 +02:00 by Michael Otto · 8 comments

System Information
windows, gtx980

Blender Version
2.75
Worked: (optional)
2.74

Short description of error
When a node with float input (like a math node) is connected to a color, the color was converted using a weighted average based on human perception:

f = dot(col, vec3(0.35, 0.45, 0.2)) until 2.74,

Now, it's

(col.r, col.g, col.b) / 3.0

no matter if a vector or color is connected to the float input.

Exact steps for others to reproduce the error

Attached blend file: export a shader in 2.74 and 2.75, (gpu.export_shader) and diff them
In 2.74, the add node function is clalled by sth like

math_add(dot(tmp2.rgb, vec3(0.35, 0.45, 0.2)), dot(tmp4.rgb, vec3(0.35, 0.45, 0.2)), tmp7);

in 2.75, it's

math_add((tmp2.r + tmp2.g + tmp2.b) / 3.0, (tmp4.r + tmp4.g + tmp4.b) / 3.0, tmp7);

color_value_conversion.blend

**System Information** windows, gtx980 **Blender Version** 2.75 Worked: (optional) 2.74 **Short description of error** When a node with float input (like a math node) is connected to a color, the color was converted using a weighted average based on human perception: f = dot(col, vec3(0.35, 0.45, 0.2)) until 2.74, Now, it's (col.r, col.g, col.b) / 3.0 no matter if a vector or color is connected to the float input. **Exact steps for others to reproduce the error** Attached blend file: export a shader in 2.74 and 2.75, (gpu.export_shader) and diff them In 2.74, the add node function is clalled by sth like math_add(dot(tmp2.rgb, vec3(0.35, 0.45, 0.2)), dot(tmp4.rgb, vec3(0.35, 0.45, 0.2)), tmp7); in 2.75, it's math_add((tmp2.r + tmp2.g + tmp2.b) / 3.0, (tmp4.r + tmp4.g + tmp4.b) / 3.0, tmp7); [color_value_conversion.blend](https://archive.blender.org/developer/F219036/color_value_conversion.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @MichaelOtto

Added subscriber: @MichaelOtto

Added subscriber: @souljedi

Added subscriber: @souljedi

Added subscriber: @tyoc213

Added subscriber: @tyoc213

Added subscriber: @kevindietrich

Added subscriber: @kevindietrich

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Kévin Dietrich self-assigned this 2015-08-05 03:31:43 +02:00

This is not a bug, rather, it's a fix. There was an inconsistency between how Blender internal render engine and GLSL handled color to float socket conversion, which was eventually fixed by 4139686817. Doing a weighting based on human perception should be carefully handled by the color management pipeline and has nothing to do with such conversion.

Thanks for the report, but again this is not bug.

This is not a bug, rather, it's a fix. There was an inconsistency between how Blender internal render engine and GLSL handled color to float socket conversion, which was eventually fixed by 4139686817. Doing a weighting based on human perception should be carefully handled by the color management pipeline and has nothing to do with such conversion. Thanks for the report, but again this is not bug.
Author

Makes sense. Thank you for looking into it!

Makes sense. Thank you for looking into it!
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#45674
No description provided.