def render_fim_wim(self, cam, vertices, smpl_faces=True): if smpl_faces: faces = self.smpl_faces else: faces = self.obj_faces bs = cam.shape[0] faces = faces.repeat(bs, 1, 1) # set offset_z for persp proj proj_verts = self.proj_func(vertices, cam) # flipping the y-axis here to make it align with the image coordinate system! proj_verts[:, :, 1] *= -1 # calculate the look_at vertices. vertices = nr.look_at(proj_verts, self.eye) # rasterization faces = nr.vertices_to_faces(vertices, faces) fim, wim = nr.rasterize_face_index_map_and_weight_map( faces, self.image_size, False) f2pts = faces[:, :, :, 0:2] f2pts[:, :, :, 1] *= -1 return f2pts, fim, wim
def render_fim_wim(self, vertices, faces=None): if faces is None: bs = vertices.shape[0] faces = self.faces.repeat(bs, 1, 1) # calculate the look_at vertices. vertices = nr.look_at(vertices, self.eye) # rasterization faces = nr.vertices_to_faces(vertices, faces) fim, wim = nr.rasterize_face_index_map_and_weight_map(faces, self.image_size, False) return fim, wim
def render_uv_fim_wim(self, bs): """ Args: bs: Returns: """ f_img2uvs = self.f_img2uvs.repeat(bs, 1, 1, 1) f_img2uvs[:, :, :, 1] *= -1 fim, wim = nr.rasterize_face_index_map_and_weight_map( f_img2uvs, self.image_size, False) return fim, wim