Aδ: autodiff for discontinuous programs - applied to shaders
Yuting Yang, Connelly Barnes, Andrew Adams, Adam Finkelstein
Abstract
Over the last decade, automatic differentiation (AD) has profoundly impacted graphics and vision applications --- both broadly via deep learning and specifically for inverse rendering. Traditional AD methods ignore gradients at discontinuities, instead treating functions as continuous. Rendering algorithms intrinsically rely on discontinuities, crucial at object silhouettes and in general for any branching operation. Researchers have proposed fully- automatic differentiation approaches for handling discontinuities by restricting to affine functions, or semi- automatic processes restricted either to invertible functions or to specialized applications like vector graphics. This paper describes a compiler-based approach to extend reverse mode AD so as to accept arbitrary programs involving discontinuities. Our novel gradient rules generalize differentiation to work correctly, assuming there is a single discontinuity in a local neighborhood, by approximating the prefiltered gradient over a box kernel oriented along a 1D sampling axis. We describe when such approximation rules are first-order correct, and show that this correctness criterion applies to a relatively broad class of functions. Moreover, we show that the method is effective in practice for arbitrary programs, including features for which we cannot prove correctness. We evaluate this approach on procedural shader programs, where the task is to optimize unknown parameters in order to match a target image, and our method outperforms baselines in terms of both convergence and efficiency. Our compiler outputs gradient programs in TensorFlow, PyTorch (for quick prototypes) and Halide with an optional auto-scheduler (for efficiency). The compiler also outputs GLSL that renders the target image, allowing users to interactively modify and animate the shader, which would otherwise be cumbersome in other representations such as triangle meshes or vector art.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext c93fa9e0-b94d-4b4f-a00c-b96b5e87e981Cited by top-tier papers3
- Synthesizing Precise Static Analyzers for Automatic DifferentiationJacob Laurel, Siyuan Brant Qian, Gagandeep Singh, Sasa MisailovicOOPSLA 2023 · 8 citations
- Semantics of Integrating and Differentiating SingularitiesJesse Michel, Wonyeol Lee, Hongseok YangPLDI 2025
- Fiber Monte CarloNick Richardson, Deniz Oktay, Yaniv Ovadia, James C. Bowden et al.ICLR 2024
Builds on9
- Multiview Neural Surface Reconstruction by Disentangling Geometry and AppearanceLior Yariv, Yoni Kasten, Dror Moran, Meirav Galun et al.NeurIPS 2020 · 1,010 citations
- Soft Rasterizer: A Differentiable Renderer for Image-Based 3D ReasoningShichen Liu, Weikai Chen, Tianye Li, Hao LiICCV 2019 · 789 citations
- Radiative backpropagation: an adjoint method for lightning-fast differentiable renderingMerlin Nimier-David, Sébastien Speierer, Benoît Ruiz, Wenzel JakobSIGGRAPH 2020 · 107 citations
- Monte Carlo estimators for differential light transportTizian Zeltner, Sébastien Speierer, Iliyan Georgiev, Wenzel JakobSIGGRAPH 2021 · 70 citations
- Reverse-mode automatic differentiation and optimization of GPU kernels via enzymeWilliam S. Moses, Valentin Churavy, Ludger Paehler, Jan Hückelheim et al.SC 2021 · 50 citations
Related papers
- Systematically differentiating parametric discontinuitiesSai Praveen Bangaru, Jesse Michel, Kevin Mu, Gilbert Bernstein et al.SIGGRAPH 2021 · 30 citations
- Distributions for Compositionally Differentiating Parametric DiscontinuitiesJesse Michel, Kevin Mu, Xuanda Yang, Sai Praveen Bangaru et al.OOPSLA 2024 · 7 citations
- Efficient automatic scheduling of imaging and vision pipelines for the GPULuke Anderson, Andrew Adams, Karima Ma, Tzu-Mao Li et al.OOPSLA 2021 · 14 citations
- Iskra: A System for Inverse Geometry ProcessingAna Dodik, Ahmed H. Mahmoud, Justin SolomonSIGGRAPH 2026
- Plateau-Reduced Differentiable Path TracingMichael Fischer, Tobias RitschelCVPR 2023
