Texture Paint: 'Apply Camera Image' does not work properly with .exr image #80859

Closed
opened 2020-09-16 22:33:26 +02:00 by Martijn Versteegh · 12 comments

System Information
Operating system: n/a
Graphics card: n/a

Blender Version
Broken: at least 2.8, maybe earlier
Worked: n/a

Short description of error
When projection painting an image with float data onto an image with char data (or v.v.) the data gets converted in each thread without locking, leading to race conditions and wrong output.

Exact steps for others to reproduce the error
make sure you run on a multithreaded processor

  • default startup
  • set the base color of the material of the cube to image texture. create a new image texture using the default settings.
  • set a camera background image from an .exr file containing float data.
  • select cube, go to texture paint mode.
  • from options -> external choose Apply Camera Image and choose the .exr image
    or
  • open attached file
  • from options -> external choose Apply Camera Image and choose the .exr image

result=> sometimes nothing at all happens, sometimes the image gets applied but stippled, sometimes it works as expected.

The race condition occurs when you pres 'apply camera image' from the tool options. What happens and if the results are visibly wrong or right is rather random, though, because it's threading/timing related.
racecondition.blend

**System Information** Operating system: n/a Graphics card: n/a **Blender Version** Broken: at least 2.8, maybe earlier Worked: n/a **Short description of error** When projection painting an image with float data onto an image with char data (or v.v.) the data gets converted in each thread without locking, leading to race conditions and wrong output. **Exact steps for others to reproduce the error** make sure you run on a multithreaded processor - default startup - set the base color of the material of the cube to image texture. create a new image texture using the default settings. - set a camera background image from an .exr file containing float data. - select cube, go to texture paint mode. - from options -> external choose `Apply Camera Image` and choose the .exr image or - open attached file - from options -> external choose `Apply Camera Image` and choose the .exr image result=> sometimes nothing at all happens, sometimes the image gets applied but stippled, sometimes it works as expected. The race condition occurs when you pres 'apply camera image' from the tool options. What happens and if the results are visibly wrong or right is rather random, though, because it's threading/timing related. [racecondition.blend](https://archive.blender.org/developer/F8893383/racecondition.blend)
Author
Member

Added subscriber: @Baardaap

Added subscriber: @Baardaap
Martijn Versteegh changed title from Thread-unsafe conversion of image data from float to char and v.v. to Thread-unsafe conversion of image data from float to char and v.v. (with patch) 2020-09-16 22:33:47 +02:00
Author
Member

I'm a bit unsure if the condition:
''' if (ps->source != PROJ_SRC_VIEW && ps->source != PROJ_SRC_VIEW_FILL) '''
I use to decide to generate the missing data is the best way. I arrived at this by following the logic in do_projectpaint_thread() but it feels a bit too roundabout to me.

I'm a bit unsure if the condition: ''' if (ps->source != PROJ_SRC_VIEW && ps->source != PROJ_SRC_VIEW_FILL) ''' I use to decide to generate the missing data is the best way. I arrived at this by following the logic in do_projectpaint_thread() but it feels a bit too roundabout to me.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

It is more convenient for you to submit the patch for review via https://developer.blender.org/differential/diff/create/

There are tools for developers to comment on the patch.

In the description you can refer to this task.

This makes the description of the problem more short and straightforward and helps the team that is responsible for testing and confirming bugs.

It is more convenient for you to submit the patch for review via https://developer.blender.org/differential/diff/create/ There are tools for developers to comment on the patch. In the description you can refer to this task. This makes the description of the problem more short and straightforward and helps the team that is responsible for testing and confirming bugs.
Author
Member

Ok, thanks for pointing me in the right direction.

Ok, thanks for pointing me in the right direction.
Author
Member

I created diff D8936

But I'm not really sure what I'm supposed to put in all the field over there. It says I should add reviewers, but I have no idea (yet) who to add. And neither do I have any clu what the 'project' should be. BF_Blender? BF_Blender:unstaged ?

I'll learn in time, but right now I'm a bit overwhelmed :-)

I created diff [D8936](https://archive.blender.org/developer/D8936) But I'm not really sure what I'm supposed to put in all the field over there. It says I should add reviewers, but I have no idea (yet) who to add. And neither do I have any clu what the 'project' should be. BF_Blender? BF_Blender:unstaged ? I'll learn in time, but right now I'm a bit overwhelmed :-)

Thanks for the diff, the entire 'Sculpt, Paint & Texture` team was automatically poked for review.

By the way, could you edit the description of this report, removing everything about the patch? (This information is better in the description for review).

Also, could you provide an .ext image with float data or a simple .blend file showing the problem?

(This report is a little complex and can be very time consuming just to reproduce the problem).

Thanks for the diff, the entire 'Sculpt, Paint & Texture` team was automatically poked for review. By the way, could you edit the description of this report, removing everything about the patch? (This information is better in the description for review). Also, could you provide an .ext image with float data or a simple .blend file showing the problem? (This report is a little complex and can be very time consuming just to reproduce the problem).
Author
Member

the entire 'Sculpt, Paint & Texture` team was automatically poked for review.

Whoops. That might be a rather overkill (understatement). I was trying to be humble and not throw random names of people I don't know in the reviewers field...

Please forgive my clumsyness.

Here is a blend file. A bit large I accidentally used a rather large .exr. Sorry!
racecondition.blend
The race condition occurs when you pres 'apply camera image' from the tool options. What happens and if the results are visibly wrong or right is rather random, though, because it's threading/timing related.

> the entire 'Sculpt, Paint & Texture` team was automatically poked for review. Whoops. That might be a rather overkill (understatement). I was trying to be humble and not throw random names of people I don't know in the reviewers field... Please forgive my clumsyness. Here is a blend file. A bit large I accidentally used a rather large .exr. Sorry! [racecondition.blend](https://archive.blender.org/developer/F8893383/racecondition.blend) The race condition occurs when you pres 'apply camera image' from the tool options. What happens and if the results are visibly wrong or right is rather random, though, because it's threading/timing related.
Martijn Versteegh self-assigned this 2020-09-18 14:09:39 +02:00
Author
Member

I think I need to claim it to couple the task to my diff?

I think I need to claim it to couple the task to my diff?
Martijn Versteegh removed their assignment 2020-09-18 14:12:40 +02:00
Germano Cavalcante changed title from Thread-unsafe conversion of image data from float to char and v.v. (with patch) to Texture Paint: 'Apply Camera Image' does not work properly with .exr image 2020-09-21 19:50:33 +02:00

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

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

This issue was referenced by c5efd0939f

This issue was referenced by c5efd0939f72eea1547812ccc0adb3c594734de2

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2020-09-22 10:30:30 +02: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
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#80859
No description provided.