shubham-goel/ucmr

The question about load obj file

Closed this issue · 4 comments

Hi , I am a graduate student study computer graphic from Taiwan
I want ask some question about the code

In your paper said "When UV mapping is not good enough ,is a distortion-minimizing unwrap of a template mesh along manually defined seams computed using blender " .

In "bird_template.npy" ,the vertex_uv number is equal to vertex number.
If I cut the mesh with seams, and unwrap the bird_template ,bird_template's "vertex_uv" number will be more than "vertex" number because of additional boundary ,
In the same time the "faces_uv" number is equal to faces.

I want to ask if I do distortion-minimizing unwrap can the OBJ loader work as usual?
Or I need to do some extra work?

2020-12-21 14-11-27 的螢幕擷圖

Hi @b4824583 . To quickly answer your question, the load_obj_file function will work even if you unwrap the mesh. It is expected for verts_uv to be larger in size than verts as long as there's a 1-1 mapping between faces_uv and faces.

Here's an example to understand this better: Imagine 2 adjacent faces f_a = (a, v1, v2) and f_b = (b, v1, v2) sharing an edge (v1, v2) though which a seam passes. In the UV-mapping, the edge (v1,v2) will appear in twice as (uv1, uv2) and (uv1', uv2') because a seam passed through it. This results in an increased size for verts_uv. However, the faces f_a and f_b will be uv-mapped to (uv_a, uv1, uv2) and (uv_b, uv1', uv2') respectively.

Thanks for your reply ! !
So the load_obj_file will work even I unwrap the mesh.

But did I need to set textureUnwrapUV to True?

question2

I saw the describe about textureUnwrapUV ,it looks like it will UV mapping to image.

question_1

In this block , when textureUnwrapUV is true the "compute_uvsampler_unwrapUV" method will use faces_uv or it will use verts_sph .

Yes please set textureUnwrapUV to True when using an unwrapped mesh so that the mesh is textured by sampling the generated texture map correctly.

I got it
Thanks a million for your help