bugMyPaint - Bugs: bug #19988, Tilt inputs do not compensate for...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #19988: Tilt inputs do not compensate for canvas rotation?

Submitted by:  Andrew Chadwick <achadwick>
Submitted on:  Fri 27 Jul 2012 04:08:35 PM UTC  
 
Severity: 3 - NormalPriority: 5 - Normal
Status: FixedPrivacy: Public
Assigned to: Andrew Chadwick <achadwick>Open/Closed: Closed
Release: git master 20a3bc8a9Planned Release: None
Operating System: Any

(Jump to the original submission Jump to the original submission)

Fri 04 Jan 2013 06:18:05 PM UTC, comment #11:

This bug is already Fixed in git, but is marked as Open. I am now
marking it Closed because a new stable version, 1.1.0, is
available, meaning that this bug no longer affects the current
stable release.

Please reopen if this problem reoccurs with the new version of
MyPaint!

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Wed 12 Dec 2012 02:04:05 AM UTC, comment #10:

I seem to have acquired an Intuos5 on a slight offer - I'll probably need to test touchpad events when porting to GTK3, so probably worth it (and the bigger area is really nice too)

Confirmed fixed here too, I think - tilt appears to do the right thing with brushes that angle towards the direction of tilt when the canvas is rotated.

Remains open but marked Fixed because this affects the current stable release (1.0)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Fri 07 Dec 2012 12:25:54 AM UTC, comment #9:

I repeated your test a few times (okay, a lot - with a tilt pen it's more amusing than it should be) and the results are consistent regardless of rotation with the new brush. Looks like everything works :D

Same effect with the old brush, however, so the tilt oddity is apparently just part of that brush.

---

About the tilt tablet: you could probably find an Intuos 3 or 4 (what I have) at a decent cost now. People may still be hoarding their 3's, but the 4's didn't get a lot of love because of the new "natural" surface Wacom started doing, so you may be able to find one used for a good price.

I didn't even care about the tilt when I got mine, I just wanted a larger tablet and the Bamboo line at the time had just updated to the pen+touch variety and wasn't supported well in Linux, so I had to go for the Intuos. However, tilt-sensitive brushes can be really awesome with it, so I'm glad I have it even if I didn't realise it at the time :)

Joshua Tyler <marand>
Thu 06 Dec 2012 01:28:33 PM UTC, comment #8:

Possibly the brush was too weakly sensitive to tilt (I made it not knowing how ascension and declination are derived from tilt...) or partially and slowly dependent on direction or something. Difficult to tell, but give the attached brush a try: its dab angle should match the turn of your stylus, broadstroke style, and its ratio should top out to knife-edge at under 30 degrees of tilt down from vertical.

Attached image is mouse-drawn, with a faked tilt of (x=-0.5, y=0.5). Dot in the middle and stroke outwards while holding the rotate keys: mindless fun, but I think it demonstrates that the correction's happening correctly. I think the theory and implementation are sound at this point, but now I really need to get a tilt-sensitive tablet to evaluate the feel of these brushes for myself. Expensive hobby, this :)

(file #16830, file #16831)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Thu 06 Dec 2012 04:41:02 AM UTC, comment #7:

The irregularities are gone now, but the tilt seems different on or around the same rotation points (e.g. pressing '[' or ']' 3-4 times) that causes the twizzles.

Specifically, the line appears thicker when using the bugtest brush. I'll attach another sample. Created by making a line, rotating a step, and repeating, while trying to keep hand in the same position for each stroke. There is some variation in all the lines due to human error, but the lines definitely seem to differ at certain steps, as shown by the pattern getting thicker and then thinner as it goes around.

A more subtle tilt brush, like the "marker fat" one, doesn't seem to show the same anomaly, so it may only manifest on extreme brushes. Still a lot nicer than before, anyway. :)

(file #16829)

Joshua Tyler <marand>
Thu 06 Dec 2012 01:52:23 AM UTC, comment #6:

The accidental 360° twizzles should be gone in https://gitorious.org/mypaint/mypaint/commit/daa8c5b33206d0a3e42c3143161c14d351a9c56f - can you confirm that you don't encounter them with a real tilt-sensitive tablet any more?

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Wed 05 Dec 2012 08:07:38 PM UTC, comment #5:

Confirmed the new oddity with some fake tilt inputs (just feed in any faked nonzero tilt in the event handler). To make it apparent use a brush whose elliptical ratio follows its declination and whose elliptical dab axis depends on its (right) ascension. Basically emulate a flat brush being used for broad strokes :) Then doodle while rotating the canvas to draw a spiral. Even for constant faked tilts, you'll get a weird little twirly break in the otherwise constant stroke, looking like

The twirl weirdness happens whenever the ascension (after correction for canvas tilt) passes through -180 and 180 degrees between one motion event at time A above and the next. The brush engine, in mypaint-brush.c, does a linear interpolation between the values over several subsequent dabs until it doesn't need to any more, B, but that results in a 360 degree twirl for brushes like these.

This is has always been happening, but it's much more likely to be noticable now we're doing a correction based on canvas rotation. To trigger it, the pen doesn't need to be at approx ±180 and facing away from you any more. Just passing through canvas "up" with your tilt direction and an extreme tilt will trigger this now.

Probably the right thing to do is to fix it in the brush engine. I think interpolating in the direction of the minimum distance around the circle (clockwise or anticlockwise, whichever makes a smaller difference) and clipping the values using modulo arithmetic would be a good start.

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Tue 27 Nov 2012 11:20:18 PM UTC, comment #4:

Looks like that worked. I get similar strokes regardless of rotation now.

I am encountering some strange behaviour when making vertical strokes at a certain rotation with tilt brushes, however. To reproduce, start at default rotation and then rotate clockwise with the ] key four times and make a vertical stroke.

