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?
nvdiffrast/nvdiffrast/torch/ops.py
Line 202 in a4e7a4d
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.