Rasterized Edge Gradients: Handling Discontinuities Differentiably
Stanislav Pidhorskyi, Tomas Simon, Gabriel Schwartz, He Wen, Yaser Sheikh, Jason Saragih
TL;DR
EdgeGrad introduces a micro-edge based differentiable rasterization framework that preserves forward rasterization but enables accurate gradient computation at visibility discontinuities, including triangle boundaries, occlusions, and geometry intersections. The key derivation yields a closed-form edge-gradient for a boundary between two pixels, $\frac{\partial L}{\partial p_{AB}}=\tfrac{1}{2}(\frac{\partial L}{\partial I_A}+\frac{\partial L}{\partial I_B})(I_A-I_B)+\Omega$, plus a mechanism to scatter these gradients to geometry via $\frac{\partial p}{\partial r}$, accommodating overhangs and intersections. The method is implemented in PyTorch/CUDA and validated on synthetic and Blender-based datasets, showing comparable or superior gradient accuracy to finite differences, especially for intersecting geometries, while delivering significant speedups. It enables robust, automatic mesh-based inverse rendering, demonstrated in dynamic head scenes with mouth interior fitting guided by segmentation supervision, though it omits transparency effects and global illumination.
Abstract
Computing the gradients of a rendering process is paramount for diverse applications in computer vision and graphics. However, accurate computation of these gradients is challenging due to discontinuities and rendering approximations, particularly for surface-based representations and rasterization-based rendering. We present a novel method for computing gradients at visibility discontinuities for rasterization-based differentiable renderers. Our method elegantly simplifies the traditionally complex problem through a carefully designed approximation strategy, allowing for a straightforward, effective, and performant solution. We introduce a novel concept of micro-edges, which allows us to treat the rasterized images as outcomes of a differentiable, continuous process aligned with the inherently non-differentiable, discrete-pixel rasterization. This technique eliminates the necessity for rendering approximations or other modifications to the forward pass, preserving the integrity of the rendered image, which makes it applicable to rasterized masks, depth, and normals images where filtering is prohibitive. Utilizing micro-edges simplifies gradient interpretation at discontinuities and enables handling of geometry intersections, offering an advantage over the prior art. We showcase our method in dynamic human head scene reconstruction, demonstrating effective handling of camera images and segmentation masks.
