NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I customize the rendered image shape?

csyhping opened this issue · comments

Hi @s-laine , thanks for your excellent work. I try to render a mesh into an image in which the image's shape is the same as a reference image (i.e., 300 * 419); my target is to see how the mesh looks in the reference image. However, when I changed the resolution=[300, 419] in rasterization(), I got the error RuntimeError: width and height must be divisible by 8. May I ask how I should customize the image shape?

The easiest solution is to use the OpenGL rasterizer that doesn't have restrictions on image shape. Alternatively, you'll have to round the resolution up to a supported size and crop the rasterization result to the actual size. Note that you will also need to adjust the projection matrix with a 2D transform that places the desired image into the pixels that are kept after the crop.

Thanks !