yz-cnsdqz / PSI-release

official implementation of CVPR'20 oral paper: Generating 3D People in Scenes without People.: https://ps.is.tuebingen.mpg.de/publications/smpl-x-conditional-vae-prox-scene-constraints
Other
148 stars 16 forks source link

SDF calculation? #1

Closed wangzheallen closed 4 years ago

wangzheallen commented 4 years ago

Nice work!~

May I ask how do you convert the mesh (obj) file to SDF? any hint code on that? and is the SDF file we get in world coordinate or camera coordinate? What does the "max","min" value means in the scenes_sdf',scenename+'.json' means?

Thanks!

yz-cnsdqz commented 4 years ago

Thanks for your interests. Pls see answers below.

Nice work!~

May I ask how do you convert the mesh (obj) file to SDF? any hint code on that?

SDF computation involves some additional steps. Briefly, Poisson remeshing is applied first to make the scene watertight. We are sorry that the code is not provided, due to agreements of some dependencies.

and is the SDF file we get in world coordinate or camera coordinate?

SDF is in the world coordinate.

What does the "max","min" value means in the scenes_sdf',scenename+'.json' means?

The SDF domain is specified like that.

Thanks!

wangzheallen commented 4 years ago

Thanks for the clarification.

Usually SDF is composed of two part: points: an N ✕ 3 numpy array containing the sample points sdf: a numpy array of size N with the corresponding SDF values May I ask whether the json file with max,min,dim value. corresponds to mesh to voxel (sample grid is dim value)? say we want to sample 256256256 grid, thus the dim here is 256? And max, min is 3 dim, which defines min and max value along "points: an N ✕ 3 numpy array containing the sample points"?

And how do you calculate normals?

May I ask did you do scale_to_unit_sphere before sampling point and calculate SDF? https://github.com/marian42/mesh_to_sdf/blob/master/mesh_to_sdf/utils.py#L4 Thanks.

yz-cnsdqz commented 4 years ago

Thanks for the clarification.

Usually SDF is composed of two part: points: an N ✕ 3 numpy array containing the sample points sdf: a numpy array of size N with the corresponding SDF values May I ask whether the json file with max,min,dim value. corresponds to mesh to voxel (sample grid is dim value)? say we want to sample 256_256_256 grid, thus the dim here is 256? And max, min is 3 dim, which defines min and max value along "points: an N ✕ 3 numpy array containing the sample points"?

You are right here. You could check the code for how to use them in details, e.g.

### sdf collision loss
s_grid_min_batch = self.s_grid_min_batch.unsqueeze(1)
s_grid_max_batch = self.s_grid_max_batch.unsqueeze(1)

norm_verts_batch = (body_verts_batch - s_grid_min_batch) / (s_grid_max_batch - s_grid_min_batch) *2 -1
n_verts = norm_verts_batch.shape[1]
body_sdf_batch = F.grid_sample(self.s_sdf_batch.unsqueeze(1), 
                                        norm_verts_batch[:,:,[2,1,0]].view(-1, n_verts,1,1,3),
                                        padding_mode='border')

And how do you calculate normals?

The way we use to compute normals of a watertight mesh is the standard version.

May I ask did you do scale_to_unit_sphere before sampling point and calculate SDF? https://github.com/marian42/mesh_to_sdf/blob/master/mesh_to_sdf/utils.py#L4 Thanks.

Regarding details about SDF, I suggest to ask the PROX team. SDF is actually part of PROX, rather than in this work. I have forwarded your questions to them.

wangzheallen commented 4 years ago

Thanks for the kind reply and forward :-)