A Jalgorithm for Japplying Jeans to Jobjects
For years, society has been plagued by the lack of a conclusive answer to the question of how arbitrary things would wear jeans, if they wore jeans. This paper proposes a jalgorithm to determine the mathematically optimal configuration of pants on a silhouette, leveraging recent insights in the fields of computer vision and differentiable rendering.
This is based off of the diffvg differential vector graphics renderer. It uses a customized loss function to optimize the vertices of pants, based on the following rules:
- Duality of man: Pants should bisect the silhouette of the wearer through its center, covering half its area.
- No-stretch jeans: Pants, when applied to the wearer in rest position, should not be so deformed that they no longer resemble prototypical jeans.
- (Topologically) torn jean avoidance: Limbs should only go through the open ends of pants, and similarly, closed ends of pants should not intersect limbs.
- Dress code compliance: Pants should be on the body of the wearer, not off of it.
Read the paper for more details!
You really shouldn't look at the code for this as I wrote it at 1am really quickly and hackily, but if you really want to, it's in apps/pants.py
.
Results
![]() |
![]() |
![]() |
![]() |
Running the Code
- Follow the setup instructions from BachiLi/diffvg
cd apps
python pants.py