We introduce ClothCode, a unified generative framework for garment state estimation and action-conditioned dynamics prediction in a shared discrete configuration space. A material-aligned tokenizer encodes garment configuration as residual vector-quantized patch tokens, while task-specific Masked Generative Transformers predict these tokens through parallel confidence-guided refinement. Across three garment templates, ClothCode reduces mean displacement error by 26.6% for state estimation and 37.0% for dynamics prediction relative to the strongest baselines. Dynamics prediction requires only 16.7 ms per window, compared with 556.2 ms for diffusion. Integrated into the same model-predictive controller, ClothCode improves real-world folding and flattening success from 56.7% to 78.9%. Further results and videos are available at: https://anonymous.4open.science/r/ClothCode-DE32
Figures & tables
Fig. 1: Overview of our discrete generative framework for model-based garment manipulation. A garment configuration is encoded as a set of discrete patch tokens shared by two Masked Generative Transformers (MGTs). (1) The discrete garment representation captures local deformation states over fixed material patches. (2) For state estimation, an MGT iteratively predicts the complete token configuration from a partial point cloud. (3) For dynamics prediction, an action-conditioned MGT predicts future garment configurations for candidate actions, allowing MPC to select the trajectory with the lowest goal cost. (4) The resulting perception–prediction loop enables closed-loop garment manipulation on a real robot.
Fig. 2: Overview of ClothCode. ClothCode first learns a discrete representation of garment shape (top). Each mesh is divided into fixed patches that track the same material regions across deformations, encoded as two-level residual vector-quantization (RVQ) tokens, and reconstructed by a shared mesh decoder. This frozen representation provides a common prediction space for two tasks. For state estimation (bottom left), a masked transformer combines a partial point cloud with masked garment tokens to recover the complete garment configuration and its global position. For dynamics prediction (bottom right), a second masked transformer combines recent garment states with a candidate end-effector trajectory and jointly predicts the future garment sequence and its global motion. M denotes a masked token.
ID
Action-OOD
Physics-OOD
Rollout
Method
MDE ↓
EMD ↓
MDE ↓
EMD ↓
MDE ↓
EMD ↓
Oracle ↓
Free ↓
Fabric
UCD-Transformer [ 5 ]
1.652
1.511
2.138
1.965
1.987
1.741
1.306
2.684
UniClothDiff
1.172
1.118
1.508
1.465
1.379
1.328
1.920
3.916
PGND
1.345
1.150
1.702
1.495
1.545
1.344
1.499
2.957
ClothCode (Ours)
0.730
0.694
0.884
0.843
0.859
0.818
0.864
1.822
TABLE I: Action-conditioned dynamics prediction (cm, ↓ ). Single-window results predict 10 future frames from 3 context frames. Rollout MDE is reported on ID with oracle and predicted ( free ) context.
Fig. 3: Qualitative comparison of garment dynamic prediction. Per-vertex reconstruction errors with respect to the ground-truth mesh are visualized using a shared color scale across all methods.
Fig. 4: Qualitative comparison of garment state estimation from camera observations. Per-vertex reconstruction errors with respect to the ground-truth mesh are visualized using a shared color scale across all methods.
Eval A (ID)
Eval B (Action-OOD)
Garment
Method
MDE ↓
EMD ↓
Chamfer ↓
MDE ↓
EMD ↓
Chamfer ↓
Fabric
Uniclothdiff
1.384
1.205
1.770
1.624
1.352
1.896
Transformer
1.910
1.388
1.881
2.285
1.565
2.021
GarmentNets
1.993
1.745
2.314
2.191
1.870
2.423
MEDOR
2.106
1.809
2.343
2.290
1.918
2.417
ClothCode (Ours)
0.890
0.680
1.182
1.104
0.795
1.279
TABLE II: Garment state estimation from partial point-cloud observations.