Pen Tilt Values
Most tablet pens will give us information about its current orientation, which we normally refer to as “tilt”. We get this data from the tablet driver, or the operating system, and we normalize them as two values that represents how much the pen is leaning in relation to two axes that are aligned with the tablet dimensions, so “Tilt_X” and “Tilt_Y”.
These values range from -1 to +1, with zero meaning there is no tilt. Unfortunately, because we did not document what directions these values represent to us, we have some discrepancies between platforms that need clearing up. For example: negative values for Tilt_Y mean tilting toward the user on some platforms, but tilting away on others.
To help clear this up I made a PR to help diagnose tilt values. Running one of the builds with the Annotate tool will show the tilt values on the status bar, with arrows indicating the implied direction.
This Might Be All Wrong
Without thinking about it too much, it seems to make sense that we can easily get these tilt values and use them to drive changes while sculpting. But what does it mean to actually use tilt for something while sculpting?
Your pen is normally always tilted while holding it. And you would expect that a change in tilt from some prior baseline is what matters. Perhaps how tilt has changed from average, or since the beginning of a stroke. But the Tilt_X and Tilt_Y values as we are storing them cannot be used directly in this way.
Ideally when you hold your pen at an exact 45 degree angle, leaning to the right and without any tilt forward or back, we would get 45 and 0 as tilt data. Conversely, leaning forward at 45 degrees without leaning left or right, we would get 0 and 45.
But if you lean your pen at a 45 degree angle, but at a direction that is toward a tablet corner, then Tilt_X and Tilt_Y values would now be something like 36 and 36 despite your pen being 45 degrees from the surface. This means that while you draw a complex curve our data will change even when your tilt does not.
Azimuth and Altitude
To do this correctly I think we’d need to store this as azimuth and altitude instead. Azimuth being the horizontal angle, so which direction it is facing. And altitude being the angle up from the surface. Think about your pen being like a telescope.
This would be more complicated, but I think it makes it actually useful. The tilt does not change with direction, but direction is important relative to the line you are drawing. Tilting to the right or left is relative to the line, not your tablet.
Does this make sense? Do we need to store azimuth and altitude instead of tilt_x and tilt_y or is there a use for tablet-oriented tilt values? Or do continue gathering the current tilt values and leave it for the consumer of the data (in the sculpt code) to transform these as needed?