From 310d8b55abc050bd3d0ac1a0c9e6e4cfa6bb3336 Mon Sep 17 00:00:00 2001 From: hkato Date: Thu, 20 Sep 2018 15:42:17 +0900 Subject: [PATCH] fix ghost texture problem (issue #8) in load_obj --- neural_renderer/load_obj.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/neural_renderer/load_obj.py b/neural_renderer/load_obj.py index 6ac54de..6a14d2d 100644 --- a/neural_renderer/load_obj.py +++ b/neural_renderer/load_obj.py @@ -97,12 +97,13 @@ def load_textures(filename_obj, filename_mtl, texture_size): float dim0 = ((i / (ts * ts)) % ts) / (ts - 1.) ; float dim1 = ((i / ts) % ts) / (ts - 1.); float dim2 = (i % ts) / (ts - 1.); - if (1 < dim0 + dim1 + dim2) { - float sum = dim0 + dim1 + dim2; - dim0 /= sum; - dim1 /= sum; - dim2 /= sum; - } + + // sum(dim[k]) -> 1 + float sum = dim0 + dim1 + dim2; + dim0 /= sum; + dim1 /= sum; + dim2 /= sum; + const float* face = &faces[fn * 3 * 2]; float* texture = &textures[i * 3]; if (is_update[fn] == 0) return;