Color Management Use Curves do not update when UV Editor is presented #82460

Closed
opened 2020-11-06 12:47:35 +01:00 by Alex · 23 comments

System Information
Intel Core 2 Quad, 8 Gb RAM, NVidia GeForce GTX 960 2GB
Windows 7 x64

Blender Version
Broken: 2.91 Beta 02677ec4e0
Worked: 2.90.1, 2.91
Caused by 4212b6528a

Short description of error
Color Management Use Curves doesn't update properly if you open UV or Image Editor alongside the main 3D Viewport. Curve itself is working but only if you right click on it after making changes.
Just in case, I was testing this on a fresh localized version of Blender so I'm 100% sure it's not caused by an addon or any setting.

Exact steps for others to reproduce the error

  1. Open Blender and change Timeline Editor on the bottom to UV Editor
  2. Switch to Rendered shading and enable Use Curves in Render Properties - Color Management.
  3. Add a point to a curve and move it around, release the mouse and nothing will happen. Right click on a curve and 3D View will be updated.
  4. Switch bottom editor back to Timeline and move the curve point again – 3d View will be updated when you'll release the mouse.
**System Information** Intel Core 2 Quad, 8 Gb RAM, NVidia GeForce GTX 960 2GB Windows 7 x64 **Blender Version** Broken: 2.91 Beta 02677ec4e0fa Worked: 2.90.1, 2.91 Caused by 4212b6528a **Short description of error** Color Management Use Curves doesn't update properly if you open UV or Image Editor alongside the main 3D Viewport. Curve itself is working but only if you right click on it after making changes. Just in case, I was testing this on a fresh localized version of Blender so I'm 100% sure it's not caused by an addon or any setting. **Exact steps for others to reproduce the error** 1. Open Blender and change Timeline Editor on the bottom to UV Editor 2. Switch to Rendered shading and enable Use Curves in Render Properties - Color Management. 3. Add a point to a curve and move it around, release the mouse and nothing will happen. Right click on a curve and 3D View will be updated. 4. Switch bottom editor back to Timeline and move the curve point again – 3d View will be updated when you'll release the mouse.
Author

Added subscriber: @SpectreFirst

Added subscriber: @SpectreFirst

Added subscriber: @rjg

Added subscriber: @rjg

I can reproduce this in Blender 2.91 02677ec4e0, current master works fine. A build of 2.91 1c653a0315 works fine as well, the issue was introduced somewhere in between.

Edit: The commit hashes where this worked correctly may not be accurate as I had trouble reliable reproducing the issue (see comments below).

~~I can reproduce this in Blender 2.91 02677ec4e0, current master works fine. A build of 2.91 1c653a0315 works fine as well, the issue was introduced somewhere in between.~~ Edit: The commit hashes where this worked correctly may not be accurate as I had trouble reliable reproducing the issue (see comments below).

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I will try to bisect this. I'll tag this as Render & Cycles for now since this module includes color management.

I will try to bisect this. I'll tag this as Render & Cycles for now since this module includes color management.

Strange, I must have done something different the first time around, because I currently can't reproduce it anymore. Will investigate further.

Strange, I must have done something different the first time around, because I currently can't reproduce it anymore. Will investigate further.

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

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

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

We must have both performed some additional action that is not explicitly mentioned in your step by step instructions or it's not quite deterministic. Could you please check if you can find anything missing that is required to reproduce this? I've tried various approaches but wasn't able to.

We must have both performed some additional action that is not explicitly mentioned in your step by step instructions or it's not quite deterministic. Could you please check if you can find anything missing that is required to reproduce this? I've tried various approaches but wasn't able to.
Author

@rjg I have double-checked both latest 2.91 and 2.92 and in both cases it is 100% reproducible with the steps described above - open Blender, switch Timeline to UV Editor, switch to Rendered view, enable Use Curves and try changing it, in fact, right now I was able to reproduce even worse situation when curves don't work at all until you switch UV Editor to something else. Are you sure you have UV Editor instead of Timeline? I have also tried to launch via shortcut with blender.exe -d and it works the same.

Edit: I was able to reproduce the case when my steps don't work by setting Render Result into an editor - with Render Result in place it seems to be working but if you remove it and leave UV Editor blank it will stop working again.
UseCurvesBug.JPG
UseCurvesNoBug.JPG

