| import os |
| os.environ['ATTN_BACKEND'] = 'xformers' |
| os.environ['SPCONV_ALGO'] = 'native' |
| |
| |
|
|
|
|
| import imageio |
| import numpy as np |
| import open3d as o3d |
| from trellis.pipelines import TrellisTextTo3DPipeline |
| from trellis.utils import render_utils, postprocessing_utils |
|
|
| |
| pipeline = TrellisTextTo3DPipeline.from_pretrained("microsoft/TRELLIS-text-xlarge") |
| pipeline.cuda() |
|
|
| |
| base_mesh = o3d.io.read_triangle_mesh("assets/T.ply") |
|
|
| |
| outputs = pipeline.run_variant( |
| base_mesh, |
| "Rugged, metallic texture with orange and white paint finish, suggesting a durable, industrial feel.", |
| seed=1, |
| |
| |
| |
| |
| |
| ) |
| |
| |
| |
| |
|
|
| |
| video_gs = render_utils.render_video(outputs['gaussian'][0])['color'] |
| video_mesh = render_utils.render_video(outputs['mesh'][0])['normal'] |
| video = [np.concatenate([frame_gs, frame_mesh], axis=1) for frame_gs, frame_mesh in zip(video_gs, video_mesh)] |
| imageio.mimsave("sample_variant.mp4", video, fps=30) |
|
|
|
|