arabago96 commited on
Commit
556066f
·
verified ·
1 Parent(s): 54918e4

Update trellis/utils/render_utils.py

Browse files
Files changed (1) hide show
  1. trellis/utils/render_utils.py +6 -2
trellis/utils/render_utils.py CHANGED
@@ -88,10 +88,14 @@ 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
- 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)
96
  return render_frames(sample, extrinsics, intrinsics, {'resolution': resolution, 'bg_color': bg_color}, **kwargs)
97
 
 
88
 
89
 
90
  def render_video(sample, resolution=512, bg_color=(0, 0, 0), num_frames=300, r=2, fov=40, **kwargs):
91
+ # Match the model viewer camera angle: yaw=45deg, pitch=75deg
92
+ # Convert degrees to radians for the camera calculations
93
+ yaws = torch.linspace(0, 2 * 3.1415, num_frames) # Full rotation around Y-axis
94
+ pitch = torch.tensor([75.0 * 3.1415 / 180.0] * num_frames) # Fixed pitch at 75 degrees
95
  yaws = yaws.tolist()
96
  pitch = pitch.tolist()
97
+ # Adjust distance to match model viewer's final position (closer view)
98
+ r = 1.5 # Closer than default 2, similar to model viewer's 100% distance
99
  extrinsics, intrinsics = yaw_pitch_r_fov_to_extrinsics_intrinsics(yaws, pitch, r, fov)
100
  return render_frames(sample, extrinsics, intrinsics, {'resolution': resolution, 'bg_color': bg_color}, **kwargs)
101