NVlabs/nvdiffrast

Support to rasterize a batch of triangles

Turlan opened this issue · 3 comments

Thanks for the code!

I want to use this code to rasterize a batch of meshes with different triangles. However, in your definition, it seems that this implementation only considers a same triangle for a batch. Could you provide an implementation that supports rasterization of a batch of triangles?

tri: Triangle tensor with shape [num_triangles, 3] and dtype `torch.int32`.

Hi Turlan! It sounds like you're looking for the range mode for rasterization.

You will need to collect all vertex positions into a single tensor, and similarly for the triangle index triplets — be sure to adjust the vertex indices according to where the positions are in the combined position tensor. Then, you can use the ranges parameter when rasterizing to specify which span of triangles should be rasterized into each element of minibatch.

Thanks! Yes, that's exactly what I need, I will try it later.

Thanks! Yes, that's exactly what I need, I will try it later.