Skip to content

Commit

Permalink
Merge pull request maria-korosteleva#12 from maria-korosteleva/refact…
Browse files Browse the repository at this point in the history
…or_sim_merge

Merge sim and meshgen routines into this project
  • Loading branch information
maria-korosteleva authored Jul 24, 2024
2 parents 27ea3b3 + 3dbf0d5 commit eb8fca7
Show file tree
Hide file tree
Showing 302 changed files with 45,436 additions and 2,781,396 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ system.json
# file for small script tries
tmp*
*tmp*.mb
Logs*
Logs*
output*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Maria Korosteleva
Copyright (c) 2024 Maria Korosteleva

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
75 changes: 74 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Implementation of GarmentCode architecture and garment programs.
* matplotlib
* [svgpathtools](https://github.com/mathandy/svgpathtools)
* [cairoSVG](https://cairosvg.org/)
NOTE: this lib has some quirks on Windows, which we relove with including needed dlls in `./patttern/cairo_dlls` and adding the ditrectory to PATH in runtime
NOTE: this lib has some quirks on Windows, which we relove with including needed dlls in `./external/cairo_dlls` and adding the ditrectory to PATH in runtime
* [PySimpleGUI](https://github.com/PySimpleGUI/PySimpleGUI) to run GUI script

All python dependencies can be installed with
Expand Down Expand Up @@ -74,3 +74,76 @@ SOON: displaying garment parameters for direct manipulation

## Attribution
We are using samples from [SMPL](https://smpl.is.tue.mpg.de/) body model as base for [Body Model examples](assets/Bodies).


## TODO

### Notes
* cairo_dlls windows

### Installation for Maya
The contects of this directory are modified from the code of https://github.com/maria-korosteleva/Garment-Pattern-Generator (pattern package)

Add current directory (`./external`) to PYTHONPATH for Maya to use this version when loading garment viewer or running batch sumulation.

The entry script for garment viewer is the same as in the original project and can be taken from there.

Additional dependencies in this version:
* [svgpathtools](https://github.com/mathandy/svgpathtools)
* [cairoSVG](https://cairosvg.org/)
NOTE: this lib has some quirks on Windows, which we relove with including needed dlls in `./external/cairo_dlls` and adding the ditrectory to PATH in runtime
* -svglib- removed!

These are need to be installed in Maya Python with the rest of the libs from original project.

## Instructions from old sim repo

Run mesh generation, simulation and image rendering of a pattern:
--------------------------------------------------------------------
1. Put your pattern .json file into: "meshgen > assets > Patterns" folder and please name the json file such that it ends with "_specification.json" (e.g. "dress_specification.json)

2. Open garment_gen_sim.py:
- Adapt the garment_name (line 66) to your garment name (without "_specification": e.g. "dress")
- Set appropriate body_name: default is ['non_centered','f_average_A40']
-> use 'centered' for an old data sample, i.e. if the body is centered at the origin
-> models: "f_average_A40", "m_average_A40", "f_model_A40", "f_fluffy_A40", "f_smpl_template"
-> for a custom model, place it into the "meshgen > assets > Bodies > centered or uncentered" folder

3. Run garment_gen_sim.py:
- See the output in the "output" folder :)
-> panels: .obj file of each panel
-> simulation:
- "body.obj" (body as .obj file)
- the .png renders
- "...-simulated.obj" (simulated cloth as .obj file)
- "...-simulation.usd" (simulation file, can be viewed in Blender or Omniverse Create XR)
-> "meshgen > gui > blenderGUI.blend" displays simulation with segmentation
(see instructions in Scripting window)




Run dataset:
-------------
1. Generate your dataset
2. In datasim.py change the path_to_Proc_Garm (line 44) to your Procedural Garment root directory and run it with
--data "name of your dataset" (e.g. --data data_40_230829-11-07-59)
3. Ouput: See the output in the "dataset_properties.yaml file" in the folder of your dataset


To metion:
------------
1. using trimesh lib to load garments with textures
```
print('Reloading exported ply ', path_to_out)
mesh_again: trimesh.Trimesh = trimesh.load_mesh(path_to_out, process=False)
#
print(mesh_again.visual.uv.shape, type(mesh_again.visual))
tex_image = PIL.Image.open(tex_path)
tex = trimesh.visual.TextureVisuals(mesh_again.visual.uv, image=tex_image)
mesh_again.visual = tex
mesh_again.show()
```
1. How to restore the texture used in the data renders from the optimized version
Loading

0 comments on commit eb8fca7

Please sign in to comment.