-
-
Notifications
You must be signed in to change notification settings - Fork 56
Improve the interpolation filter in flush #1121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Looks like we have some sort of race condition with the screenshots again ... the |
@Korijn ready from my end (finally) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it was a bit challenging but an important change!
Yeah, loads of subtleties. Like the odd vs even kernels ... and I spend quite some time on good tests. |
For those interested, here's some interesting background on the filters: |
Closes #1118
Motivation
The practical improvements of this work are:
pixel_ratio
, apply fxaa, then upscale, and get reasonably pleasing results.Tasks
OutputPass
to use a cubic Mitchell filter by default.renderer.pixel_filter
to set the texture type (nearest, linear, disk, gaussian, or cubic).Notes
The texture access in the shader is implemented with a templated loop: I've found that doing it in a wgsl for-loop, the performance is much worse, because wgsl does not yet unroll loops, and can therefore not optimize/combine the multiple texture fetches.
The new
FilterType
enum is implemented usingLiteral
, an idea from pygfx/wgpu-py#720. Let's see how that works out.Since the old version applied a tiny bit of blurring, even if the source and target texture were of the same size, and the current version does not, all validation screenshots need to be updated 🤷
Example
The basic line example, with aa off, pixel_ratio set to 0.1.
With
renderer.pixel_filter = 'nearest'
:With
renderer.pixel_filter = 'disk'
:With
renderer.pixel_filter = 'bspline'
(soft):With
renderer.pixel_filter = 'mitchell'
(the default, sharper, see the minor ringing effects):With
renderer.pixel_filter = 'catmull'
(really sharp, this is an interpolating (Cardinal) spline, see the major ringing effects):