Welcome to WSL!

Make yourself at home, but before posting, please may I ask you to read the following topics.


Posting 101
Server space, screenshots, and you

Thank you!

PS. please pretty please:


Image

Offset viewer to maintain relative position when changing image size

Moderator: Chad

User avatar
Chad
Fusionator
Posts: 1536
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 21 times

Offset viewer to maintain relative position when changing image size

#1

Post by Chad » Mon Feb 18, 2019 5:35 am

Normally, when the input to a 2D viewer changes size, the resulting OpenGL quad stays centered where it was previously. I'm not sure what the utility of this is, but I would prefer that the relative coordinate point of the quad in the center of the viewer was maintained, respecting pixel size.
  1. {
  2.     Tools = ordered() {
  3.         Merge1 = Merge {
  4.             CtrlWZoom = false,
  5.             Inputs = {
  6.                 Background = Input {
  7.                     SourceOp = "Mandelbrot1",
  8.                     Source = "Output",
  9.                 },
  10.                 Foreground = Input {
  11.                     SourceOp = "Mandelbrot2",
  12.                     Source = "Output",
  13.                 },
  14.                 PerformDepthMerge = Input { Value = 0, },
  15.             },
  16.             ViewInfo = OperatorInfo { Pos = { 789, 286 } },
  17.         },
  18.         Mandelbrot1 = Mandel {
  19.             Inputs = {
  20.                 Width = Input { Value = 1920, },
  21.                 Height = Input { Value = 1080, },
  22.                 GreenRepetitions = Input { Value = 2, },
  23.             },
  24.             ViewInfo = OperatorInfo { Pos = { 662, 244 } },
  25.         },
  26.         Mandelbrot2 = Mandel {
  27.             Inputs = {
  28.                 Width = Input { Value = 1280, },
  29.                 Height = Input { Value = 720, },
  30.                 PixelAspect = Input { Value = { 1.5, 1.5 }, },
  31.                 RedRepetitions = Input { Value = -1, },
  32.             },
  33.             ViewInfo = OperatorInfo { Pos = { 661, 328 } },
  34.         }
  35.     }
  36. }
Notice that according to the Merge2D, these images are the same size. If you A|B compare them, they also are aligned. But if you assign them to the same viewer buffer sequentially, the quad jumps around. It's especially noticeable if you zoom into a small area. If you zoom into one of the images 400%, centered at (0.25, 0.5), then switch to the other image, you will no longer be centered to (0.25, 0.5). I don't know why you would not want this to be the case, as the existing method seems unpredictable (to the user, at least) if the pixels sizes aren't the same, and if they are the same, it stays centered on (0.5, 0.5) of the quad, without regard to where that quad is relative to the viewer.

This is mildly annoying when you are zoomed out and the image is jumping around, but it's very annoying when you're zoomed far in and want to compare two images, like render passes or versions, that are different sizes.