Page MenuHome

Texture Paint: 'Apply Camera Image' does not work properly with .exr image
Closed, ResolvedPublicBUG

Description

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.

Event Timeline

Martijn Versteegh (Baardaap) renamed this task 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).Sep 16 2020, 10:33 PM
Martijn Versteegh (Baardaap) created this task.

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.

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.

Ok, thanks for pointing me in the right direction.

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 :-)

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).

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!


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.

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

Germano Cavalcante (mano-wii) renamed this task 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.Sep 21 2020, 7:50 PM
Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.
Germano Cavalcante (mano-wii) updated the task description. (Show Details)
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".