@rjg I have double-checked both latest 2.91 and 2.92 and in both cases it is 100% reproducible with the steps described above - open Blender, switch Timeline to UV Editor, switch to Rendered view, enable Use Curves and try changing it, in fact, right now I was able to reproduce even worse situation when curves don't work at all until you switch UV Editor to something else. Are you sure you have UV Editor instead of Timeline? I have also tried to launch via shortcut with blender.exe -d and it works the same. Edit: I was able to reproduce the case when my steps don't work by setting Render Result into an editor - with Render Result in place it seems to be working but if you remove it and leave UV Editor blank it will stop working again. ![UseCurvesBug.JPG](https://archive.blender.org/developer/F9219819/UseCurvesBug.JPG) ![UseCurvesNoBug.JPG](https://archive.blender.org/developer/F9219821/UseCurvesNoBug.JPG)

I could reproduce this once more in 02677ec4e0, but it's apparently it's random when it actually occurs. I can't reproduce it reliably.

I could reproduce this once more in 02677ec4e0, but it's apparently it's random when it actually occurs. I can't reproduce it reliably.
Author

Honestly I don't know what else to provide because on my end it's 100% reproducible - every time I remove everything from UV Editor, Use Curves just stops working, it affects both new scenes and my working files the same exact way. I can provide my test scene but it's literally a default blender scene with UV Editor and Use Curves enabled. You can try to load my file, switch to Rendered viewport shading and try to move the dot within Use Curves field, on my end 3D View will not update every single time both on 2.91 and 2.92.
UseCurvesBug.blend

Honestly I don't know what else to provide because on my end it's 100% reproducible - every time I remove everything from UV Editor, Use Curves just stops working, it affects both new scenes and my working files the same exact way. I can provide my test scene but it's literally a default blender scene with UV Editor and Use Curves enabled. You can try to load my file, switch to Rendered viewport shading and try to move the dot within Use Curves field, on my end 3D View will not update every single time both on 2.91 and 2.92. [UseCurvesBug.blend](https://archive.blender.org/developer/F9220221/UseCurvesBug.blend)

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Even with your file I can only get it to happen occasionally, which makes debugging and bisecting a challenge. Perhaps another developer can reproduce it as reliable as you do, on their system.

Even with your file I can only get it to happen occasionally, which makes debugging and bisecting a challenge. Perhaps another developer can reproduce it as reliable as you do, on their system.
Member

Added subscribers: @Jeroen-Bakker, @lichtwerk

Added subscribers: @Jeroen-Bakker, @lichtwerk
Member

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

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'
Member

Can confirm.

Caused by 4212b6528a

CC @Jeroen-Bakker

Can confirm. Caused by 4212b6528a CC @Jeroen-Bakker
Jeroen Bakker was assigned by Philipp Oeser 2020-11-10 09:16:47 +01:00
Member

Seems like a missing tag. Will check on it.

Seems like a missing tag. Will check on it.
Jeroen Bakker was unassigned by Philipp Oeser 2020-11-13 16:36:25 +01:00
Philipp Oeser self-assigned this 2020-11-13 16:36:25 +01:00
Member

Been investigating a bit and here are my findings:

updateGLSLCurveMapping compares cacheIDs and in certain scenarios, these are the same when they should not.

  • whenever we have multiple viewports that are colormanaged with curvemappings this goes right (cacheIDs are different)
  • for example, this also goes right when the ImageEditor displays a Render Result or a Compositor Viewer
  • but it goes wrong when the Image Editor displays any other Image (or no Image at all)
  • it also goes right if there are multiple Image Editors [and one of them displays a Render Result e.g]

Now why is this so?

For comparison, a pointer address is used.

  • update_glsl_display_processor frees the curve_mapping, see BKE_curvemapping_free(global_glsl_state.curve_mapping)
  • similar, update_glsl_display_processor creates a new curvemapping, see BKE_curvemapping_copy(view_settings->curve_mapping)
  • now for the situation that a viewport with curvemapping and a viewport without curvemapping is present and you make changes to the curvemapping the following happens:
    • curve_mapping_settings->cache_id is set once [to the memory address of curvemapping before change]
    • change happens
    • viewport 1 frees curvemapping
    • viewport 2 duplicates using BKE_curvemapping_copy, but this one gets the same address like before the change :/
    • this means we have different data on the same address with the same cacheID...

There should be a way to avoid this

Been investigating a bit and here are my findings: `updateGLSLCurveMapping` compares cacheIDs and in certain scenarios, these are the same when they should not. - whenever we have multiple viewports that are colormanaged with curvemappings this goes right (cacheIDs are different) - for example, this also goes right when the ImageEditor displays a Render Result or a Compositor Viewer - but it goes wrong when the Image Editor displays any other Image (or no Image at all) - it also goes right if there are multiple Image Editors [and one of them displays a Render Result e.g] Now why is this so? For comparison, a pointer address is used. - `update_glsl_display_processor` frees the curve_mapping, see BKE_curvemapping_free(global_glsl_state.curve_mapping) - similar, `update_glsl_display_processor` creates a new curvemapping, see BKE_curvemapping_copy(view_settings->curve_mapping) - now for the situation that a viewport with curvemapping and a viewport without curvemapping is present and you make changes to the curvemapping the following happens: - curve_mapping_settings->cache_id is set once [to the memory address of curvemapping before change] - change happens - viewport 1 frees curvemapping - viewport 2 duplicates using BKE_curvemapping_copy, but this one gets the same address like before the change :/ - this means we have different data on the same address with the same cacheID... There should be a way to avoid this
Member

note: this is exactly where it fails (in the scenario described above, reallocation wont give a new address):

    /* We're using curve mapping's address as a cache ID,
     * so we need to make sure re-allocation gives new address here.
     * We do this by allocating new curve mapping before freeing old one. */
note: this is exactly where it fails (in the scenario described above, reallocation wont give a new address): ``` /* We're using curve mapping's address as a cache ID, * so we need to make sure re-allocation gives new address here. * We do this by allocating new curve mapping before freeing old one. */ ```
Member

Thanks for looking into this. I would rather use a hash for this. Basing this out of a memory pointer isn’t deterministic.

Thanks for looking into this. I would rather use a hash for this. Basing this out of a memory pointer isn’t deterministic.

This issue was referenced by 7db42b8f2a

This issue was referenced by 7db42b8f2a8cdec5067f2fe73082bd5d806a5e42
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 2.91 milestone 2023-02-08 16:20:08 +01:00
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
5 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#82460
No description provided.