Requires a tilt brush and presumably a pen capable of tilt, didn't occur with mouse. I'm left-handed and holding the pen with a left tilt. Doesn't occur in the opposite direction or a 180° rotation in this configuration. Happens with the freehand rotation as well as the step-based one, so it's not constrained to step-based rotation. Effect is stronger on faster strokes.

I'm terrible with my right hand, so it's hard to test, but this brush glitch and the steps to reproduce seem to be reversed if you hold the pen with a right tilt. Specifically, you have to rotate the canvas four steps counter-clockwise (the [ key) to see the effect with right tilt.

I tested with your bugtest brush and the tilt-enabled "marker fat", with similar results for both. I'm attaching an image with some examples of what it's doing. The thick lines are with "market fat" and the thin ones with the bugtest brush.

(file #16806)

Joshua Tyler <marand>
Tue 27 Nov 2012 08:45:42 PM UTC, comment #3:

(I don't understand the tilt code very well, but does brushlib have a good way of, say, setting the elliptical dab angle from the inputs so that it's always at a set angle from the stylus? Seems to me it'd be useful for emulating flat bruhes and palette knives.)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Tue 27 Nov 2012 08:43:26 PM UTC, comment #2:

Hi Joshua -

Can you test if https://gitorious.org/mypaint/mypaint/commit/a657fbb6642d24a4d3795fe3bc5d1e303524ee5d fixes this? I've attached a brush (in an importable brush pack zipfile) whose angle is heavily dependent on the tilt inputs (probably not in a sane way though...). For the same stylus tilt, it should have the same look at different angles of canvas rotation, and with mirroring turned off or on.

(file #16805)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Sun 29 Jul 2012 11:47:29 PM UTC, comment #1:

You're correct. If I use a tilt brush and make the same stroke multiple times with different rotations, I get entirely different strokes, so it's not acting like expected. It feels strange, since I expect similar strokes with similar tilt to look similar, regardless of rotation. Canvas mirroring also behaves the same way, and likewise feels wrong.

(For reference, I used the "marker fat" brush with an extreme pen tilt to test. If there is a better brush that produces more obvious/extreme results with tilt that would be better for testing, let me know)

Since my tablet supports tilt, I can test any fixes you'd like to try out.

Joshua Tyler <marand>
Fri 27 Jul 2012 04:08:35 PM UTC, original submission:

From reading the code, it looks as if the xtilt and ytilt inputs are not rotated to compensate for the rotation of the canvas at any point before mypaint_brush_stroke_to() is called. This doesn't seem right to me: it breaks the analogy of the rotation commands being like to rotating the drawing on the desk before placing one's pen.

Thus if I rotate the canvas 45 degrees clockwise (by invoking "Rotate Clockwise" or Ctrl+Right twice), the values passed on by the tdw for xtilt and ytilt should be altered as if the vector (0,0)->(xtilt,ytilt) were being rotated 45 degreed anticlockwise while preserving its magnitude.

Sadly I don't have a tilt-sensitive tablet to try out a fix for this :/

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.

 

Attached Files
file #16830:  tilt_testing_2.zip added by achadwick (21kB - application/zip)
file #16831:  tilt_testing_2.jpg added by achadwick (48kB - image/jpeg)
file #16829:  tilt-brush-new-2.png added by marand (126kB - image/png)
file #16806:  tilt-brush-bug.png added by marand (198kB - image/png)
file #16805:  bug19988test.zip added by achadwick (13kB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by marand (Posted a comment)
  • -unavailable- added by achadwick (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Jan 2013 06:18:05 PM UTCachadwickOpen/ClosedOpen=>Closed
    Wed 12 Dec 2012 02:04:04 AM UTCachadwickStatusReady For Test=>Fixed
    Thu 06 Dec 2012 01:28:33 PM UTCachadwickAttached File-=>Added tilt_testing_2.zip, #16830
      Attached File-=>Added tilt_testing_2.jpg, #16831
    Thu 06 Dec 2012 04:41:02 AM UTCmarandAttached File-=>Added tilt-brush-new-2.png, #16829
    Thu 06 Dec 2012 01:52:23 AM UTCachadwickStatusIn Progress=>Ready For Test
    Wed 05 Dec 2012 08:07:38 PM UTCachadwickStatusReady For Test=>In Progress
    Tue 27 Nov 2012 11:20:18 PM UTCmarandAttached File-=>Added tilt-brush-bug.png, #16806
    Tue 27 Nov 2012 08:43:26 PM UTCachadwickAttached File-=>Added bug19988test.zip, #16805
      StatusConfirmed=>Ready For Test
    Mon 27 Aug 2012 05:33:57 PM UTCachadwickStatusNone=>Confirmed
      Assigned toNone=>achadwick
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup