pmh47 / dirt

DIRT: a fast differentiable renderer for TensorFlow
MIT License
312 stars 63 forks source link

Render depth and silhouette #76

Closed dihuangdh closed 4 years ago

dihuangdh commented 4 years ago

Hi @pmh47

Can dirt render depth and silhouette? How ?

Thanks.

pmh47 commented 4 years ago

Yes, this can be done using the usual rasterise or rasterise_batch -- pass the depths (i.e. negative view-space z-coordinates) as one vertex color channel (e.g. red channel), and all ones as another (e.g. green), then split the final image channels, i.e. red will be a depth-map and green the silhouette. For background, use a large value for red (so points where there is no object are given large depth), and zero for green.