Skip to content
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

Fix nearest-neighbor interpolation of cached reconstruction filter #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

linusmossberg
Copy link

Hi Benedikt!

I was implementing film and reconstruction functionality in my renderer and I learned a lot from your implementation. I think that I stumbled upon a very tiny problem in your implementation that can have a noticeable effect on the result however.

When you retrieve the cached filter value, you effectively floor the continuous array index (via int cast) rather than rounding it to the closest integer. This will pick the "wrong" value (i.e. not the nearest neighbor) about 50% of the time as shown in the illustration below.

Since we are dealing with positive values, shifting the continuous index to the left by adding 0.5 before flooring is enough to achieve rounding. Here's a comparison between direct filter evaluation as reference, floor and round (using the Lanczos filter):

diff

I removed the normalization of _filter to achieve the same intended filter for these comparisons, since direct evaluation is not normalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant