pixels icon indicating copy to clipboard operation
pixels copied to clipboard

Implement pixel aspect ratio

Open parasyte opened this issue 4 years ago • 3 comments

This is still missing linear texture filtering to smooth out the stretching artifacts that it introduces. The images shown in the example README show the artifacts that I'm talking about. The pixels are chunkier than they should be. For additional info on how it's supposed to look, this blog post goes into plenty of detail. Another resource is https://tanalin.com/en/articles/integer-scaling/

  • [ ] Fix "shimmer" aka "wave" effect with moving images when PAR != 1.0.
  • [ ] Add API to change PAR at runtime.

parasyte avatar Mar 10 '21 08:03 parasyte

After bouncing some ideas off the wgpu chat, the conclusion is to rewrite the shader to use multiple samplers and do the individual scaling steps. I don't want to prematurely optimize, so it's going to do both samplers+scaling steps regardless of the PAR value.

The next checklist item would be an API to allow changing the PAR at runtime. I don't know if this will be useful, but it's always possible that someone comes along with a use case for it. It would also be an improvement for the PAR example; a key to toggle PAR correction on/off will be more illustrative than just some static screenshots in the README.

parasyte avatar Mar 10 '21 20:03 parasyte

Sorry to be a nag but what is the state of this PR? Anything we can do to help?

dbalsom avatar Jun 01 '23 15:06 dbalsom

There aren't any updates for this PR other than what is already here. Specifically, the extra context provided in #262 kind of obsoletes the implementation in this PR. In short, this does allow for non-square pixel aspect ratios, but it comes at the cost of "pixel shimmering" in animations, especially when things move horizontally. Texture filtering like the two-pass implementation in #262 can address that problem.

There is still an unresolved issue there; how to integrate the second pass into the library as a first-class feature (that PR currently requires it to be added to a project as a custom renderer). If you are interested in helping drive the effort, that would be the place to start.

parasyte avatar Jun 02 '23 06:06 parasyte