Spaces:
Running
on
Zero
Running
on
Zero
Update trellis/utils/render_utils.py
Browse files
trellis/utils/render_utils.py
CHANGED
@@ -31,7 +31,7 @@ def yaw_pitch_r_fov_to_extrinsics_intrinsics(yaws, pitchs, rs, fovs):
|
|
31 |
torch.sin(pitch),
|
32 |
]).cuda() * r
|
33 |
extr = utils3d.torch.extrinsics_look_at(orig, torch.tensor([0, 0, 0]).float().cuda(), torch.tensor([0, 0, 1]).float().cuda())
|
34 |
-
intr = utils3d.torch.
|
35 |
extrinsics.append(extr)
|
36 |
intrinsics.append(intr)
|
37 |
if not is_list:
|
@@ -88,9 +88,8 @@ def render_frames(sample, extrinsics, intrinsics, options={}, colors_overwrite=N
|
|
88 |
|
89 |
|
90 |
def render_video(sample, resolution=512, bg_color=(0, 0, 0), num_frames=300, r=2, fov=40, **kwargs):
|
91 |
-
|
92 |
-
|
93 |
-
pitch = torch.tensor([20.0 * 3.1415 / 180.0] * num_frames) # Fixed pitch at 20 degrees (isometric-like)
|
94 |
yaws = yaws.tolist()
|
95 |
pitch = pitch.tolist()
|
96 |
extrinsics, intrinsics = yaw_pitch_r_fov_to_extrinsics_intrinsics(yaws, pitch, r, fov)
|
|
|
31 |
torch.sin(pitch),
|
32 |
]).cuda() * r
|
33 |
extr = utils3d.torch.extrinsics_look_at(orig, torch.tensor([0, 0, 0]).float().cuda(), torch.tensor([0, 0, 1]).float().cuda())
|
34 |
+
intr = utils3d.torch.intrinsics_from_fov_xy(fov, fov)
|
35 |
extrinsics.append(extr)
|
36 |
intrinsics.append(intr)
|
37 |
if not is_list:
|
|
|
88 |
|
89 |
|
90 |
def render_video(sample, resolution=512, bg_color=(0, 0, 0), num_frames=300, r=2, fov=40, **kwargs):
|
91 |
+
yaws = torch.linspace(0, 2 * 3.1415, num_frames)
|
92 |
+
pitch = 0.25 + 0.5 * torch.sin(torch.linspace(0, 2 * 3.1415, num_frames))
|
|
|
93 |
yaws = yaws.tolist()
|
94 |
pitch = pitch.tolist()
|
95 |
extrinsics, intrinsics = yaw_pitch_r_fov_to_extrinsics_intrinsics(yaws, pitch, r, fov)
|