What makes Krita's canvas operations feel so "wrong"?

The leading solution concept to this is theoretically simple albeit very difficult. I have more concepts, but this seems the most doable though extremely technical.

The first thing you’d have to do is turn vsync on for Krita. This is the easy part as on Nvidia GPUs this is the default. This will force Krita to only render frames after the previous frame has been written from buffer. This theory would also work for non-v-sync, but might be slightly more erratic.

Turning on VSync will naturally introduce a slight delay of about 1 frame.

In the background, asynchronously, a pointer pseudoposition function is constantly receiving inputs from the actual pointer. It keeps the last 2 (or more if you’re a math major) of these positions and timings in-memory for later reference.

At any point in time that an action requires an ‘up to date’ and ‘consistent’ but not necessarily extremely accurate pointer position, such as for panning, zooming, rotating, etc, instead of grabbing the current pointer position, it calls the pointerPseudoposition function.

This function grabs the current microtime, and extrapolates a ‘current’ pointer position given the previous 2 mouse positions and microtime. I’d imagine the math would look something like:

x1 = last known x position
x2 = last x position before x1
y1 = last known y position
y2 = last y position before y1
time1 = time int in microseconds of last known pointer input
time2 = time int in microseconds of previously known pointer input before time1
currentTime = the microseconds of when the function is called

newX = x1 + ( (currentTime - time1) / (time1 - time2) * (x1 - x2))
newY = y1 + ( (currentTime - time1) / (time1 - time2) * (y1 - y2))

This will output an X and Y position of the ‘mouse’ which should slot perfectly into whatever function the current pan/rotate/zoom function uses when it calls for the mouse position.

This will cause slightly weird behavior if the pointer changes directions instantaneously, but for natural movements such as tablet pens, this could be a lifesaver. Perhaps it could be a toggle-able feature called ‘polling rate compensation’.

1 Like