Skip to content

Improvements to 2 Point Perspective

Note:

When implementing those, I forgot that @ivany is implementing parallelism for some assistants... I hope my code can still be used and won't make changes for Ivan more difficult.

Why I made this:

I was drawing a house in 3 point perspective and those were two biggest issues that I knew I can quickly fix. Commit 1 was important, because it would save me lots of time I spent on remaking strokes and undoing them after seeing them wave; commit 2 would save me time that I spent on ensuring (and remaking and undoing strokes...) that my vertical lines adhere to my 3rd vanishing point and not to just the vertical lines from 2PP assistant (especially since the 2PP assistant is more "sticky" than the VP, probably because since it has three possible lines, so there is 3x higher chance it would be the one selected as the main one).

house_001_smaller


Commit 1:

  • fix issue 3 from https://krita-artists.org/t/call-for-testing-2-point-perspective-assistant/21751/36?u=tiar - which means that now if the user selects Snap Single in the Tool Options for the 2PP assistant, then it will always snap to only one line at a time.

    Reasoning:

    • 2PP is like having two Vanishing Points and one Parallel Ruler. However with those, Snap Single would ensure that only one assistant is selected for any given stroke. It would be a bit of a waste to implement a special option for 2PP that would mean the same thing just instead of global, would be local, so I think just using that checkbox for 2PP is a good idea.
    • It was very annoying to use 2PP without it.

Commit 2:

  • implement "Use Vertical" feature (name change suggestions welcomed!) - if on, it's how it was before, if off, then there is no snapping to vertical line.

    Reasoning:

    • The user might want to use 3 point perspective, but there is no assistant for that yet, so 2PP + one vanishing point can be good, but then there is a problem, because the vertical line from 2PP and the vanishing point are very similar, which causes issues when drawing (known problem with Krita's assistants)
    • The user might want this kind of fisheye-y perspective that has vertical lines kind of rounded, bended a bit both to the top and to the bottom. They would draw those vertical lines using the FishEye assistant, but they want the normal perspective for other things (I guess, I never tried it). Again, the same issue with assistants interferring
    • They don't want to use it for any other reason and it's just unnecessary, and since it's taken into account when calculating the best assistant, it might be interfering when drawing.

Example: image (blue ones are from VP, but the image shows that my first stroke was purely vertical and I had to redo it).

Test Plan

Commit 1:

  • First check without the commit, to see what was the issue. Then repeat the same steps on after the commit.
  • Create 2PP assistant. You can create more assistants.
  • Select brush tool, make sure Snap to Assistants and Snap Single are both checked
  • Start a line, then come back to the point you started, but in a big distance from the line - you should see how (before the commit) 2PP jumps between different vanishing points, making your line not straight anymore but composited out of multiple short straight lines.
  • Start a line somewhere in the area very close to the horizon line. The lines to both VPs should be parallel-like. See that you could draw on both lines together/jump between them before my commit and you cannot do that after my commit. Screenshot of the issue

Commit 2:

  • Make sure the "Use Vertical" checkbox is not visible in the Assistant Tool yet.
  • Create a new 2PP. When it's selected, make sure "Use Vertical" is on.
  • Select a brush tool, make some strokes, make sure vertical strokes can be drawn.
  • Go to the assistant tool again. Make sure "Use Vertical" checkbox is not visible (since no assistant is selected yet).
  • Select the 2PP assistant. See that "Use Vertical" is on. Then, turn it off.
  • Go back to the brush tool. Try to make vertical strokes. They should still adhere to one of the vanishing points instead.
  • See the assistant preview. It shouldn't contain the vertical line.
  • Save a file with a 2PP assistant with Use Vertical off. Open it. It should still be off.
  • Save a file with a 2PP assistant with Use Vertical on. Open it. It should still be on.

Interested parties

@nmaghfurusman - I hope you like my little improvements. Btw, why you haven't implemented 3PP? It looks like 90% of the code is already there, the only thing left is to create a new class for 3PP (and possibly making it draw vertical lines, even though 2PP doesn't do it).

@ivany - I hope those are small enough changes that won't break/interfere with your work on parallelism...

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports