RuntimeError: width and height must be divisible by 8
ForrestPi opened this issue · comments
setting resx=960 resy=540
got
out, out_db = _get_plugin().rasterize_fwd_cuda(raster_ctx.cpp_wrapper, pos, tri, resolution, ranges, peeling_idx)
RuntimeError: width and height must be divisible by 8
could anyone help me?
The Cuda-based rasterizer currently expects a viewport size where both dimensions are divisible by 8, and 540 is not divisible by 8.
The solution is to use a rendering resolution where both dimensions are divisible by 8, e.g., 960×544.
If you want to, you can run the rasterizer in a larger resolution and then crop the output to 960×540 by removing top 2 and bottom 2 rows of the output. The y coordinate of the vertex positions should be adjusted beforehand to account for the crop:
pos_adjusted = pos * torch.tensor((1, 540/544, 1, 1), dtype=pos.dtype, device=pos.device)
out, out_db = dr.rasterize(glctx, pos_adjusted, tri, (544, 960))
out = out[:, 2:-2, :, :] # crop to 960x540
out_db = out_db[:, 2:-2, :, :]
The remainder of the rendering pipeline should use the unadjusted vertex positions as it's operating on the cropped image.
thanks