daniilidis-group / neural_renderer

A PyTorch port of the Neural 3D Mesh Renderer
Other
1.13k stars 252 forks source link

Render multiple objects #19

Closed gongzhitaao closed 6 years ago

gongzhitaao commented 6 years ago

I have two questions regarding the renderer part.

  1. Render in batches, i.e., render one object per image, but in batch model. I saw the first dimension is batch, does it means that you can load and render multiple objects at the same time, where each batch is one object? If yes, how? The problem is that each batch needs to be the same size. In other words, this requires each object have the same number of vertices.
  2. Render multiple objects in one image. Do you currently support rendering multiple objects into the same image?

Thanks!

nkolot commented 6 years ago
  1. Yes it renders one object per image. It assumes as you said that the objects have the same mesh topology. If you want to render scenes with objects that have different topologies you should do it separately.

  2. Actually rendering multiple objects in one image should not be very hard. All you have to do is make a big graph that has multiple connected components, and each component is a different object. For example if you have already loaded 2 different objects and you have the vertices and the faces, first you concatenate the tensors of vertices. Next before concatenating the faces tensors, you should augment each index in faces by the number of vertices in the first object, etc..

gongzhitaao commented 6 years ago

@nkolot The face indices offset.... :laughing: got me for an hour