Daankular commited on
Commit
05165c5
Β·
1 Parent(s): 13cb6d2

Replace bake_texture with TexturePipeline (mvadapter API change)

Browse files

bake_texture() was removed from mvadapter.utils.mesh_utils.
Replace with TexturePipeline(upscaler=None, inpainter=None) which
does pure UV projection (inpaint_mode='uv') without requiring any
additional checkpoint downloads.
- No upscaler needed (view_upscale=False)
- No network inpainter needed (inpaint_mode='uv' uses UV-space projection only)
- UV unwrapped at 1024px resolution

Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -1026,17 +1026,24 @@ def apply_texture(glb_path, input_image, remove_background, variant, tex_seed,
1026
 
1027
  # ── Bake textures onto mesh ─────────────────────────────────────
1028
  progress(0.85, desc="Baking UV texture onto mesh...")
1029
- from mvadapter.utils.mesh_utils import (
1030
- NVDiffRastContextWrapper, load_mesh, bake_texture,
1031
- )
1032
-
1033
- ctx = NVDiffRastContextWrapper(device=DEVICE, context_type="cuda")
1034
- mesh = load_mesh(glb_path, rescale=True, device=DEVICE)
1035
- tex_pil = Image.open(mv_path)
1036
 
1037
- baked = bake_texture(ctx, mesh, tex_pil, cameras=cameras, height=1024, width=1024)
1038
- out_glb = os.path.join(out_dir, "textured_shaded.glb")
1039
- baked.export(out_glb)
 
 
 
 
 
 
 
 
 
 
 
 
 
1040
 
1041
  final_path = "/tmp/triposg_textured.glb"
1042
  shutil.copy(out_glb, final_path)
 
1026
 
1027
  # ── Bake textures onto mesh ─────────────────────────────────────
1028
  progress(0.85, desc="Baking UV texture onto mesh...")
1029
+ from mvadapter.pipelines.pipeline_texture import TexturePipeline, ModProcessConfig
 
 
 
 
 
 
1030
 
1031
+ texture_pipe = TexturePipeline(
1032
+ upscaler_ckpt_path=None, # no upscaler needed
1033
+ inpaint_ckpt_path=None, # inpaint_mode="uv" does not use network inpainter
1034
+ device=DEVICE,
1035
+ )
1036
+ tex_out = texture_pipe(
1037
+ mesh_path=glb_path,
1038
+ save_dir=out_dir,
1039
+ save_name="textured",
1040
+ uv_unwarp=True,
1041
+ uv_size=1024,
1042
+ rgb_path=mv_path,
1043
+ rgb_process_config=ModProcessConfig(view_upscale=False, inpaint_mode="uv"),
1044
+ camera_azimuth_deg=[0, 45, 90, 180, 270, 315],
1045
+ )
1046
+ out_glb = tex_out.shaded_model_save_path
1047
 
1048
  final_path = "/tmp/triposg_textured.glb"
1049
  shutil.copy(out_glb, final_path)