From 13d83b7597788f4d4693b26308023a9c6fe4cd49 Mon Sep 17 00:00:00 2001 From: botbw <1019508714@qq.com> Date: Tue, 23 Jan 2024 15:32:44 +0800 Subject: [PATCH] Fix NVlabs/eg3d#67 buggy planes --- eg3d/training/volumetric_rendering/renderer.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/eg3d/training/volumetric_rendering/renderer.py b/eg3d/training/volumetric_rendering/renderer.py index a27aea61..48e7e4d7 100644 --- a/eg3d/training/volumetric_rendering/renderer.py +++ b/eg3d/training/volumetric_rendering/renderer.py @@ -25,16 +25,24 @@ def generate_planes(): Defines planes by the three vectors that form the "axes" of the plane. Should work with arbitrary number of planes and planes of arbitrary orientation. + + Fix: https://github.com/NVlabs/eg3d/issues/67 + + Using col vector representation (torch.linalg.inv will change it into row vector and right mul row coordinates) + xyz -> xyz + xyz -> xzy + xyz -> zyx + [:2] will generate xy, xz, zy """ - return torch.tensor([[[1, 0, 0], + return torch.tensor([[[1, 0, 0], [0, 1, 0], [0, 0, 1]], [[1, 0, 0], [0, 0, 1], [0, 1, 0]], - [[0, 0, 1], - [1, 0, 0], - [0, 1, 0]]], dtype=torch.float32) + [0, 0, 1], + [0, 1, 0], + [1, 0, 0]], dtype=torch.float32) def project_onto_planes(planes, coordinates): """ @@ -250,4 +258,4 @@ def sample_pdf(self, bins, weights, N_importance, det=False, eps=1e-5): # anyway, therefore any value for it is fine (set to 1 here) samples = bins_g[...,0] + (u-cdf_g[...,0])/denom * (bins_g[...,1]-bins_g[...,0]) - return samples \ No newline at end of file + return samples