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/.
翻译:可微分渲染是逆向渲染与机器学习的关键组成部分,它允许通过优化场景参数(形状、材质、光照)以最佳匹配目标图像。可微分渲染要求每个场景参数通过可微分操作与像素值相关联。虽然三维网格渲染算法已能以可微分方式实现,但这些算法无法直接扩展到构造实体几何(CSG)——一种流行的参数化形状表示方法,因为其底层的布尔运算通常由复杂的黑盒网格处理库执行。本文提出一种算法DiffCSG,用于以可微分方式渲染CSG模型。我们的算法基于CSG光栅化技术,该技术通过显示图元间布尔运算的结果而无需显式计算生成网格,从而绕过了黑盒网格处理。我们阐述了如何在可微分渲染流程中实现CSG光栅化,特别注重在图元交界面处应用抗锯齿技术以获取这些关键区域的梯度。本算法简洁高效,易于集成至现代机器学习框架,并为计算机辅助设计开启了多种应用场景,包括对CSG图元的直接编辑与基于图像的编辑。代码与数据:https://yyyyyhc.github.io/DiffCSG/。