-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import kiui | ||
from kiui.mesh import Mesh | ||
from kiui.mesh_utils import clean_mesh | ||
|
||
import torch | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--mesh", type=str) | ||
parser.add_argument("--mesh2", type=str) | ||
parser.add_argument("--out", type=str, default='out.glb') | ||
opt = parser.parse_args() | ||
|
||
# load input mesh | ||
mesh = Mesh.load(opt.mesh) | ||
|
||
# must have texture to remap uv | ||
assert mesh.albedo is not None | ||
|
||
# load target mesh | ||
mesh2 = Mesh.load(opt.mesh2) | ||
|
||
# no texture for this mesh | ||
assert mesh2.albedo is None | ||
|
||
# remap uv | ||
mesh2.albedo = mesh.albedo | ||
mesh2.vt = mesh.remap_uv(mesh2.v) | ||
|
||
# write | ||
mesh2.write(opt.out) |