RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.77k stars 164 forks source link

Tiling artifact when denoising hi-res images #62

Closed fluidinteractive closed 4 years ago

fluidinteractive commented 4 years ago

When denoising an image in UHD (3840x2860) a straight vertical line appears in the middle of the filtered image.

You can find the original images here: http://shared.fluidinteractive.com/tmp/Images.zip

Here's the filtered image converted to jpeg (you need to see it at full resolution to see the artifact):

filtered

atafra commented 4 years ago

The link doesn't work. Could you please re-upload it? Also, could you please answer the following?

Thanks!

fluidinteractive commented 4 years ago

Fixed the image link.

I'm using OIDN v.1.1

The problem presents in both the machines I've tested on:

atafra commented 4 years ago

Thanks! I managed to download the package. One more question: did you use the included example "denoise" or your own code? If you used your own code, did you denoise the entire image in one filter execute call?

fluidinteractive commented 4 years ago

I used my own code in one filter execute call (col4f is a wrapper class on __m128):

m_oidn_filter.setImage("color", merged_image, oidn::Format::Float3, m_film_size.x, m_film_size.y, 0, sizeof(col4f)); m_oidn_filter.setImage("albedo", &m_albedo_image.front(), oidn::Format::Float3, m_film_size.x, m_film_size.y, 0, sizeof(col4f)); m_oidn_filter.setImage("normal", &m_normal_image.front(), oidn::Format::Float3, m_film_size.x, m_film_size.y, 0, sizeof(col4f)); m_oidn_filter.setImage("output", merged_image, oidn::Format::Float3, m_film_size.x, m_film_size.y, 0, sizeof(col4f)); m_oidn_filter.set("hdr", true); m_oidn_filter.setProgressMonitorFunction(&pg_integrator_t::filter_progress_func, (void*)(lock_request)); m_oidn_filter.commit();

// Filter the image m_oidn_filter.execute();

atafra commented 4 years ago

I managed to reproduce the issue. The artifact is caused by using one of input buffers ("color") as the output buffer too. The documentation allows this but in fact a recent memory usage optimization approach breaks this (which kicks in only at higher than 1080p resolutions). The solution is simply using a separate output buffer because unfortunately there is no other way to guarantee correctness without introducing additional memory allocation and copying. We'll update the documentation to disallow "in-place" denoising, and we'll also add a buffer check at runtime. Thanks for reporting this issue!

fluidinteractive commented 4 years ago

That's great! Thanks for finding the solution so quickly!

atafra commented 4 years ago

The documentation has been updated (including the website) and a runtime check has been added to the devel branch.

atafra commented 4 years ago

We've released v1.2.1 which re-introduces support for in-place denoising, without causing any artifacts.

fluidray commented 4 years ago

Great! Thanks for letting me know.