ShapeMOD: Macro Operation Discovery for 3D Shape Programs

R. Kenny Jones, David Charatan, Paul Guerrero, Niloy J. Mitra, Daniel Ritchie · DOI

Abstract

Procedural modeling is a powerful technique for creating detailed, controllable 3D shapes by generating geometry through programs. However, to be truly effective, these programs must be compact and expose only meaningful degrees of freedom. Manually authoring high-level "macros" to achieve this is difficult and requires domain expertise. We present ShapeMOD, an algorithm that automatically discovers useful macros across large datasets of imperative 3D shape programs. ShapeMOD operates by minimizing the number of function calls and free parameters, thereby abstracting common structural and parametric patterns. Our results demonstrate that ShapeMOD significantly improves performance in shape generative modeling, program inference from point clouds, and interactive shape editing.

Introduction

Procedural modeling allows creators to generate 3D geometry using structured, editable programs. While powerful, most shape programs are currently written in low-level languages where components—such as individual chair legs—are defined independently. This leads to significant redundancy and an overwhelming number of degrees of freedom. For instance, a low-level program might allow a user to modify the height of one leg, leaving others disconnected and floating.

Expert-designed "macros" (e.g., four_leg_base(height, width)) can solve these issues by grouping related operations into high-level functions. However, manually creating these for large-scale datasets is impractical. ShapeMOD addresses this challenge by automatically discovering parametric macros in imperative 3D shape languages, bridging the gap between low-level geometric primitives and high-level structural concepts.

Overview of ShapeMOD pipeline: from low-level programs to discovered macros and their application in generative modeling.

Methodology: The ShapeMOD Algorithm

ShapeMOD operates on programs written in ShapeAssembly, a domain-specific language (DSL) for 3D structures. The algorithm follows an iterative, two-phase process to refine the library of available operations.

The Proposal Phase

The goal of this phase is to identify candidate macros. The system samples programs from the dataset and clusters them based on structural similarity. For each cluster, it derives an "abstracted program" that represents the commonalities among the cluster members by replacing specific values with variables or mathematical expressions. Subsequences of these abstracted instructions are then proposed as candidate macros.

The Proposal Phase: Clustering programs, creating abstracted programs, and proposing candidate macros.

The Integration Phase

In the integration phase, candidate macros are greedily evaluated. A macro is added to the DSL library only if it improves a global Objective Function. This function balances two competing goals:

  1. Compression: Reducing the total number of free parameters and function calls in the dataset.
  2. Simplicity: Keeping the library of functions concise to prevent over-specialization.

ShapeMOD is particularly adept at discovering relationships between continuous variables. For example, it can learn that the height of a table base and the thickness of its top must sum to a constant total height, effectively discovering geometric constraints that were previously implicit.

Experimental Evaluation

The authors evaluated ShapeMOD on three categories of manufactured shapes from the PartNet dataset: Chairs (3,836 programs), Tables (6,536 programs), and Storage units (1,551 programs).

Key Results

  • Dataset Compression: ShapeMOD significantly reduced program complexity. For the Chair dataset, it removed approximately 30% of program lines and 30% of continuous parameters compared to the original low-level programs.
  • Generative Modeling: Variational Autoencoders (VAEs) trained on ShapeMOD-refactored programs produced more plausible and structurally sound shapes. In the Storage category, the Frechet Distance (FD)—a metric for distributional similarity—improved from 70.0 to 38.1.
  • Visual Program Induction: When training neural networks to infer programs from raw point clouds, using ShapeMOD macros resulted in an 11% average relative improvement in reconstruction accuracy.
  • Interactive Editing: A user study with 38 participants revealed that users could edit shapes to match targets significantly faster using discovered macros. The macros provided meaningful "sliders" (e.g., overall height) rather than requiring the manipulation of dozens of individual coordinates.

Discussion and Future Work

ShapeMOD demonstrates that treating compression as a regularizer can force a model to learn the underlying "rules" of a shape category. By reducing the parameter space, the algorithm effectively discovers structural symmetries and constraints.

However, several challenges remain. Currently, the discovered macros are named generically (e.g., macro_1). Future work could leverage Large Language Models (LLMs) to provide semantic names like slatted_backrest. Additionally, while ShapeMOD handles sequences and parameters, it does not yet discover higher-level constructs like loops or conditional branches. Finally, the search process in the integration phase is computationally intensive; incorporating neurally-guided search could enhance efficiency.

In conclusion, ShapeMOD provides a robust framework for automatically abstracting 3D shape programs, making them more efficient for both machine learning models and human creators.

Summary updated

BibTeX
@article{jones2021shapemod,
  author = {R. Kenny Jones and David Charatan and Paul Guerrero and Niloy J. Mitra and Daniel Ritchie},
  title = {{ShapeMOD: Macro Operation Discovery for 3D Shape Programs}},
  journal = {ACM Trans. Graphics},
  year = {2021},
  doi = {10.1145/3450626.3459821},
}
Figure