Thanks for the great work. I think there is a bug in the look_at_matrix in camera_utils.py.
def look_at_matrix(camera_pos, target, invert_pos=True):
"""Creates a 4x4 look-at matrix, keeping the camera pointing towards a target."""
forward = (target - camera_pos).float()
forward = forward / torch.norm(forward)
up = torch.tensor([0.0, 1.0, 0.0], device=camera_pos.device) # assuming Y-up coordinate system
right = torch.cross(up, forward)
right = right / torch.norm(right)
up = torch.cross(forward, right)
look_at = torch.eye(4, device=camera_pos.device)
look_at[0, :3] = right
look_at[1, :3] = up
look_at[2, :3] = forward
look_at[:3, 3] = (-camera_pos) if invert_pos else camera_pos
return look_at
The camera_pos should be multiplied by the rotation before being inserted into the camera matrix.
Hi,
Thanks for the great work. I think there is a bug in the look_at_matrix in camera_utils.py.
The camera_pos should be multiplied by the rotation before being inserted into the camera matrix.