Realtime Compositor: Rewrite inpaint node #114849

Merged
Omar Emara merged 5 commits from OmarEmaraDev/blender:refactor-inpaint-node into main 2023-11-22 13:23:11 +01:00

5 Commits

Author SHA1 Message Date
Omar Emara 89c84f2700 Properly sample blur weights 2023-11-22 14:21:03 +02:00
Omar Emara f75ba0c471 Enable filtering for blur weights 2023-11-22 14:20:34 +02:00
Omar Emara 39e2d29761 Fix Metal compile error 2023-11-22 14:20:08 +02:00
Omar Emara c10488ffa3 Merge branch 'main' into refactor-inpaint-node 2023-11-22 12:26:03 +02:00
Omar Emara 7966137b3e Realtime Compositor: Rewrite inpaint node
This patch rewrites the Inpaint node in the Realtime Compositor. The old
method suffered from discontinuities and singularities in the inpainting
regions. Furthermore, it ignored semi-transparent areas.

The new method is inspired by a two pass method described by the paper:

  Rosner, Jakub, et al. "Fast GPU-based image warping and inpainting for
  frame interpolation." International Conferences on Computer Graphics,
  Vision and Mathematics. 2010.

In particular, we first fill the inpainting region using jump flooding,
then we apply a variable size blur pass whose size is proportional to
the distance to the inpainting boundary. The smoothed region is then
mixed with the input using its alpha.

The aforementioned method requires variable size blur, which is quite
expensive for this use case, so a new implementation was added that
approximates the method using a separable implementation, which provides
a visually pleasing result assuming a sufficiently smooth radius field,
which is true for our case since the field is an SDF.

Fixes: #114422
2023-11-14 16:58:10 +02:00