Discussion of Pen Tablet Tilt

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?

3 Likes

Ultimately it’s easier to judge it when trying it out and working with the brushes for a while.
But my opinion on this:

I agree that the tilt setting makes it extremely difficult to use the brush without any tilt applied, unless you hold the brush perfectly straight (in terms of altitude). Nobody should be forced to use brushes like that.
But I’m worried that changing the default 0 angle for altitude and azimuth limits the amount of angles that you can get?
The more common alternative is to have specific brushes that use Tilt and switch between the those and the regular ones.
As far as I know in painting applications it’s similar. There are brushes that are meant to be used with Tilt and others behave with the default digital way. Tilt is useful for specific effects and more control over the stroke, if you need it.

But I’m also to opposed to trying out changing the default 0 angles.
Because there’s another notable thing about the Tilt for sculpting brushes. The brushes are not emulating the real world effect of a calligraphy pen or painting brushes that have a recognizable tilt effect.
Instead the tilt effect is more abstract and digital, by just offsetting the brush normal.
Since there’s no pre-existing association to real world sculpting tools, maybe it’s not so off-putting to have the tilt work differently. But it really has to be visualized via the brush cursor to avoid confusion.

I’m curious what other think. Maybe there’s already an established way how other sculpting applications handle Tilt (or not at all)? Or something else that I’m not seeing right now.

2 Likes

I would personally store tilt_x and tilt_y and let the sculpt code decide what to do with them, but it seems that both coordinate systems are okay since you should be able to convert from one to the other anyway.

I’d store a direction vector. Even if you end up using the tilt data in a way where an Azimuth and Altitude format would make sense, direction vectors are familiar territory for folks who work on DCCs. Makes it easy to reason about.

This will sound like a cop-out, but I’m very likely overthinking this.

This is really about how this data is obtained from the devices and how it is stored in Blender. Sculpting and painting are consumers of this data and they should use it any way they wish. If they find that these tablet axes tilt values are insufficient for some purpose then they can be converted to azimuth and altitude at that point. Probably using a single function written by some math whiz. In fact we might end up with multiple transformations of the data that uses starting values, stroke direction, etc, so there isn’t really a need to massage the data early on. Keeping it simple as the stored values probably makes sense.

1 Like