# DiffCSG: Differentiable CSG via Rasterization

arXiv: https://arxiv.org/abs/2409.01421 · HTML: https://mlsanity.com/paper/2409.01421/

## Key facts

- Cited by 7 papers in the map (data through 14 Oct 2026).
- Builds on 20 of its 44 references that are in the map.
- First posted on arXiv 2 Sep 2024.

## Builds on (most cited first, 20 of 20)

- [Adam: A Method for Stochastic Optimization](https://mlsanity.com/paper/1412.6980/) (2014)
- [Modular Primitives for High-Performance Differentiable Rendering](https://mlsanity.com/paper/2011.03277/) (2020)
- [Soft Rasterizer: A Differentiable Renderer for Image-based 3D Reasoning](https://mlsanity.com/paper/1904.01786/) (2019)
- [TADA! Text to Animatable Digital Avatars](https://mlsanity.com/paper/2308.10899/) (2023)
- [CSGNet: Neural Shape Parser for Constructive Solid Geometry](https://mlsanity.com/paper/1712.08290/) (2017)
- [Write, Execute, Assess: Program Synthesis with a REPL](https://mlsanity.com/paper/1906.04604/) (2019)
- [UCSG-Net -- Unsupervised Discovering of Constructive Solid Geometry Tree](https://mlsanity.com/paper/2006.09102/) (2020)
- [CSG-Stump: A Learning Friendly CSG-Like Representation for Interpretable Shape Parsing](https://mlsanity.com/paper/2108.11305/) (2021)
- [Reconstructing editable prismatic CAD from rounded voxel models](https://mlsanity.com/paper/2209.01161/) (2022)
- [Fusion 360 Gallery: A Dataset and Environment for Programmatic CAD Construction from Human Design Sequences](https://mlsanity.com/paper/2010.02392/) (2020)
- [Differentiable Surface Rendering via Non-Differentiable Sampling](https://mlsanity.com/paper/2108.04886/) (2021)
- [Differentiable Rendering of Neural SDFs through Reparameterization](https://mlsanity.com/paper/2206.05344/) (2022)
- [ShapeCoder: Discovering Abstractions for Visual Programs from Unstructured Primitives](https://mlsanity.com/paper/2305.05661/) (2023)
- [Differentiable 3D CAD Programs for Bidirectional Editing](https://mlsanity.com/paper/2110.01182/) (2021)
- [Diffusion On Syntax Trees For Program Synthesis](https://mlsanity.com/paper/2405.20519/) (2024)
- [Transforming a Non-Differentiable Rasterizer into a Differentiable One with Stochastic Gradient Estimation](https://mlsanity.com/paper/2404.09758/) (2024)
- [Interactive and Robust Mesh Booleans](https://mlsanity.com/paper/2205.14151/) (2022)
- [Introducing Bidirectional Programming in Constructive Solid Geometry-Based CAD](https://mlsanity.com/paper/2408.01801/) (2024)
- [A Unified Differentiable Boolean Operator with Fuzzy Logic](https://mlsanity.com/paper/2407.10954/) (2024)
- [Understanding the Challenges of OpenSCAD Users for 3D Printing](https://mlsanity.com/paper/2408.01796/) (2024)

## Built on by (most cited first, 7 of 7)

- [ChatGarment: Garment Estimation, Generation and Editing via Large Language Models](https://mlsanity.com/paper/2412.17811/) (2024)
- [Deep Sketch-Based 3D Modeling: A Survey](https://mlsanity.com/paper/2603.03287/) (2026)
- [BrepGaussian: CAD reconstruction from Multi-View Images with Gaussian Splatting](https://mlsanity.com/paper/2602.21105/) (2026)
- [DualPrim: Compact 3D Reconstruction with Positive and Negative Primitives](https://mlsanity.com/paper/2603.16133/) (2026)
- [Scene Parameter Saliency via Differentiable Light Transport](https://mlsanity.com/paper/2607.21562/) (2026)
- [Differentiable Voxelization of Surface Representations](https://mlsanity.com/paper/2608.15934/) (2026)
- [CADFather: Autonomous CAD Reconstruction through Coordinated Tool Use](https://mlsanity.com/paper/2610.09127/) (2026)

## Abstract (arXiv)

Differentiable rendering is a key ingredient for inverse rendering and machine learning, as it allows to optimize scene parameters (shape, materials, lighting) to best fit target images. Differentiable rendering requires that each scene parameter relates to pixel values through differentiable operations. While 3D mesh rendering algorithms have been implemented in a differentiable way, these algorithms do not directly extend to Constructive-Solid-Geometry (CSG), a popular parametric representation of shapes, because the underlying boolean operations are typically performed with complex black-box mesh-processing libraries. We present an algorithm, DiffCSG, to render CSG models in a differentiable manner. Our algorithm builds upon CSG rasterization, which displays the result of boolean operations between primitives without explicitly computing the resulting mesh and, as such, bypasses black-box mesh processing. We describe how to implement CSG rasterization within a differentiable rendering pipeline, taking special care to apply antialiasing along primitive intersections to obtain gradients in such critical areas. Our algorithm is simple and fast, can be easily incorporated into modern machine learning setups, and enables a range of applications for computer-aided design, including direct and image-based editing of CSG primitives. Code and data: https://yyyyyhc.github.io/DiffCSG/.
