Page MenuHome

Fix T82064: Add Image Clone tool to overlay engine
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Oct 26 2020, 3:56 PM.

Details

Summary

The clone tool in the image editor can show a second texture on top
of the image. This wasn't ported and now results into alpha and depth
issues. This fix adds the clone tool drawing to the overlay engine.

I checked 3 approaches to this issue:

  1. Do the stencil drawing in the image engine, but that leads to checking overlay flags and tool flags in the image engine but removes the need for another shader.
  2. Add a separate overlay module (or combine with overlay_image) but that lead to strange results in code style as the overlay_image is targetting the 3d viewport.
  3. Include the image rendering in the overlay_edit_uv as this issue is closely bound to the image/uv editor.

For this solution we chose to implement the option 3, but can easily be
transferred to the overlay_image as that fits what we had done for D8234.

Diff Detail

Repository
rB Blender
Branch
T82064 (branched from master)
Build Status
Buildable 11292
Build 11292: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Oct 26 2020, 3:56 PM
Jeroen Bakker (jbakker) created this revision.

Correct aspect ratios

Jeroen Bakker (jbakker) retitled this revision from Fix T82064: WIP migrate clone tool to overlay engine to Fix T82064: Add Image Clone tool to overlay engine.Oct 27 2020, 9:44 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

I take that it is by design that the UV grid is drawn on top of it, right? This patch seems to work fine for the test file in the original report.

I think using overlay_edit_uv.c is ok for now.

I'm just not sure about rendering it to the scene framebuffer.

source/blender/draw/engines/overlay/overlay_engine.c
513 ↗(On Diff #30391)

Why does stencil needs to be rendered on the scene render target? Since it is an overlay I think we should not allow scene refered value (unclamped) mess with its visibility.

Is that an issue with color management?

source/blender/draw/engines/overlay/overlay_engine.c
513 ↗(On Diff #30391)

Yes, we currently don't have a good way to render texture colors to the overlay. The GPU texture internally is stored as scene reference. The overlay buffer is in linear display space. When using the default setting (display space = sRGB) it is all fine. But when you change to XYZ for example the texture should be drawn in XYZ.

This could be fixed by setting the blender_scene_to_display_space, what we currently don't have. Other solution would be to have the GPUTexture store its internal data in Linear Display space but that could lead to incorrect buffers when both are requested.

For this fix I could do the same thing that Image Empties do and add a known issue for rendering textures to the overlay buffer.

source/blender/draw/engines/overlay/overlay_engine.c
513 ↗(On Diff #30391)

When drawing to the color buffer has also some side effects as it could have the look applied. Both could be argued...

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Draw stencil overlay to the overlay buffer

Jeroen Bakker (jbakker) marked an inline comment as done.

Missing clangformat

This revision is now accepted and ready to land.Nov 17 2020, 1:00 PM