Page MenuHome

Compositor: Support backdrop offset for the Viewer node
Changes PlannedPublic

Authored by Jeroen Bakker (jbakker) on Oct 4 2021, 9:23 PM.

Details

Summary

This is only part of the experimental "Full Frame" mode (disabled
by default). See T88150.

Currently the viewer node uses buffer paddings to display image offset
in the backdrop as a temporal solution implemented for D12466: Compositor: Add support for canvas compositing.
This solution is inefficient memory and performance-wise. Another
issue is that the paddings are part the image when saved.

This patch instead sets the offset in the Viewer node image
as variables and makes the backdrop take it into account
when drawing the image or any related gizmo.

  • Update to latest image engine.
  • Fix issues that were detected when it was part of master. It might be that this is a no-op as image engine did had some short-comings that has been fixed last month. In that case we should just test.

Diff Detail

Repository
rB Blender

Event Timeline

Manuel Castilla (manzanilla) requested review of this revision.Oct 4 2021, 9:23 PM
Manuel Castilla (manzanilla) created this revision.

@Jeroen Bakker (jbakker) I've tried to implement this setting the offset in the viewer node but a lot image/gizmo update issues come up, mainly due to the thread node tree has to merged back to the original tree, so setting the offset has some delay.

In this solution still gizmos doesn't update some times, but it's more consistent and the code more simple. Will look how to fix the gizmo updates.

This is the diff for the unfinished node solution (don't support gizmo updates and node groups):

  • Ensure gizmos are updated after compositing (fixes the issue)
  • Remove unneeded whitespace
  • Take into account viewer offset in Crop, Sun Beams and Corner Pin gizmos
  • Merge branch 'master' into cmp-viewer-offset2
  • Cleanup: fix comment

Need to test drive this if all backdrop operations (fit) work as expected.

source/blender/makesdna/DNA_image_types.h
203

Should mention in what space so it is clear where the origin is and how to work with the values .

  • pixel space: 1 unit is a single pixel on screen.
  • texel space: 1 unit is a single texel of image.
  • canvas space: 1 unit is a single texel of image.
  • Merge branch 'master' into cmp-viewer-offset2
  • Specify viewer image offsets are in pixel space
Manuel Castilla (manzanilla) marked an inline comment as done.Oct 29 2021, 1:57 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/draw/engines/image/image_engine.c
68 ↗(On Diff #44092)

I update the image engine to make it more extensible, but therefore this change needs to be done in image_space_node.hh#SpaceNodeAccessor.get_image_mat

This revision is now accepted and ready to land.Nov 5 2021, 2:01 PM
Jeroen Bakker (jbakker) requested changes to this revision.Jan 4 2022, 8:55 AM

Doesn't seem to work anymore and needs some changes to proceed.

This revision now requires changes to proceed.Jan 4 2022, 8:55 AM
  • rebased on latest master
  • moved image matrix computation to SpaceNodeAccessor

Transformed images e.g. using Transform now show correctly as a backdrop or in image editor. However, results are not updated properly. Probably due to T95699

Jeroen Bakker (jbakker) requested changes to this revision.Feb 14 2022, 9:40 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/draw/engines/image/image_drawing_mode.hh
164

Although this works, it breaks the idea of being screen spaced textures and can lead to other artifacts when we want to optimize panning in the image editor/node editor.

The idea is to update the clipping_uv_bounds of the texture info so that the viewer result is copied into the right part of the screen space texture. This could be done by altering the init_ss_to_texture_matrix so that update_screen_uv_bounds would set the correct offset.

This revision now requires changes to proceed.Feb 14 2022, 9:40 AM

Moved offset computation to AbstractSpaceAccessor::init_ss_to_texture_matrix() as requested by reviewer

Seems to work as expected! Thanks for your patience

This revision is now accepted and ready to land.Mar 15 2022, 2:17 PM

Reverted in rB7fed213ba40d: Revert "Compositor: Support backdrop offset for the Viewer node" since this causes a critical bug and no fix was committed in the last two days.

This revision is now accepted and ready to land.Mar 19 2022, 12:42 AM
Ethan Hall (Ethan1080) added inline comments.
source/blender/draw/engines/image/image_space_image.hh
156

Inconsistent formatting: sima ->zoom sima->zoom

167

The addition of offset_x and offset_y causes issues for the image editor. See: T96543

173

The block of code above was accidently indented.

@Ethan Hall (Ethan1080) thanks for the comments. I addressed the issues in a new revision: D14388. Feel free to review that one as well.

This revision now requires review to proceed.Jan 11 2023, 9:26 AM
Jeroen Bakker (jbakker) planned changes to this revision.Jan 11 2023, 9:27 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)