Page MenuHome

Denoising Baking Results
Needs RevisionPublic

Authored by Lukas Stockner (lukasstockner97) on Mar 10 2018, 4:11 AM.

Details

Summary

This patch adds support for denoising baking results in Cycles. It uses the same underlying algorithm, but with slightly different feature passes.

Currently, the denoising settings from the active RenderLayer are used. I considered adding separate controls for baking denoising, but since there are no separate controls for options like samples etc. either I figured this approach is fine for now.

ToDos:

  • Progress bar support, currently it's stuck at 100% until denoising finishes.
  • Seam merging. Since the filtering happens in pixel (and therefore UV) space, seams in the UV mapping show up in the final result because pixels in a different UV island will be outside the denoising radius and therefore missed. I have ideas how to avoid this issue, but it's not trivial since the NLM weights are based on patchwise pixel comparison.

This project was funded by Archilogic, thanks for the support!

Diff Detail

Event Timeline

Please use arc diff origin/blender2.8 to submit the patch. (or in this case: arc diff origin/blender2.8 --update D3099). Otherwise we get "Context not available." and the patch gets quickly outdated/hard to re-apply for testing.

Ah, right, sorry - this patch is based on the master branch, not 2.8, I'll upload with arc once I'm home.

Okay, here's an updated version with arc.

Brecht Van Lommel (brecht) requested changes to this revision.Mar 17 2018, 5:12 PM

I find this quite difficult to understand, and would rather not have so much specialized code for this.

I posted a patch in D3108 to make baking working with the regular render session and tiles, passing data to/from the bake API with RenderResult tiles. If you can rebase this patch on that, I believe it should let you remove a lot of code. Memory usage should be reduced as well since you only need to store denoising passes per tile.

All the hardcoded pass offsets in the denoising code are difficult to follow as well. It would be nice if baking and regular render could have a more similar memory layout for the denoising passes, having the same offsets for passes that are the same.

intern/cycles/kernel/kernel_bake.h
332–333

path_flag should be passed to shader_eval_surface.

This revision now requires changes to proceed.Mar 17 2018, 5:12 PM

As far as this patch is concerned I definitely like the tile approach, but the problem with that is the seam merging I mentioned as a ToDo.

Since the entire point of that is to combine baked pixels that are on different UV islands and therefore possibly other tiles, I'm actually currently working on making the baking denoising process even less tile-based because for the merging to work, the denoiser needs to be able to access the prefiltered values of potentially every pixel in the image...

So, I'm not sure where to go with this - I'd really like to have everything tile-based, but I don't see a way to do so while still supporting this edge-merge feature, so the question is whether that is actually worth the effort, and I can't say anything about that yet since it's far from working currently.

Ok, let's see how the seam-merging code will work before making a decision then.

The is some seam-aware/seam-erasure code that has recently been made available. I'm guessing it's public domain since I can't find any license info.

In case the links go down, the official title of the paper is called

"Seamless: Seam erasure and seam-aware decoupling of shape from mesh resolution" Songrun Liu*, Zachary Ferguson*, Alec Jacobson, Yotam Gingold (*Joint first authors)
ACM Transactions on Graphics (TOG) 36(6). Presented at SIGGRAPH Asia 2017.

and the address is:

https://cragl.cs.gmu.edu/seamless/

The example code is located at

https://github.com/zfergus/seam-erasure

I hope this helps to find a solution to your seamingly difficult problem, cheers :)