From fb0b93c3c050fe4fd37555733cb51c49f32b27b0 Mon Sep 17 00:00:00 2001 From: liguohao Date: Thu, 28 Feb 2019 10:17:12 +0800 Subject: [PATCH 1/2] bug fix for render_texture in mesh_core.cpp --- face3d/mesh/cython/mesh_core.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/face3d/mesh/cython/mesh_core.cpp b/face3d/mesh/cython/mesh_core.cpp index 3f3aec2..9e25bad 100644 --- a/face3d/mesh/cython/mesh_core.cpp +++ b/face3d/mesh/cython/mesh_core.cpp @@ -270,9 +270,9 @@ void _render_texture_core( tex_tri_p1_ind = tex_triangles[3*i + 1]; tex_tri_p2_ind = tex_triangles[3*i + 2]; - tex_p0.x = tex_coords[3*tex_tri_p0_ind]; tex_p0.y = tex_coords[3*tri_p0_ind + 1]; - tex_p1.x = tex_coords[3*tex_tri_p1_ind]; tex_p1.y = tex_coords[3*tri_p1_ind + 1]; - tex_p2.x = tex_coords[3*tex_tri_p2_ind]; tex_p2.y = tex_coords[3*tri_p2_ind + 1]; + tex_p0.x = tex_coords[3*tex_tri_p0_ind]; tex_p0.y = tex_coords[3*tex_tri_p0_ind + 1]; + tex_p1.x = tex_coords[3*tex_tri_p1_ind]; tex_p1.y = tex_coords[3*tex_tri_p1_ind + 1]; + tex_p2.x = tex_coords[3*tex_tri_p2_ind]; tex_p2.y = tex_coords[3*tex_tri_p2_ind + 1]; x_min = max((int)ceil(min(p0.x, min(p1.x, p2.x))), 0); From 13414758eb589b71ae26e0c552e0821b4fb05558 Mon Sep 17 00:00:00 2001 From: liguohao Date: Thu, 28 Feb 2019 10:33:05 +0800 Subject: [PATCH 2/2] bug fix for example/5_render.py --- examples/5_render.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/5_render.py b/examples/5_render.py index 9b4757d..a7e70a8 100644 --- a/examples/5_render.py +++ b/examples/5_render.py @@ -54,9 +54,9 @@ uv_coords = face3d.morphable_model.load.load_uv_coords('Data/BFM/Out/BFM_UV.mat') # general UV coords: range [0-1] # to texture size texcoord = np.zeros_like(uv_coords) -texcoord[:,0] = uv_coords[:,0]*(tex_h - 1) -texcoord[:,1] = uv_coords[:,1]*(tex_w - 1) -texcoord[:,1] = tex_w - texcoord[:,1] - 1 +texcoord[:,0] = uv_coords[:,0]*(tex_w - 1) +texcoord[:,1] = uv_coords[:,1]*(tex_h - 1) +texcoord[:,1] = tex_h - texcoord[:,1] - 1 texcoord = np.hstack((texcoord, np.zeros((texcoord.shape[0], 1)))) # add z# render texture python # tex_triangles tex_triangles = triangles