Spaces:
Sleeping
Sleeping
fabiencasenave
commited on
Commit
•
65555e4
1
Parent(s):
32ff3c8
Update app.py
Browse files
app.py
CHANGED
@@ -35,26 +35,26 @@ def sample_info(sample_id_str, fieldn):
|
|
35 |
str__ = f"loading sample {sample_id_str}"
|
36 |
|
37 |
|
38 |
-
#
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
#
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
#
|
58 |
# r = pyrender.OffscreenRenderer(512, 512)
|
59 |
# color, _ = r.render(scene)
|
60 |
|
|
|
35 |
str__ = f"loading sample {sample_id_str}"
|
36 |
|
37 |
|
38 |
+
# generate mesh
|
39 |
+
sphere = trimesh.creation.icosphere(subdivisions=4, radius=0.8)
|
40 |
+
sphere.vertices+=1e-2*np.random.randn(*sphere.vertices.shape)
|
41 |
+
mesh = pyrender.Mesh.from_trimesh(sphere, smooth=False)
|
42 |
|
43 |
+
# compose scene
|
44 |
+
scene = pyrender.Scene(ambient_light=[.1, .1, .3], bg_color=[0, 0, 0])
|
45 |
+
camera = pyrender.PerspectiveCamera( yfov=np.pi / 3.0)
|
46 |
+
light = pyrender.DirectionalLight(color=[1,1,1], intensity=2e3)
|
47 |
|
48 |
+
scene.add(mesh, pose= np.eye(4))
|
49 |
+
scene.add(light, pose= np.eye(4))
|
50 |
|
51 |
+
c = 2**-0.5
|
52 |
+
scene.add(camera, pose=[[ 1, 0, 0, 0],
|
53 |
+
[ 0, c, -c, -2],
|
54 |
+
[ 0, c, c, 2],
|
55 |
+
[ 0, 0, 0, 1]])
|
56 |
|
57 |
+
# render scene
|
58 |
# r = pyrender.OffscreenRenderer(512, 512)
|
59 |
# color, _ = r.render(scene)
|
60 |
|