tldr: Fringing happens because the subpixels are not properly aligned. It can be alleviated by "shifting" the underlying data to colocale in the center of the pixel. On the Samsung Panel, a simplistic solution to this is as follows:
green_amt = 0.2
red_amt = 0.4
blue_amt = 0.3
for i in range(1, im.shape[0]-1):
for j in range(1, im.shape[1]-1):
green_out[i, j] = green[i, j+1]*(green_amt) + green[i, j]*(1-green_amt)
red_out[i, j] = red[i, j-1]*(red_amt) + red[i, j]*(1-red_amt)
blue_out[i, j] = blue[i+1, j]*(blue_amt) + blue[i, j]*(1-blue_amt)
outim[:, :, 1] = green_out
The above ignores that green/red are a bit above the center and blue alternates between being in the left and right. Refinements are possible but for my personal usecases are not necessary at the moment.
Hey,
Thought I would comment here, hopefully this isn't totally the wrong place :) Thank you for creating the defring shader and for your work with reshadeck.
I have been using the shader with reshadeck, but I keep getting pretty high performance impact, most notably in elden ring and no mans sky. I tested it in injected reshade and it works perfectly with no performance impact. So I guess gamescope is having some issues. Anyway, I thought I would test it out in vkbasalt, as that would allow enabling it globally, but can't seem to get it working. I am just getting a blackscreen.
I installed vkbasalt and it is working normally, but when I add the "defring" to the effects and boot into games I get an black screen, I understand this is an issue often with reshade shaders and vkbasalt, and I was wondering if you had a similar issue or an idea why this might be happening? or if there are some prerequisites I am missing?