PyFRep: Shape Modeling with Differentiable Function Representation
Pierre-Alain Fayolle, Evgenii Maltsev
TL;DR
This work addresses differentiable geometric modeling by leveraging Function Representation ($f:\mathbb{R}^3\to\mathbb{R}$) to define solids via the zero level-set $\{x\,|\,f(x)=0\}$ and extends it with reverse-mode automatic differentiation to compute space- and parameter-derivatives. The authors introduce PyFRep, a Python-based framework (backed by libraries like PyTorch) that supports SDF and non-SDF primitives, periodic functions, and parametric modeling, enabling curvature computations, distance-function normalization, redistancing, and parametric shape fitting $E(\mathbf{p}) = \frac{1}{N}\sum_i f(\mathbf{x}_i; \mathbf{p})^2$ via gradients. Key contributions include differentiable curvature formulas (mean, Gaussian, principal) derived from $\nabla f$ and the Hessian, robust SDF-based workflows, and a practical pipeline for inverse geometric design through gradient-based optimization and evolutionary methods. The framework emphasizes open-source accessibility, backend flexibility, and applicability to CAD, modeling, and graphics pipelines, highlighting the practical impact of differentiable geometric kernels in design optimization and shape interrogation. Overall, PyFRep provides a differentiable, modular, and extensible approach to implicit shape modeling that integrates with modern autodiff ecosystems for tasks ranging from curvature analysis to data-driven shape fitting.
Abstract
We propose a framework for performing differentiable geometric modeling based on the Function Representation (FRep). The framework is built on top of modern libraries for performing automatic differentiation allowing us to obtain derivatives w.r.t. space or shape parameters. We demonstrate possible applications of this framework: Curvature estimation for shape interrogation, signed distance function computation and approximation and fitting shape parameters of a parametric model to data. Our framework is released as open-source.
