MCPcopy Index your code
hub / github.com/OpenMotionLab/MotionGPT / Renderer

Class Renderer

mGPT/render/renderer.py:51–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51class Renderer:
52 def __init__(self, background=None, resolution=(224, 224), bg_color=[0, 0, 0, 0.5], orig_img=False, wireframe=False, cam_pose=np.eye(4)):
53 width, height = resolution
54 self.background = np.zeros((height, width, 3))
55 self.resolution = resolution
56
57 self.faces = get_smpl_faces()
58 self.orig_img = orig_img
59 self.wireframe = wireframe
60 self.renderer = pyrender.OffscreenRenderer(
61 viewport_width=self.resolution[0],
62 viewport_height=self.resolution[1],
63 point_size=0.5
64 )
65
66 # set the scene
67 self.scene = pyrender.Scene(bg_color=bg_color, ambient_light=(0.4, 0.4, 0.4))
68
69 light = pyrender.PointLight(color=[1.0, 1.0, 1.0], intensity=4)
70
71
72 light_pose = np.eye(4)
73 light_pose[:3, 3] = [0, -1, 1]
74 self.scene.add(light, pose=np.dot(cam_pose,light_pose).copy())
75
76 light_pose[:3, 3] = [0, 1, 1]
77 self.scene.add(light, pose=np.dot(cam_pose,light_pose).copy())
78
79 light_pose[:3, 3] = [1, 1, 2]
80 self.scene.add(light, pose=np.dot(cam_pose,light_pose).copy())
81
82 """ok
83 light_pose = np.eye(4)
84 light_pose[:3, 3] = [0, -1, 1]
85 self.scene.add(light, pose=light_pose)
86
87 light_pose[:3, 3] = [0, 1, 1]
88 self.scene.add(light, pose=light_pose)
89
90 light_pose[:3, 3] = [1, 1, 2]
91 self.scene.add(light, pose=light_pose)
92 """
93
94 # light_pose[:3, 3] = [0, -2, 2]
95 # [droite, hauteur, profondeur camera]
96 """
97 light_pose = np.eye(4)
98 light_pose[:3, 3] = [0, -1, 1]
99 self.scene.add(light, pose=light_pose)
100
101 light_pose[:3, 3] = [0, 1, 1]
102 self.scene.add(light, pose=light_pose)
103
104 light_pose[:3, 3] = [1, 1, 2]
105 self.scene.add(light, pose=light_pose)
106 """
107
108 def render(self, img, verts, cam, angle=None, axis=None, mesh_filename=None, color=[1.0, 1.0, 0.9],

Callers 1

get_rendererFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected