Closed vangoghcat closed 4 years ago
Yes -- just use the negative view-space vertex z-coordinates as the vertex colours (and maybe set the background to some large value). For example, starting from samples/simple.py
, replace line 68-74 with
pixels = dirt.rasterise(
vertices=cube_vertices_clip,
faces=cube_faces,
vertex_colors=-cube_vertices_camera[:, 2:3],
background=tf.ones([frame_height, frame_width, 1]) * 20.
)
Can the code generate a depth map from a 3D mesh? if so, how should i do?